diff options
| author | Vedant Kumar <vsk@apple.com> | 2018-02-13 22:27:17 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2018-02-13 22:27:17 +0000 |
| commit | 1d5d31b70666e4b78f4cf4b837c17c9c3bbb53b3 (patch) | |
| tree | 34cafd47424df559eaa09dcb34372b7c07766a1c /llvm/lib/Transforms | |
| parent | 7558d860af88bde4b860d9f66fd0281a331db345 (diff) | |
| download | bcm5719-llvm-1d5d31b70666e4b78f4cf4b837c17c9c3bbb53b3.tar.gz bcm5719-llvm-1d5d31b70666e4b78f4cf4b837c17c9c3bbb53b3.zip | |
[GVN] Salvage debug info from dead insts
This preserves an additional 581 unique source variables in a stage2
build of clang (according to `llvm-dwarfdump --statistics`). It
increases the size of the .debug_loc section by 0.1% (or 87139 bytes).
Differential Revision: https://reviews.llvm.org/D43255
llvm-svn: 325063
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index e2c1eaf58e4..a9104408691 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -2105,6 +2105,7 @@ bool GVN::processBlock(BasicBlock *BB) { for (auto *I : InstrsToErase) { assert(I->getParent() == BB && "Removing instruction from wrong block?"); DEBUG(dbgs() << "GVN removed: " << *I << '\n'); + salvageDebugInfo(*I); if (MD) MD->removeInstruction(I); DEBUG(verifyRemoved(I)); if (MaybeFirstICF == I) { @@ -2320,6 +2321,7 @@ bool GVN::performScalarPRE(Instruction *CurInst) { VN.eraseTranslateCacheEntry(ValNo, *CurrentBlock); addToLeaderTable(ValNo, Phi, CurrentBlock); Phi->setDebugLoc(CurInst->getDebugLoc()); + salvageDebugInfo(*CurInst); CurInst->replaceAllUsesWith(Phi); if (MD && Phi->getType()->isPtrOrPtrVectorTy()) MD->invalidateCachedPointerInfo(Phi); |

