Fix bug: 2003-02-27-StoreSinkPHIs.ll

llvm-svn: 5658
This commit is contained in:
Chris Lattner 2003-02-27 21:59:36 +00:00
parent cabe8c0dac
commit 1ad80e2511
1 changed files with 4 additions and 1 deletions

View File

@ -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);