summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2010-01-29 00:01:35 +0000
committerVictor Hernandez <vhernandez@apple.com>2010-01-29 00:01:35 +0000
commit1897ed3d37141e590781d983adbbeca937b3ccfc (patch)
tree76f8306dc58cc55d3d0d655276a1bbd56abdbcfd
parent4533cac557cdcc13e7c990942758ec8338d9172a (diff)
downloadllvm-1897ed3d37141e590781d983adbbeca937b3ccfc.tar.gz
llvm-1897ed3d37141e590781d983adbbeca937b3ccfc.tar.bz2
llvm-1897ed3d37141e590781d983adbbeca937b3ccfc.tar.xz
mem2reg erases the dbg.declare intrinsics that it converts to dbg.val intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94763 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index c7b998c553..544e20ba6b 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -373,9 +373,11 @@ void PromoteMem2Reg::run() {
// Finally, after the scan, check to see if the store is all that is left.
if (Info.UsingBlocks.empty()) {
- // Record debuginfo for the store before removing it.
- if (DbgDeclareInst *DDI = Info.DbgDeclare)
+ // Record debuginfo for the store and remove the declaration's debuginfo.
+ if (DbgDeclareInst *DDI = Info.DbgDeclare) {
ConvertDebugDeclareToDebugValue(DDI, Info.OnlyStore);
+ DDI->eraseFromParent();
+ }
// Remove the (now dead) store and alloca.
Info.OnlyStore->eraseFromParent();
LBI.deleteValue(Info.OnlyStore);
@@ -418,6 +420,10 @@ void PromoteMem2Reg::run() {
// The alloca has been processed, move on.
RemoveFromAllocasList(AllocaNum);
+ // The alloca's debuginfo can be removed as well.
+ if (DbgDeclareInst *DDI = Info.DbgDeclare)
+ DDI->eraseFromParent();
+
++NumLocalPromoted;
continue;
}
@@ -493,7 +499,11 @@ void PromoteMem2Reg::run() {
A->eraseFromParent();
}
-
+ // Remove alloca's dbg.declare instrinsics from the function.
+ for (unsigned i = 0, e = AllocaDbgDeclares.size(); i != e; ++i)
+ if (DbgDeclareInst *DDI = AllocaDbgDeclares[i])
+ DDI->eraseFromParent();
+
// Loop over all of the PHI nodes and see if there are any that we can get
// rid of because they merge all of the same incoming values. This can
// happen due to undef values coming into the PHI nodes. This process is