[llvm] [WebAssembly] Enable a limited amount of stackification for debug code (PR #136510)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 04:24:00 PDT 2025


================
@@ -0,0 +1,89 @@
+; RUN: llc < %s -O0 --filetype=obj -o - | llvm-dwarfdump - | FileCheck %s --check-prefixes DBG_USE
+
+target triple = "wasm32-unknown-unknown"
+
+declare i32 @extern_func(i32, i32)
+
+; We want to produce local DW_OP_WASM_locations in debug code instead
+; of operand stack locations since local locations are more widely
+; supported and can cover the entirety of the method.
+; DBG_USE: DW_TAG_subprogram
+; DBG_USE:   DW_AT_name ("single_non_dbg_use")
+; DBG_USE:   DW_TAG_variable
+; DBG_USE:     DW_AT_location
+; DBG_USE:       DW_OP_WASM_location 0x0
+; DBG_USE:     DW_AT_name    ("call_value")
+; DBG_USE:   DW_TAG_variable
+; DBG_USE:     DW_AT_location
+; DBG_USE:       DW_OP_WASM_location 0x0
+; DBG_USE:     DW_AT_name    ("sub_value")
----------------
SingleAccretion wrote:

> this test (and the tests below as well) passes even without this PR

Yes, and this is expected. It is not a "regression" test in that sense.

The purpose of the test is to exercise some of the new code (particularly in `hasSingleUse`). Put another way, this test would fail with a version of this change that didn't include the (required) protections for unused values and such.

https://github.com/llvm/llvm-project/pull/136510


More information about the llvm-commits mailing list