This is an archive of the discontinued LLVM Phabricator instance.

[LoopDist] Port to new PM
ClosedPublic

Authored by anemet on Jul 15 2016, 10:07 PM.

Details

Summary

The direct motivation for the port is to ensure that the OptRemarkEmitter
tests work with the new PM.

This remains a function pass because we not only create multiple loops
but could also version the original loop.

In the test I need to invoke opt
with -passes='require<aa>,loop-distribute'. LoopDistribute does not
directly depend on AA however LAA does. LAA uses getCachedResult so
I *think* we need manually pull in 'aa'.

Diff Detail

Repository
rL LLVM

Event Timeline

anemet updated this revision to Diff 64226.Jul 15 2016, 10:07 PM
anemet retitled this revision from to [LoopDist] Port to new PM.
anemet updated this object.
anemet added reviewers: davidxl, silvas.
anemet added a subscriber: llvm-commits.
silvas accepted this revision.Jul 16 2016, 3:39 PM
silvas edited edge metadata.

One small comment but this LGTM.

lib/Transforms/Scalar/LoopDistribute.cpp
962 ↗(On Diff #64226)

Usually we have been factoring out a "runImpl" to be shared by the old PM and the new PM. Is that doable here to avoid some of the duplication?

This revision is now accepted and ready to land.Jul 16 2016, 3:39 PM
anemet added inline comments.Jul 16 2016, 7:07 PM
lib/Transforms/Scalar/LoopDistribute.cpp
962 ↗(On Diff #64226)

Yeah, I saw that in the LoopVectorizer and it should be doable. I decided against it because there is only a little duplication since ultimately they both delegate to the LoopDistributeForLoop class. And when the old PM code goes away the runImpl thing would feel awkward.

But I am happy to make the change if you feel strongly about it. And thanks for the reviews!

silvas added inline comments.Jul 16 2016, 7:48 PM
lib/Transforms/Scalar/LoopDistribute.cpp
962 ↗(On Diff #64226)

Generally I would prefer for the old and new PM to share as much code as possible to avoid (by design) any divergence. It's not clear how long until the old code gets deleted.

This revision was automatically updated to reflect the committed changes.
anemet marked an inline comment as done.Jul 18 2016, 9:40 AM
anemet added inline comments.
lib/Transforms/Scalar/LoopDistribute.cpp
962 ↗(On Diff #64226)

Sounds good. I've made the change before committing.