This is an archive of the discontinued LLVM Phabricator instance.

[MachineScheduler / CalcSpillWeights] Try to utilize foldable operands better.
ClosedPublic

Authored by jonpa on Feb 8 2016, 2:18 AM.

Details

Reviewers
atrick
Summary

This patch was needed to get some tests to pass while working on mischeduling for SystemZ.
On a benchmark suite, this patch also increased "folded stack accesses" from 14528 to 14736.

I am curious to hear what other think about this as I am not myself sure this is necessarily the best
way of achieving these results. To get the regression tests to pass, the heuristic had to be placed
3rd last in the list of the heuristics. However, it may well be that nearly same general results would
could be had if placing it lower down...

  • If an instrution has an equivalent instruction that instead of reading a register, reads a memory location, it would be better to spill that register since the reload of it can then be folded.

    This patch tries to improve MachineScheduler and CalcSpillWeigths in this direction, by using a new TargetInstrInfo virtual method hasFoldableOperand().

    SystemZ has already a map for such instructions (getMemOpcode()), which is used to implement this method.

Diff Detail

Event Timeline

jonpa updated this revision to Diff 47168.Feb 8 2016, 2:18 AM
jonpa retitled this revision from to [MachineScheduler / CalcSpillWeights] Try to utilize foldable operands better..
jonpa updated this object.
jonpa added a subscriber: llvm-commits.
atrick accepted this revision.Feb 13 2016, 9:27 PM
atrick edited edge metadata.

I have some reservations about adding features to the generic scheduler that are too target specific (since it's easy for targets to provide a custom scheduling strategy). But this seems like a reasonable enough hook to add.

This revision is now accepted and ready to land.Feb 13 2016, 9:27 PM
jonpa closed this revision.Feb 16 2016, 7:56 AM

Since no target other than SystemZ is using this at the moment, I will simply let these changes go in with the main SystemZ scheduler patch (http://reviews.llvm.org/D17260).