summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-02 22:19:10 +0000
committerChris Lattner <sabre@nondot.org>2010-09-02 22:19:10 +0000
commitaffc0e42f0af6fff91d0ca9015d87cac9d8ef2d9 (patch)
treea1a2177d268109e9b3b621b06c05891c3515d914 /llvm/lib/Transforms
parent25f7aa81589e7e78cf38065e66257c45a0851283 (diff)
downloadbcm5719-llvm-affc0e42f0af6fff91d0ca9015d87cac9d8ef2d9.tar.gz
bcm5719-llvm-affc0e42f0af6fff91d0ca9015d87cac9d8ef2d9.zip
fix more AST updating bugs, correcting miscompilation in PR8041
llvm-svn: 112878
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 85ed358deec..bf06fee6efb 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -583,7 +583,7 @@ void LICM::sink(Instruction &I) {
// Update CurAST for NewPHIs if I had pointer type.
if (I.getType()->isPointerTy())
for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
- CurAST->copyValue(NewPHIs[i], &I);
+ CurAST->copyValue(&I, NewPHIs[i]);
// Finally, remove the instruction from CurAST. It is no longer in the loop.
CurAST->deleteValue(&I);
@@ -843,7 +843,9 @@ void LICM::PromoteAliasSet(AliasSet &AS) {
// inserting PHI nodes as necessary.
for (unsigned i = 0, e = LiveInLoads.size(); i != e; ++i) {
LoadInst *ALoad = LiveInLoads[i];
- ALoad->replaceAllUsesWith(SSA.GetValueInMiddleOfBlock(ALoad->getParent()));
+ Value *NewVal = SSA.GetValueInMiddleOfBlock(ALoad->getParent());
+ ALoad->replaceAllUsesWith(NewVal);
+ CurAST->copyValue(ALoad, NewVal);
}
// Now that everything is rewritten, delete the old instructions from the body
OpenPOWER on IntegriCloud