[PATCH] D88406: [LiveDebugValues][InstrRef][2/2] Emit entry value variable locations

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 08:14:03 PDT 2020


jmorse marked 3 inline comments as done.
jmorse added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:3116
+      // transfers after them.
+      if (P.Pos->isTerminator())
+        continue;
----------------
djtodoro wrote:
> Should this be a separate patch? Does this affect/apply to the "copies" as backups?
Shouldn't affect variable locations; I'll split it into a separate patch though and have a dedicated test case. The quick summary is that on X86 tailcalls are written:

    TAILCALL @foo, implicit $rdi, $implicit-def $rax

Or similar, and are the last instruction in the block. InstrRefBasedLDV sees the implicit-def of $rax, and tries to recover variable locations afterwards, that leads to DBG_VALUEs being inserted after the terminator; which the MachineVerifier complains about.

There may be some exotic architectures out there that can have multiple terminators in their block, and def registers on the first terminator, which would be tricker to handle. But I think that bridge can be crossed when we come to it.


================
Comment at: llvm/test/DebugInfo/MIR/X86/livedebugvalues_load_in_loop.mir:83
     $rbp = MOV64rr $rdi, debug-location !17
+    DBG_VALUE $rbp, $noreg, !16, !DIExpression(), debug-location !17
     dead $rcx = MOV64ri 0, debug-location !17
----------------
djtodoro wrote:
> Why including this here?
/me squints; I think I moved this because otherwise the the output looks like this:

    DBG_VALUE $rdi
    $rbp = MOV64rr $rdi
    $rcx = MOV64ri 0
    CALL64pcrel32 @bees
    DBG_VALUE $rbp

i.e., the location is recovered to $rbp after the call clobbers $rdi. Wheras with this change, LiveDebugValues does not have to recover any clobbers.

My thinking was that, because this test is targeted at one thing VarLocBasedLDV does poorly, it's best to reduce the number of features being tested in the test, so that clobber being recovered from should be avoided.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88406/new/

https://reviews.llvm.org/D88406



More information about the llvm-commits mailing list