Fix an issue where phiMap was not being updated properly when doing load PRE.

Diagnosis and patch thanks to Jakub Staszak.

llvm-svn: 72562
This commit is contained in:
Owen Anderson 2009-05-29 05:37:54 +00:00
parent 87b037168e
commit 04cfdd38a2
1 changed files with 5 additions and 0 deletions

View File

@ -1125,6 +1125,11 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
LI->getAlignment(),
UnavailablePred->getTerminator());
SmallPtrSet<Instruction*, 4> &p = phiMap[LI->getPointerOperand()];
for (SmallPtrSet<Instruction*, 4>::iterator I = p.begin(), E = p.end();
I != E; ++I)
ValuesPerBlock.push_back(std::make_pair((*I)->getParent(), *I));
DenseMap<BasicBlock*, Value*> BlockReplValues;
BlockReplValues.insert(ValuesPerBlock.begin(), ValuesPerBlock.end());
BlockReplValues[UnavailablePred] = NewLoad;