aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-27 21:59:36 +0000
committerChris Lattner <sabre@nondot.org>2003-02-27 21:59:36 +0000
commit8601a9bf54049389e0e0b6a907dc51069dcadc60 (patch)
treed14a430446274f26d215fb13dce71ef1813309ee /lib/Transforms
parentda336622be90ee40fa5942d6da1dccdf90193021 (diff)
Fix bug: 2003-02-27-StoreSinkPHIs.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 0febce4823..534a073abe 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -437,7 +437,10 @@ void LICM::PromoteValuesInLoop() {
for (succ_iterator SI = succ_begin(*I), SE = succ_end(*I); SI != SE; ++SI)
if (!CurLoop->contains(*SI)) {
// Copy all of the allocas into their memory locations...
- Instruction *InsertPos = (*SI)->begin();
+ BasicBlock::iterator BI = (*SI)->begin();
+ while (isa<PHINode>(*BI))
+ ++BI; // Skip over all of the phi nodes in the block...
+ Instruction *InsertPos = BI;
for (unsigned i = 0, e = PromotedValues.size(); i != e; ++i) {
// Load from the alloca...
LoadInst *LI = new LoadInst(PromotedValues[i].first, "", InsertPos);