[PATCH] D102999: [WebAssembly] Add NullifyDebugValueLists pass

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 23 20:31:24 PDT 2021


aheejin created this revision.
aheejin added reviewers: dschuff, jmorse, aardappel, yurydelendik.
Herald added subscribers: wingo, ecnelises, sunfish, hiraditya, jgravelle-google, sbc100, mgorny.
aheejin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`WebAssemblyDebugValueManager` does not currently handle
`DBG_VALUE_LIST`, which is a recent addition to LLVM. We tried to
nullify them within the constructor of `WebAssemblyDebugValueManager` in
D102589 <https://reviews.llvm.org/D102589>, but it made the class error-prone to use because it deletes
instructions within the constructor and thus invalidates existing
iterators within the BB, so the user of the class should take special
care not to use invalidated iterators. This actually caused a bug in
ExplicitLocals pass.

Instead of trying to fix ExplicitLocals pass to make the iterator usage
correct, which is possible but error-prone, this adds
NullifyDebugValueLists pass that nullifies all `DBG_VALUE_LIST`
instructions before we run WebAssembly specific passes in the backend.
We can remove this pass after we implement handlers for
`DBG_VALUE_LIST`s in `WebAssemblyDebugValueManager` and elsewhere.

Fixes https://github.com/emscripten-core/emscripten/issues/14255.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102999

Files:
  llvm/lib/Target/WebAssembly/CMakeLists.txt
  llvm/lib/Target/WebAssembly/WebAssembly.h
  llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyNullifyDebugValueLists.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/reg-stackify-dbg.mir
  llvm/test/DebugInfo/WebAssembly/dbg-value-list.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102999.347300.patch
Type: text/x-patch
Size: 13442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210524/45905bbd/attachment.bin>


More information about the llvm-commits mailing list