[llvm-commits] [llvm] r46417 - in /llvm/trunk: lib/Transforms/Scalar/LoopUnroll.cpp test/Transforms/LoopUnroll/2007-11-05-Crash.ll

Nick Lewycky nicholas at mxc.ca
Sun Jan 27 10:35:00 PST 2008


Author: nicholas
Date: Sun Jan 27 12:35:00 2008
New Revision: 46417

URL: http://llvm.org/viewvc/llvm-project?rev=46417&view=rev
Log:
Be more careful modifying the use_list while also iterating through it.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
    llvm/trunk/test/Transforms/LoopUnroll/2007-11-05-Crash.ll

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Sun Jan 27 12:35:00 2008
@@ -365,8 +365,9 @@
       // be updated specially after unrolling all the way.
       if (*BB != LatchBlock)
         for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end();
-             UI != UE; ++UI) {
+             UI != UE;) {
           Instruction *UseInst = cast<Instruction>(*UI);
+          ++UI;
           if (isa<PHINode>(UseInst) && !L->contains(UseInst->getParent())) {
             PHINode *phi = cast<PHINode>(UseInst);
             Value *Incoming = phi->getIncomingValueForBlock(*BB);

Modified: llvm/trunk/test/Transforms/LoopUnroll/2007-11-05-Crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/2007-11-05-Crash.ll?rev=46417&r1=46416&r2=46417&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/LoopUnroll/2007-11-05-Crash.ll (original)
+++ llvm/trunk/test/Transforms/LoopUnroll/2007-11-05-Crash.ll Sun Jan 27 12:35:00 2008
@@ -1,5 +1,7 @@
 ; RUN: llvm-as < %s | opt -disable-output -loop-unroll
 ; PR1770
+; PR1947
+
 	%struct.cl_engine = type { i32, i16, i32, i8**, i8**, i8*, i8*, i8*, i8*, i8*, i8*, i8* }
 	%struct.cl_limits = type { i32, i32, i32, i32, i16, i64 }
 	%struct.cli_ac_alt = type { i8, i8*, i16, i16, %struct.cli_ac_alt* }





More information about the llvm-commits mailing list