Don't use invalidated use_iterator's. This fixes a crash compiling povray
authorChris Lattner <sabre@nondot.org>
Fri, 20 Jan 2006 18:01:41 +0000 (18:01 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 20 Jan 2006 18:01:41 +0000 (18:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25479 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AutoUpgrade.cpp

index 26a9947d3062abe027fd6d007fc6cbf325fb1a1e..568d08ab7a0240232396e12f7d6e3f5010333c4f 100644 (file)
@@ -166,8 +166,8 @@ Instruction* llvm::UpgradeIntrinsicCall(CallInst *CI) {
 bool llvm::UpgradeCallsToIntrinsic(Function* F) {
   if (Function* newF = UpgradeIntrinsicFunction(F)) {
     for (Value::use_iterator UI = F->use_begin(), UE = F->use_end();
-         UI != UE; ++UI) {
-      if (CallInst* CI = dyn_cast<CallInst>(*UI)) {
+         UI != UE; UI) {
+      if (CallInst* CI = dyn_cast<CallInst>(*UI++)) {
         std::vector<Value*> Oprnds;
         User::op_iterator OI = CI->op_begin();
         ++OI;