This is an archive of the discontinued LLVM Phabricator instance.

[MachineLICM] Take regmasks into account for register pressure
Needs ReviewPublic

Authored by djasper on Apr 13 2015, 3:48 AM.

Details

Reviewers
qcolombet
Summary

This depends on http://reviews.llvm.org/D8986.

As far as I can tell, the changes in the tests make sense.

Diff Detail

Event Timeline

djasper updated this revision to Diff 23668.Apr 13 2015, 3:48 AM
djasper retitled this revision from to [MachineLICM] Take regmasks into account for register pressure.
djasper updated this object.
djasper edited the test plan for this revision. (Show Details)
djasper added a reviewer: qcolombet.
djasper added a subscriber: Unknown Object (MLST).
qcolombet added inline comments.Apr 13 2015, 1:43 PM
lib/CodeGen/MachineLICM.cpp
865

You may use BitVector::find_first and BitVector::find_next to avoid testing if i is in Clobbers.

865

You can assert i is a physical register.

868

I do not get why you need this test.

test/CodeGen/Mips/prevent-hoisting.ll
27

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.

test/CodeGen/X86/2008-10-27-CoalescerBug.ll
2

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.
djasper added inline comments.Apr 13 2015, 4:08 PM
lib/CodeGen/MachineLICM.cpp
868

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

test/CodeGen/Mips/prevent-hoisting.ll
27

The difference is this:

The new version is:

  1. 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.

test/CodeGen/X86/2008-10-27-CoalescerBug.ll
2

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.

qcolombet added inline comments.Apr 13 2015, 4:24 PM
lib/CodeGen/MachineLICM.cpp
868

Ah, that makes sense.
Add a comment to explain that.

test/CodeGen/Mips/prevent-hoisting.ll
27

Does this save us some spill?

Otherwise, it does not sound like an improvement :).

test/CodeGen/X86/2008-10-27-CoalescerBug.ll
2

Interesting.
That's fine then.