[PATCH] D32563: Add LiveRangeShrink pass to shrink live range within BB.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 12:22:00 PDT 2017


andreadb added inline comments.


================
Comment at: lib/CodeGen/LiveRangeShrink.cpp:94-95
+
+bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) {
+  MachineRegisterInfo &MRI = MF.getRegInfo();
+
----------------
You should early exit if this function must be skipped.

```
if (skipFunction(*MF.getFunction())
  return false;
```

We want to be able to 'opt-bisect' this pass.
Also, this pass shouldn't be run on optnone functions.


================
Comment at: lib/CodeGen/LiveRangeShrink.cpp:178
+        // Skip all the PHI instructions
+        while (I != MBB.end() && I->isPHI())
+          I = std::next(I);
----------------
I think that you should also skip debug vaue instructions.

The loop at line 192 works under the assumption that a MI's DBG_VALUE always follows directly after it. This is also suggested by your comment at line 189.

If you don't skip debug values, then you potentially break the above-mentioned assumption.


https://reviews.llvm.org/D32563





More information about the llvm-commits mailing list