[PATCH] D113208: [WebAssembly] Fix debug locations for ExplicitLocals pass (#2)
Wouter van Oortmerssen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 4 11:20:02 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.
This is a reworked version of the reverted patch: https://reviews.llvm.org/D112487
Note that
a) it doesn't need the test changes anymore, and
b) I checked at least locally it passes other.test_pthread_lsan_leak
https://reviews.llvm.org/D113208
Files:
llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
Index: llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
@@ -379,9 +379,14 @@
const TargetRegisterClass *RC = MRI.getRegClass(OldReg);
Register NewReg = MRI.createVirtualRegister(RC);
unsigned Opc = getLocalGetOpcode(RC);
- InsertPt =
- BuildMI(MBB, InsertPt, MI.getDebugLoc(), TII->get(Opc), NewReg)
- .addImm(LocalId);
+ // Use a InsertPt as our DebugLoc, since MI may be discontinuous from
+ // the where this local is being inserted, causing non-linear stepping
+ // in the debugger or function entry points where variables aren't live
+ // yet. Alternative is previous instruction, but that is strictly worse
+ // since it can point at the previous statement.
+ // See crbug.com/1251909, crbug.com/1249745
+ InsertPt = BuildMI(MBB, InsertPt, InsertPt->getDebugLoc(),
+ TII->get(Opc), NewReg).addImm(LocalId);
MO.setReg(NewReg);
MFI.stackifyVReg(MRI, NewReg);
Changed = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113208.384820.patch
Type: text/x-patch
Size: 1242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/7dab2647/attachment.bin>
More information about the llvm-commits
mailing list