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

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 11:48:13 PDT 2016


MatzeB marked 3 inline comments as done.
MatzeB added a comment.

Thanks for the review!


================
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);
   }
----------------
ab wrote:
> Would it make sense to iterate on the LivePhysRegs set instead?
good idea.

================
Comment at: lib/CodeGen/BranchFolding.h:106
@@ -104,3 +105,3 @@
     MachineLoopInfo *MLI;
-    RegScavenger *RS;
+    LivePhysRegs LiveRegs;
 
----------------
ab wrote:
> Maybe remove LiveRegs from here, and only create it in computeLiveIns?  It's cleared anyway, and looks cheap to construct.
It is still a bigger heap allocation for the Sparse memory of the SparseSet. Heap allocations are not completely free. We probably won't notice the difference in this case, but keeping a member in the enclosing pass isn't a big thing either.

I did however move the initialization into the computeLiveIn() function as I realized that there is a good chance that for simpler function we will never end up calling it.


Repository:
  rL LLVM

http://reviews.llvm.org/D22027





More information about the llvm-commits mailing list