[llvm] [llvm][CodeGen] Update checking method of loop-carried phi in window scheduler (PR #96288)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 02:25:38 PDT 2024


================
@@ -192,22 +192,36 @@ bool WindowScheduler::initialize() {
     return false;
   }
   // Check each MI in MBB.
-  SmallVector<Register, 8> PhiDefs;
+  SmallSet<Register, 8> PrevDefs;
+  SmallSet<Register, 8> PrevUses;
+  auto IsLoopCarried = [&](MachineInstr &Phi) {
+    // Two cases are checked here: (1)The virtual register defined by the
+    // preceding phi is used by the succeeding phi;(2)The preceding phi uses the
+    // virtual register defined by the succeeding phi.
+    for (auto MO : Phi.operands()) {
+      if (!MO.isReg())
+        continue;
+      if (MO.isDef()) {
----------------
arsenm wrote:

You know the structure of phi so you can increment by 2 and check the single def separately 

https://github.com/llvm/llvm-project/pull/96288


More information about the llvm-commits mailing list