[llvm-commits] [llvm] r86036 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Chris Lattner sabre at nondot.org
Wed Nov 4 10:57:42 PST 2009


Author: lattner
Date: Wed Nov  4 12:57:42 2009
New Revision: 86036

URL: http://llvm.org/viewvc/llvm-project?rev=86036&view=rev
Log:
Fix an iterator invalidation bug that happens when a hashtable
resizes in IPSCCP.  This fixes PR5394.

Modified:
    llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=86036&r1=86035&r2=86036&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Wed Nov  4 12:57:42 2009
@@ -1280,9 +1280,10 @@
       }
       
       if (const StructType *STy = dyn_cast<StructType>(AI->getType())) {
-        for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i)
-          mergeInValue(getStructValueState(AI, i), AI,
-                       getStructValueState(*CAI, i));
+        for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+          LatticeVal CallArg = getStructValueState(*CAI, i);
+          mergeInValue(getStructValueState(AI, i), AI, CallArg);
+        }
       } else {
         mergeInValue(AI, getValueState(*CAI));
       }





More information about the llvm-commits mailing list