diff options
author | Victor Hernandez <vhernandez@apple.com> | 2010-01-29 00:01:35 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2010-01-29 00:01:35 +0000 |
commit | 1897ed3d37141e590781d983adbbeca937b3ccfc (patch) | |
tree | 76f8306dc58cc55d3d0d655276a1bbd56abdbcfd /lib/Transforms | |
parent | 4533cac557cdcc13e7c990942758ec8338d9172a (diff) | |
download | external_llvm-1897ed3d37141e590781d983adbbeca937b3ccfc.zip external_llvm-1897ed3d37141e590781d983adbbeca937b3ccfc.tar.gz external_llvm-1897ed3d37141e590781d983adbbeca937b3ccfc.tar.bz2 |
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
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index c7b998c..544e20b 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 |