[PATCH] D41226: [LiveDebugValues] recognize spilled register that is killed in instruction after the spill

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 03:27:22 PDT 2021


jmorse added inline comments.
Herald added a subscriber: ormris.


================
Comment at: llvm/trunk/lib/CodeGen/LiveDebugValues.cpp:429
 
-  // In a spill instruction generated by the InlineSpiller the spilled register
-  // has its kill flag set. Return false if we don't find such a register.
-  Reg = 0;
+  auto isKilledReg = [&](const MachineOperand MO, unsigned &Reg) {
+    if (!MO.isReg() || !MO.isUse()) {
----------------
dongAxis1944 wrote:
> @wolfgangp  hello, I have a question about that why the register of MI must be marked, "killed"?
> 
> Considering the following case:
> ```
> MOV32mr $rsp, 1, $noreg, 8, $noreg, $r9d :: (store 4 into %stack.3)
> ...
> DBG_VALUE $rsp, 0, !"fuck", !DIExpression(DW_OP_plus_uconst, 8), debug-location !960; llvm-project/build_release/bin/test.cpp:0 line no:14 indirect
> ...
> MOVSDmr $rsp, 1, $noreg, 8, $noreg, killed renamable $xmm0 :: (store 8 into %stack.3)
> ```
> Because the r9d is not marked kill, the LLVM will not know  the value of r9d is on %stack.3.
> 
> Any ideas?
> 
Note Bjorns comment at https://reviews.llvm.org/D41226#969343 asking something similar -- this code is mostly a heuristic to catch a common case, where a variable is spilt then restored over a function call for example. It's not guaranteed to catch everything, and we would end up having to follow multiple locations per variable if we did.

(Shameless plug: my LiveDebugValues rewrite should get this right, see https://lists.llvm.org/pipermail/llvm-dev/2020-June/142368.html . I've paused landing it for a bit, but will continue shortly).


Repository:
  rL LLVM

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

https://reviews.llvm.org/D41226



More information about the llvm-commits mailing list