[PATCH] D86925: [MachineSink] add one more profitable pattern for sinking

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 12:18:28 PDT 2020


qcolombet requested changes to this revision.
qcolombet added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/CodeGen/MachineSink.cpp:608
+  int LiveRangeShortenCount = 0;
+  if (ML) {
+    for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
----------------
Could you invert the logic to early exit and reduce the indentation here?


================
Comment at: llvm/lib/CodeGen/MachineSink.cpp:616
+      // Don't handle physical register.
+      if (Reg == 0 || Register::isPhysicalRegister(Reg))
+        return false;
----------------
Reg == 0, should be fine. We should just skip them.


================
Comment at: llvm/lib/CodeGen/MachineSink.cpp:626
+          return false;
+        LiveRangeShortenCount++;
+      } else {
----------------
Instead of counting the number of live-ranges, we should probably count their weights with respect to the related register pressure set.

E.g., `<smallDef>, <smallDef> = op <BigUse>`

Maybe each smallDef accounts for 1 register whereas BigUse accounts for 4 registers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86925



More information about the llvm-commits mailing list