aboutsummaryrefslogtreecommitdiff
path: root/lib
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
commit9c282011e6b7a6e23a3a163ec9c865890449e8dc (patch)
treeb2ffd7467487e17780c735705641b081ce6c514a /lib
parent4caef6001d2180a707ab42f4986f9941d5d0248b (diff)
fix more AST updating bugs, correcting miscompilation in PR8041
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 85ed358dee..bf06fee6ef 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/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