[PATCH] D138943: [WebAssembly] Enable LiveDebugValues analysis

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 12:40:59 PST 2022


aheejin created this revision.
aheejin added a reviewer: dschuff.
Herald added subscribers: pmatos, asb, wingo, ecnelises, sunfish, hiraditya, jgravelle-google, sbc100.
Herald added a project: All.
aheejin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This enables `LiveDebugValues` analysis for Wasm. `DBG_VALUE`s expire at
the end of a BB, and this is the analysis extends their lifetime when
possible, greatly increasing the coverage of variable debug info.

Specifically, this removes the current constraint that this analysis is
only used with physical registers, which was first introduced in D18421 <https://reviews.llvm.org/D18421>,
because Wasm uses only virtual registers. I don't think there's anything
inherent in this analysis that only applies to physical registers; it
was just because all targets using this analysis ran this at the end of
their compiliation pipeline, at which point all their vregs had been
allocated, and Wasm's debug info infrastructure was not really set up
yet, so it was not using it.

This adds supports to Wasm-specific target-index operands, defined in
https://github.com/llvm/llvm-project/blob/2166d9529a60d1cdedb733d2e4134c971f0969ec/llvm/lib/Target/WebAssembly/WebAssembly.h#L87-L100.
Among these, `TI_LOCAL`, `TI_LOCAL_INDIRECT`, and `TI_OPERAND_STACK` are
used by Wasm `DBG_VALUE` instructions.

Before D138455 <https://reviews.llvm.org/D138455> that disabled `RegisterCoalescer` at -O1, the Emscripten
benchmarks' average PC covered for variables when compiling at -O1 was
only around 18.3%. Enabling this `liveDebugValues` analysis and
disabling `RegisterCoalescer` brings the coverage up to 66%. More
specifically:
(What we are trying to do do is _disabling_ `RegisterCoalescer` and
_enabling_ `LiveDebugValues`)

- `RegisterCoalescer` enabled / `LiveDebugValues` disabled: 18.3% (baseline before D138455 <https://reviews.llvm.org/D138455>)
- `RegisterCoalescer` disabled / `LiveDebugValues` disabled: 19.5%
- `RegisterCoalescer` enabled / `LiveDebugValues` enabled: 52.4%
- `RegisterCoalescer` disabled / `LiveDebugValues` enabled: 66.0%


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138943

Files:
  llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
  llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/DebugInfo/WebAssembly/live-debug-values.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138943.478685.patch
Type: text/x-patch
Size: 17083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221129/36660f62/attachment-0001.bin>


More information about the llvm-commits mailing list