[PATCH] D106856: [LiveDebugValues] Cleanup Transfers when removing Entry Value Location

Nikola Tesic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 02:44:20 PDT 2021


ntesic marked an inline comment as done.
ntesic added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp:1296-1298
+  // Case of the parameter's DBG_VALUE at the start of MBB.
+  if (!TransferInst && !LastNonDbgMI)
+    return false;
----------------
jmorse wrote:
> What about loop heads like this:
> 
>     entry:
>       DBG_VALUE $rdi
> 
>     loop:
>       DBG_VALUE $rdi
>       $rdi = somedef
>       JMP loop
> 
> The second DBG_VALUE refers to a different value, due to the def of `rdi` in the loop. On the first examination of `loop`, there wouldn't be any reason to remove an entry value; presumably we can rely on the `join` method to erase the `EntryValueBackupKind` locations when the loop is visited for a second time?
Thanks for pointing this out! 
I think we should stop tracking Entry Value if we find DBG_VALUE describing new definition, without taking into consideration why is the DBG_VALUE there. From this point, I don't see a way to use Entry Value location only for the first examination of `loop`  and not for others, since it is the code at the same PC offset. 

My proposal is to preserve Entry Value only for the parameter DBG_VALUEs at the start of entry BB. At this point those, parameter DBG_VALUEs, are not propagated into other BBs, so we don't need to worry about other BBs.


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

https://reviews.llvm.org/D106856



More information about the llvm-commits mailing list