[PATCH] D112487: [WebAssembly] Fix debug locations for ExplicitLocals pass

Wouter van Oortmerssen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 14:02:05 PDT 2021


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

https://reviews.llvm.org/D112487

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
  llvm/test/MC/WebAssembly/debug-localvar.ll


Index: llvm/test/MC/WebAssembly/debug-localvar.ll
===================================================================
--- llvm/test/MC/WebAssembly/debug-localvar.ll
+++ llvm/test/MC/WebAssembly/debug-localvar.ll
@@ -101,8 +101,8 @@
 ; CHECK-NEXT:                  DW_AT_type	(0x00000073 "int")
 
 ; CHECK-LABEL:     DW_TAG_lexical_block
-; CHECK-NEXT:                  DW_AT_low_pc	(0x0000001c)
-; CHECK-NEXT:                  DW_AT_high_pc	(0x0000002d)
+; CHECK-NEXT:                  DW_AT_low_pc	(0x0000001e)
+; CHECK-NEXT:                  DW_AT_high_pc	(0x0000002f)
 
 ; CHECK-LABEL:       DW_TAG_variable
 ; CHECK-NEXT:                    DW_AT_location	(DW_OP_fbreg +4)
Index: llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
@@ -379,8 +379,13 @@
         const TargetRegisterClass *RC = MRI.getRegClass(OldReg);
         Register NewReg = MRI.createVirtualRegister(RC);
         unsigned Opc = getLocalGetOpcode(RC);
+        // Use a blank DebugLoc, because InsertPt may be discontinuous from
+        // the usage of this value, causing non-linear stepping in the
+        // debugger or function entry points where variables aren't live yet.
+        // See crbug.com/1251909, crbug.com/1249745
+        DebugLoc DL;
         InsertPt =
-            BuildMI(MBB, InsertPt, MI.getDebugLoc(), TII->get(Opc), NewReg)
+            BuildMI(MBB, InsertPt, DL, TII->get(Opc), NewReg)
                 .addImm(LocalId);
         MO.setReg(NewReg);
         MFI.stackifyVReg(MRI, NewReg);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112487.382115.patch
Type: text/x-patch
Size: 1692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211025/c4b5b2df/attachment.bin>


More information about the llvm-commits mailing list