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 | 006b53f19941592faf8abfbe2300a8d4532c10a0 (patch) | |
| tree | a0c878993f2996ed7ea88287ee35c00ad66037c9 /llvm/lib/Transforms | |
| parent | b5c98ef61eedfbf6d2fe7b1853310797f6a41f0f (diff) | |
| download | bcm5719-llvm-006b53f19941592faf8abfbe2300a8d4532c10a0.tar.gz bcm5719-llvm-006b53f19941592faf8abfbe2300a8d4532c10a0.zip | |
mem2reg erases the dbg.declare intrinsics that it converts to dbg.val intrinsics
llvm-svn: 94763
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index c7b998c5539..544e20ba6b4 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/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 |

