[PATCH] D146859: RegAllocGreedy: Fix detection of lanes read by a bundle

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 02:20:31 PDT 2023


qcolombet added inline comments.


================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:1265
+  SmallVector<std::pair<MachineInstr *, unsigned>, 8> Ops;
+  (void)AnalyzeVirtRegInBundle(const_cast<MachineInstr &>(FirstMI), Reg, &Ops);
 
----------------
Out-of-curiosity why does `AnalyzeVirtRegInBundle` requires non-const instructions?


================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:1271
     unsigned SubReg = MO.getSubReg();
-    if (SubReg == 0 && MO.isUse()) {
-      Mask |= MRI.getMaxLaneMaskForVReg(Reg);
-      continue;
-    }
+    if (SubReg == 0 && MO.isUse() && !MO.isUndef())
+      return MRI.getMaxLaneMaskForVReg(Reg);
----------------
Given the added `isUndef` here, I think we want to continue for `isUndef` after (or before) that if.
I.e., I think we want to skip line `1279`.


================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:1307
   // this doesn't help.
-  return (ReadMask & ~(LiveAtMask & TRI->getCoveringLanes())).any();
+  return (LiveAtMask & ReadMask) != LiveAtMask;
 }
----------------
I believe the previous version was correct.


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

https://reviews.llvm.org/D146859



More information about the llvm-commits mailing list