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

Daniel Jasper djasper at google.com
Mon Apr 13 16:08:10 PDT 2015


================
Comment at: lib/CodeGen/MachineLICM.cpp:868
@@ +867,3 @@
+      continue;
+    if (MCSuperRegIterator(i, TRI).isValid())
+      continue;
----------------
qcolombet wrote:
> I do not get why you need this test.
So, from what I understand (from the observed behavior is that the regmask will contain super-registers together with all their subregisters, because in fact all of them are clobbered. However, both the super register and it's subregisters count towards the same register pressure sets and thus looking at any sub-register at all makes us over-estimate the pressure in certain register sets. This checks restricts us to only take register with have no super-register into account

================
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
----------------
qcolombet wrote:
> 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.
The difference is this:

The new version is:

  # BB#5:
    lw	$22, %got(assignSE2partition)($2)
  $BB0_6:                                 # =>This Inner Loop Header: Depth=1
    sll	$1, $17, 4
    sll	$2, $17, 6
    addu	$1, $2, $1
    addu	$1, $22, $1

So, sll and addu remain in the inner loop body ($BB0_6). Without this patch, the get hoisted to BB#5.

================
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"
 
----------------
qcolombet wrote:
> 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.
So, this basically reverts the test to where it was before r116845. That patch introduced the behavior but (if the comment is right) for the wrong reason. If the instruction is cheaper than a spill reload, that should actually be handled through a different code path.

http://reviews.llvm.org/D8998

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






More information about the llvm-commits mailing list