Avoid a use after free.

llvm-svn: 241345
This commit is contained in:
Rafael Espindola 2015-07-03 12:20:34 +00:00
parent 097110f590
commit d48e54c5ea
1 changed files with 4 additions and 1 deletions

View File

@ -4459,7 +4459,10 @@ std::error_code BitcodeReader::materialize(GlobalValue *GV) {
// Upgrade any old intrinsic calls in the function.
for (auto &I : UpgradedIntrinsics) {
if (I.first != I.second) {
for (auto *U : I.first->users()) {
for (auto UI = I.first->user_begin(), UE = I.first->user_end();
UI != UE;) {
User *U = *UI;
++UI;
if (CallInst *CI = dyn_cast<CallInst>(U))
UpgradeIntrinsicCall(CI, I.second);
}