[PATCH] D48994: [WebAssembly] Update DBG_VALUE register operand during WebAssemblyOptimizeLiveIntervals pass

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 11:12:38 PDT 2018


MatzeB added a comment.

Makes sense, thanks for the patch.

Some comments:

- Remove "WebAssembly" from the title as this should affect other targets too.



================
Comment at: lib/CodeGen/LiveInterval.cpp:1318-1327
+    bool ValueIn;
+    if (MI->isDebugValue()) {
       Idx = LIS.getSlotIndexes()->getIndexBefore(*MI);
-    else
+      ValueIn = false;
+    } else {
       Idx = LIS.getInstructionIndex(*MI);
+      ValueIn = MO.readsReg();
----------------
- This should probably use `valueOut()` instead of `valueDefined()`.
- Could you change the code to this instead to make the debug value special case more obvious:
```
const VNInfo *VNI;
if (MI->isDebugValue()) {
  // DBG_VALUE instructions don't have slot indexes, so get the index of the
  // instruction before them. The value is defined there too.
  SlotIndex Idx = LIS.getSlotIndexes()->getIndexBefore(*MI);
  VNI = LI.Query(Idx).valueOut();
} else {
  SlitIndex Idx = LIS.getInstructionIndex(*MI);
  LiveQueryResult LRQ = LI.Query(Idx);
  VNI = ValueIn ? LRQ.valueIn() : LRQ.valueDefined();
}
```


Repository:
  rL LLVM

https://reviews.llvm.org/D48994





More information about the llvm-commits mailing list