[llvm-branch-commits] [llvm-branch] r99325 - in /llvm/branches/Apple/Morbo: ./ lib/Transforms/Scalar/IndVarSimplify.cpp
Bill Wendling
isanbard at gmail.com
Tue Mar 23 14:20:52 PDT 2010
Author: void
Date: Tue Mar 23 16:20:51 2010
New Revision: 99325
URL: http://llvm.org/viewvc/llvm-project?rev=99325&view=rev
Log:
$ svn merge -c 99324 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r99324 into '.':
U lib/Transforms/Scalar/IndVarSimplify.cpp
Modified:
llvm/branches/Apple/Morbo/ (props changed)
llvm/branches/Apple/Morbo/lib/Transforms/Scalar/IndVarSimplify.cpp
Propchange: llvm/branches/Apple/Morbo/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 23 16:20:51 2010
@@ -1,2 +1,2 @@
/llvm/branches/Apple/Hermes:96832,96835,96858,96870,96876,96879
-/llvm/trunk:98602,98604,98612,98615-98616,98675,98686,98743-98744,98773,98778,98780,98810,98835,98839,98845,98855,98862,98881,98920,98977,99032-99033,99043,99223,99263,99282-99284,99306,99319-99321
+/llvm/trunk:98602,98604,98612,98615-98616,98675,98686,98743-98744,98773,98778,98780,98810,98835,98839,98845,98855,98862,98881,98920,98977,99032-99033,99043,99223,99263,99282-99284,99306,99319-99321,99324
Modified: llvm/branches/Apple/Morbo/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=99325&r1=99324&r2=99325&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Transforms/Scalar/IndVarSimplify.cpp Tue Mar 23 16:20:51 2010
@@ -549,22 +549,26 @@
// New instructions were inserted at the end of the preheader.
if (isa<PHINode>(I))
break;
+
// Don't move instructions which might have side effects, since the side
- // effects need to complete before instructions inside the loop. Also
- // don't move instructions which might read memory, since the loop may
- // modify memory. Note that it's okay if the instruction might have
- // undefined behavior: LoopSimplify guarantees that the preheader
- // dominates the exit block.
+ // effects need to complete before instructions inside the loop. Also don't
+ // move instructions which might read memory, since the loop may modify
+ // memory. Note that it's okay if the instruction might have undefined
+ // behavior: LoopSimplify guarantees that the preheader dominates the exit
+ // block.
if (I->mayHaveSideEffects() || I->mayReadFromMemory())
continue;
+
// Skip debug info intrinsics.
if (isa<DbgInfoIntrinsic>(I))
continue;
+
// Don't sink static AllocaInsts out of the entry block, which would
// turn them into dynamic allocas!
if (AllocaInst *AI = dyn_cast<AllocaInst>(I))
if (AI->isStaticAlloca())
continue;
+
// Determine if there is a use in or before the loop (direct or
// otherwise).
bool UsedInLoop = false;
@@ -581,19 +585,29 @@
break;
}
}
+
// If there is, the def must remain in the preheader.
if (UsedInLoop)
continue;
+
// Otherwise, sink it to the exit block.
Instruction *ToMove = I;
bool Done = false;
- if (I != Preheader->begin())
- --I;
- else
+
+ if (I != Preheader->begin()) {
+ // Skip debug info intrinsics.
+ do {
+ --I;
+ } while (isa<DbgInfoIntrinsic>(I) && I != Preheader->begin());
+
+ if (isa<DbgInfoIntrinsic>(I) && I == Preheader->begin())
+ Done = true;
+ } else {
Done = true;
+ }
+
ToMove->moveBefore(InsertPt);
- if (Done)
- break;
+ if (Done) break;
InsertPt = ToMove;
}
}
More information about the llvm-branch-commits
mailing list