aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MIRPrinter.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2020-10-15 11:20:29 +0100
committerJeremy Morse <jeremy.morse@sony.com>2020-10-15 11:30:14 +0100
commitc521e44defb53d38a46f39e29870c628f25d124a (patch)
treeb3f3aa028b69b4ea1841a8d900cd790f225f2361 /llvm/lib/CodeGen/MIRPrinter.cpp
parentfadd152317598aa71538948613ce24b094c5c7c2 (diff)
downloadllvm-c521e44defb53d38a46f39e29870c628f25d124a.zip
llvm-c521e44defb53d38a46f39e29870c628f25d124a.tar.gz
llvm-c521e44defb53d38a46f39e29870c628f25d124a.tar.bz2
[DebugInstrRef] Support recording of instruction reference substitutions
Add a table recording "substitutions" between pairs of <instruction, operand> numbers, from old pairs to new pairs. Post-isel optimizations are able to record the outcome of an optimization in this way. For example, if there were a divide instruction that generated the quotient and remainder, and it were replaced by one that only generated the quotient: $rax, $rcx = DIV-AND-REMAINDER $rdx, $rsi, debug-instr-num 1 DBG_INSTR_REF 1, 0 DBG_INSTR_REF 1, 1 Became: $rax = DIV $rdx, $rsi, debug-instr-num 2 DBG_INSTR_REF 1, 0 DBG_INSTR_REF 1, 1 We could enter a substitution from <1, 0> to <2, 0>, and no substitution for <1, 1> as it's no longer generated. This approach means that if an instruction or value is deleted once we've left SSA form, all variables that used the value implicitly become "optimized out", something that isn't true of the current DBG_VALUE approach. Differential Revision: https://reviews.llvm.org/D85749
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 420a346..8cc3147 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -220,6 +220,10 @@ void MIRPrinter::print(const MachineFunction &MF) {
convert(MST, YamlMF.FrameInfo, MF.getFrameInfo());
convertStackObjects(YamlMF, MF, MST);
convertCallSiteObjects(YamlMF, MF, MST);
+ for (auto &Sub : MF.DebugValueSubstitutions)
+ YamlMF.DebugValueSubstitutions.push_back({Sub.first.first, Sub.first.second,
+ Sub.second.first,
+ Sub.second.second});
if (const auto *ConstantPool = MF.getConstantPool())
convert(YamlMF, *ConstantPool);
if (const auto *JumpTableInfo = MF.getJumpTableInfo())