[llvm-dev] [RFC] Removing debug locations from ConstantSDNodes

via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 19 19:20:09 PDT 2018


Our users really wanted the line table entry for line 2 to include the constant materialization code for some VS debugger feature.

Same here.  I have serious doubts that the fastisel tactic of bubbling constants up to the top of the block really helps code size or performance that much, and it distinctly hurts the debugging experience.  It's reordering code at –O0 and that is generally a Bad Thing™.
--paulr

From: Reid Kleckner [mailto:rnk at google.com]
Sent: Tuesday, June 19, 2018 9:37 PM
To: Vedant Kumar; Robinson, Paul
Cc: llvm-dev; Justin Bogner; David Li; David Blaikie
Subject: Re: [RFC] Removing debug locations from ConstantSDNodes

On Tue, Jun 19, 2018 at 5:46 PM Vedant Kumar <vsk at apple.com<mailto:vsk at apple.com>> wrote:
Someone (Reid?) mentioned that we could try sinking constants to their point of first use as an alternative, and (IIUC) create new nodes with distinct DebugLocs for each use of a constant. I don't recall the details of that alternative clearly. Based on my (likely incorrect) understanding of it, dropping locations from constants outright might be simpler.

Our use case was in fastisel, so things are different. I don't think my solution will help you.

In our case, users were complaining about code like this:
volatile int do_something;
void f() {
  ++do_something;
  foo(1, 2, 3);
  ++do_something;
}

We'd generate locations like:
  .loc line 1
  incl do_something(%rip)
  movl $1, %ecx
  movl $2, %edx
  movl $3, %r8d
  .loc line 2 # line 2 starts here, instead of 3 instructions earlier
  callq foo
  .loc line 3
  incl do_something(%rip)

Our users really wanted the line table entry for line 2 to include the constant materialization code for some VS debugger feature.

I think if you remove locations from ConstantSDNodes, you might want to add a late pass that propagates source locations backwards onto location-less instructions. This would also avoid some special cases when a basic block starts with an instruction that lacks location information. See CodeViewDebug::beginInstruction and DwarfDebug::beginInstruction for what we do today.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180620/85e0dcb0/attachment-0001.html>


More information about the llvm-dev mailing list