diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 260bbedddc92..222320f52579 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1125,6 +1125,11 @@ bool GVN::processNonLocalLoad(LoadInst *LI, LI->getAlignment(), UnavailablePred->getTerminator()); + SmallPtrSet &p = phiMap[LI->getPointerOperand()]; + for (SmallPtrSet::iterator I = p.begin(), E = p.end(); + I != E; ++I) + ValuesPerBlock.push_back(std::make_pair((*I)->getParent(), *I)); + DenseMap BlockReplValues; BlockReplValues.insert(ValuesPerBlock.begin(), ValuesPerBlock.end()); BlockReplValues[UnavailablePred] = NewLoad;