[PATCH] D68209: [LiveDebugValues] Introduce entry values of unmodified params

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 04:52:55 PDT 2019


djtodoro marked 5 inline comments as done.
djtodoro added a comment.

@vsk Thanks for the comments! Sure, I will try. :)

The idea from very high level, in this patch, is to generate entry values (when needed) for unmodified parameters (for parameters whose value has not changed throughout a function), by examining the code in at this stage of LLVM pipeline (we removed the front-end part due to performance regression). The main premise here is that the parameter’s value has changed if we encounter a new `DBG_VALUE` within a block describing the same parameter, and if so we stop tracking the entry value of such parameter. Nevertheless, there are many cases where (due to various optimizations) a parameter value is only moved (copied) around, from one register to another one. We should recognize such situation and keep tracking of entry value of such parameter, since the value actually has not changed. For that scenario, we use the `DbgEntryValueMovement` field to remember such movement and use it when creating the `VarLoc` for such entry value. This should handle multiple copies within a block.



================
Comment at: llvm/lib/CodeGen/LiveDebugValues.cpp:727
+  const MachineInstr *DebugEntryValue =
+      const_cast<MachineInstr *>(DebugEntryVals[Var].DbgEntryValue);
+  assert(DebugEntryValue->getOperand(0).isReg() &&
----------------
vsk wrote:
> Why is the const_cast needed?
I have use it for downstream code purposes, it was mistake keeping it here... Thanks!


================
Comment at: llvm/lib/CodeGen/LiveDebugValues.cpp:1122
+  if (!DestRegOp->isDef())
+    return;
+
----------------
vsk wrote:
> Why move the DestRegOp->isDef() check to after the `isCalleSavedReg` lambda definition?
Mistake.


================
Comment at: llvm/lib/CodeGen/LiveDebugValues.cpp:1152
+  if (isRegOtherThanSPAndFP(*DestRegOp, MI, TRI)) {
+    for (auto &EnltyValue : DebugEntryVals) {
+      if (isCopyOfTheEntryValue(EnltyValue.second)) {
----------------
vsk wrote:
> `auto &EntryValue`?
We change the `EntryValue `with the `setDbgEntryValueMovement()`.


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

https://reviews.llvm.org/D68209





More information about the llvm-commits mailing list