diff options
author | Vedant Kumar <vsk@apple.com> | 2018-02-15 22:26:18 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-02-15 22:26:18 +0000 |
commit | 1df820ecd722add744021dbdb59fa42828f8ca92 (patch) | |
tree | 06689780ff3e0b2388fd815f5763be3e1ed2aa9f /llvm/lib/Transforms/Scalar/DCE.cpp | |
parent | 9967378eba5fcbbdb3bce4ce5c06af9fdea8f3d1 (diff) | |
download | bcm5719-llvm-1df820ecd722add744021dbdb59fa42828f8ca92.tar.gz bcm5719-llvm-1df820ecd722add744021dbdb59fa42828f8ca92.zip |
[DCE] Salvage debug info from dead insts
This results in small increases in the size of the .debug_loc section
and the number of unique source variables in a stage2 build of opt.
llvm-svn: 325301
Diffstat (limited to 'llvm/lib/Transforms/Scalar/DCE.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/DCE.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index fa4806e884c..d8575b71a3c 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/lib/Transforms/Scalar/DCE.cpp @@ -50,6 +50,7 @@ namespace { for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) { Instruction *Inst = &*DI++; if (isInstructionTriviallyDead(Inst, TLI)) { + salvageDebugInfo(*Inst); Inst->eraseFromParent(); Changed = true; ++DIEEliminated; @@ -76,6 +77,8 @@ static bool DCEInstruction(Instruction *I, SmallSetVector<Instruction *, 16> &WorkList, const TargetLibraryInfo *TLI) { if (isInstructionTriviallyDead(I, TLI)) { + salvageDebugInfo(*I); + // Null out all of the instruction's operands to see if any operand becomes // dead as we go. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { |