summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-14 00:19:00 +0000
committerChris Lattner <sabre@nondot.org>2010-09-14 00:19:00 +0000
commitf1144f0929c821aa745f890eb7d558ff5960bdb4 (patch)
tree1701649e1e6a2e524915c96b0e50ce7616b1ed8b /llvm/lib
parent93c9b2ea936e92f0c53b18e60fe654cc8d91c4cf (diff)
downloadbcm5719-llvm-f1144f0929c821aa745f890eb7d558ff5960bdb4.tar.gz
bcm5719-llvm-f1144f0929c821aa745f890eb7d558ff5960bdb4.zip
fix PR8102, a case where we'd copyValue from a value that we already
deleted. Fix this by doing the copyValue's before we delete stuff! The testcase only repros the problem on my system with valgrind. llvm-svn: 113820
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 0db7ba771b4..af9a7eefb6a 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -837,6 +837,17 @@ void LICM::PromoteAliasSet(AliasSet &AS) {
ReplacedLoads[ALoad] = NewVal;
}
+ // If the preheader load is itself a pointer, we need to tell alias analysis
+ // about the new pointer we created in the preheader block and about any PHI
+ // nodes that just got inserted.
+ if (PreheaderLoad->getType()->isPointerTy()) {
+ // Copy any value stored to or loaded from a must-alias of the pointer.
+ CurAST->copyValue(SomeValue, PreheaderLoad);
+
+ for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
+ CurAST->copyValue(SomeValue, NewPHIs[i]);
+ }
+
// Now that everything is rewritten, delete the old instructions from the body
// of the loop. They should all be dead now.
for (unsigned i = 0, e = LoopUses.size(); i != e; ++i) {
@@ -867,17 +878,6 @@ void LICM::PromoteAliasSet(AliasSet &AS) {
User->eraseFromParent();
}
- // If the preheader load is itself a pointer, we need to tell alias analysis
- // about the new pointer we created in the preheader block and about any PHI
- // nodes that just got inserted.
- if (PreheaderLoad->getType()->isPointerTy()) {
- // Copy any value stored to or loaded from a must-alias of the pointer.
- CurAST->copyValue(SomeValue, PreheaderLoad);
-
- for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
- CurAST->copyValue(SomeValue, NewPHIs[i]);
- }
-
// fwew, we're done!
}
OpenPOWER on IntegriCloud