[PATCH] D22027: BranchFolding: Use LivePhysReg to update live in lists.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 09:23:33 PDT 2016


ab added inline comments.

================
Comment at: lib/CodeGen/BranchFolding.cpp:412
@@ +411,3 @@
+  LiveRegs.addLiveOutsNoPristines(MBB);
+  for (MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend())) {
+    LiveRegs.stepBackward(MI);
----------------
Unnecessary braces?

================
Comment at: lib/CodeGen/BranchFolding.cpp:415-428
@@ -418,1 +414,16 @@
+  }
+  for (unsigned I = 1, E = TRI->getNumRegs(); I != E; ++I) {
+    if (!LiveRegs.contains(I))
+      continue;
+    // Skip the register if we are about to add one of its super registers.
+    bool ContainsSuperReg = false;
+    for (MCSuperRegIterator SReg(I, TRI, false); SReg.isValid(); ++SReg) {
+      if (LiveRegs.contains(*SReg)) {
+        ContainsSuperReg = true;
+        break;
+      }
+    }
+    if (ContainsSuperReg)
+      continue;
+    MBB.addLiveIn(I);
   }
----------------
Would it make sense to iterate on the LivePhysRegs set instead?

================
Comment at: lib/CodeGen/BranchFolding.h:106
@@ -104,3 +105,3 @@
     MachineLoopInfo *MLI;
-    RegScavenger *RS;
+    LivePhysRegs LiveRegs;
 
----------------
Maybe remove LiveRegs from here, and only create it in computeLiveIns?  It's cleared anyway, and looks cheap to construct.


Repository:
  rL LLVM

http://reviews.llvm.org/D22027





More information about the llvm-commits mailing list