[DebugInfo][RemoveDIs] Handle non-instr debug-info in GlobalISel (#75228)
authorJeremy Morse <jeremy.morse@sony.com>
Tue, 12 Dec 2023 17:28:32 +0000 (17:28 +0000)
committerJeremy Morse <jeremy.morse@sony.com>
Tue, 23 Jan 2024 15:04:08 +0000 (15:04 +0000)
commit087172258a50d5bcabe43aff072a20701f0808ef
tree5443912565d1d6f4f3957215bbaef83490b0480b
parent9edd1c4daeba59b3db3390d449543b71c73f161b
[DebugInfo][RemoveDIs] Handle non-instr debug-info in GlobalISel (#75228)

The RemoveDIs project is aiming to eliminate debug intrinsics like
dbg.value and dbg.declare from LLVM, and replace them with DPValue objects
attached to instructions. ISel is one of the "terminals" where that
information needs to be converted into MIR format: this patch implements
support for that in GlobalISel. We aim for the output of LLVM to be
identical with/without RemoveDIs debug-info.

This patch should be NFC, as we're handling the same data about variables
stored in a different format -- it now appears in a DPValue object rather
than as an intrinsic. To that end, I've refactored the handling of
dbg.values into a dedicated function, and call it whenever a dbg.value or a
DPValue is encountered. dbg.declare is handled in a similar way.

Testing: adding the --try-experimental-debuginfo-iterators switch to llc
causes it to try and convert to the "new" debug-info format if it's built
in (LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS=On), and it'll be covered by our
buildbot. One test has a few extra wildcard-regexes added: this is because
there's some extra data printed about attached debug-info, which is safe to
ignore.
llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/AArch64/GlobalISel/combine-shift-of-shifted-dbg-value-fallback.ll
llvm/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll
llvm/test/CodeGen/AArch64/GlobalISel/debug-insts.ll
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-dilocation.ll
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-extract-used-by-dbg.ll
llvm/test/CodeGen/X86/GlobalISel/x86-calllowering-dbg-trunc.ll