From 4011c26cc7cc3762a20d3927fc8cd80ad7b4d893 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 13 Feb 2018 01:09:52 +0000 Subject: [Utils] Salvage debug info of DCE'ed mul/sdiv/srem instructions Here are the number of additional debug values salvaged in a stage2 build of clang: 63 SALVAGE: MUL 1250 SALVAGE: SDIV (No values were salvaged from `srem` instructions in this experiment, but it's a simple case to handle so we might as well.) llvm-svn: 324976 --- llvm/lib/Transforms/Utils/Local.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Transforms/Utils/Local.cpp') diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 1340e12c5c6..45962ca9615 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1549,6 +1549,15 @@ void llvm::salvageDebugInfo(Instruction &I) { case Instruction::Sub: applyOffset(DII, -int64_t(Val)); break; + case Instruction::Mul: + applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_mul}); + break; + case Instruction::SDiv: + applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_div}); + break; + case Instruction::SRem: + applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_mod}); + break; case Instruction::Or: applyOps(DII, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_or}); break; -- cgit v1.2.3