[PATCH] [MachineLICM] Take regmasks into account for register pressure

Quentin Colombet qcolombet at apple.com
Mon Apr 13 13:43:38 PDT 2015


================
Comment at: lib/CodeGen/MachineLICM.cpp:865
@@ +864,3 @@
+  for (unsigned i = 0, e = Clobbers.size(); i != e; ++i) {
+    if (!Clobbers.test(i) || !TRI->isPhysicalRegister(i) ||
+        !TRI->isInAllocatableClass(i))
----------------
You may use BitVector::find_first and BitVector::find_next to avoid testing if i is in Clobbers.

================
Comment at: lib/CodeGen/MachineLICM.cpp:865
@@ +864,3 @@
+  for (unsigned i = 0, e = Clobbers.size(); i != e; ++i) {
+    if (!Clobbers.test(i) || !TRI->isPhysicalRegister(i) ||
+        !TRI->isInAllocatableClass(i))
----------------
qcolombet wrote:
> You may use BitVector::find_first and BitVector::find_next to avoid testing if i is in Clobbers.
You can assert i is a physical register.

================
Comment at: lib/CodeGen/MachineLICM.cpp:868
@@ +867,3 @@
+      continue;
+    if (MCSuperRegIterator(i, TRI).isValid())
+      continue;
----------------
I do not get why you need this test.

================
Comment at: test/CodeGen/Mips/prevent-hoisting.ll:27
@@ -26,1 +26,3 @@
+; CHECK-NEXT:      lw      ${{[0-9]+}}, %got(assignSE2partition)($[[R2]])
+; CHECK-NEXT:  {{BB[0-9_#]+}}: 
 ; CHECK-NEXT:      sll $1, $[[R0]], 4
----------------
I am not sure I get the diff here.
What happens exactly?

Looks like we do not hoist some stuff, which seems fine based on the comment on the test.

================
Comment at: test/CodeGen/X86/2008-10-27-CoalescerBug.ll:2
@@ -1,5 +1,3 @@
 ; REQUIRES: asserts
-; RUN: llc < %s -mtriple=i386-apple-darwin -mattr=+sse2 -stats 2>&1 | FileCheck %s
-; Now this test spills one register. But a reload in the loop is cheaper than
-; the divsd so it's a win.
+; RUN: llc < %s -mtriple=i386-apple-darwin -mattr=+sse2 -stats 2>&1 | not grep "Number of spills inserted"
 
----------------
Two things here:
1. Based on the comment of the original test, it seems spilling was better. Could you double check the diff.
2. Try to use FileCheck instead of grep.

http://reviews.llvm.org/D8998

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list