This is an archive of the discontinued LLVM Phabricator instance.

[Pipeliner] copyToPhi DAG Mutation to improve scheduling.
ClosedPublic

Authored by sgundapa on Oct 15 2018, 3:50 PM.

Details

Summary

In a loop, create artificial dependences between the source of a
COPY/REG_SEQUENCE to the use in next iteration.

Eg:
SRC ----Data Dep--> COPY
COPY ---Anti Dep--> PHI (implies, to be used in next iteration)
PHI ----Data Dep--> USE

This patches creates
USE ----Artificial Dep---> SRC

This will effectively schedule the COPY late to eliminate additional copies.
Before this patch, the schedule can be
SRC, COPY, USE : The COPY is used in next iteration and it needs to be
preserved.

After this patch, the schedule can be
USE, SRC, COPY : The COPY is used in next iteration and the live interval is
reduced.

Diff Detail

Event Timeline

sgundapa created this revision.Oct 15 2018, 3:50 PM
sgundapa updated this revision to Diff 169765.Oct 15 2018, 3:52 PM
bcahoon accepted this revision.Oct 18 2018, 6:58 AM

Just a minor question - looks good otherwise.

lib/CodeGen/MachinePipeliner.cpp
105

Is this needed?

This revision is now accepted and ready to land.Oct 18 2018, 6:58 AM
sgundapa added inline comments.Oct 18 2018, 8:49 AM
lib/CodeGen/MachinePipeliner.cpp
105

This is need for the "cast<X>()" call.

This revision was automatically updated to reflect the committed changes.
bcahoon added inline comments.Oct 18 2018, 10:46 AM
lib/CodeGen/MachinePipeliner.cpp
105

I think it's included already, and the patch will compile without it.

You are correct. I have pushed https://reviews.llvm.org/D53451 to rectify.