[PATCH] D124517: [DebugInfo][InstrRef] Use a cache to avoid creating redundant DBG_PHIs
Jeremy Morse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 03:41:03 PDT 2022
jmorse created this revision.
jmorse added reviewers: StephenTozer, Orlando.
Herald added a subscriber: hiraditya.
Herald added a project: All.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
In SelectionDAG, DBG_PHI instructions are created to "read" physreg values and give them an instruction number, when they can't be traced back to a defining instruction. The most common scenario is arguments to a function. Unfortunately, if you have 100 inlined methods, each of which has the same "this" pointer, then the 100 dbg.value instructions become 100 DBG_INSTR_REFs and 100 DBG_PHIs, where only one DBG_PHI would suffice.
This patch adds a vreg cache for MachineFunction::salvageCopySSA, if we've already traced a value back to the start of a block and create a DBG_PHI then it allows us to re-use the DBG_PHI, as well as reducing work.
I've added a test with an implicit check-not for DBG_PHIs, which I think is the best way of making sure they aren't over-created in the future, and deserves its own test file.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124517
Files:
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/lib/CodeGen/MachineFunction.cpp
llvm/test/DebugInfo/X86/dbg-value-funcarg.ll
llvm/test/DebugInfo/X86/dbg-value-funcarg4.ll
llvm/test/DebugInfo/X86/instr-ref-selectiondag.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124517.425468.patch
Type: text/x-patch
Size: 7392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220427/12caac7c/attachment.bin>
More information about the llvm-commits
mailing list