This is an archive of the discontinued LLVM Phabricator instance.

[LoopReroll] Refactor most of reroll() into a helper class
ClosedPublic

Authored by jmolloy on Jan 27 2015, 7:18 AM.

Details

Reviewers
hfinkel
Summary

reroll() was slightly monolithic and a pain to modify. Refactor a bunch of its state from local variables to member variables of a helper class, and do some trivial simplification while we're there.

This should set the scene for some changes to the Scale/Root model to make it catch more cases.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 18815.Jan 27 2015, 7:18 AM
jmolloy retitled this revision from to [LoopReroll] Refactor most of reroll() into a helper class.
jmolloy updated this object.
jmolloy edited the test plan for this revision. (Show Details)
jmolloy added a reviewer: hfinkel.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: Unknown Object (MLST).
aadg added a subscriber: aadg.Jan 27 2015, 7:23 AM
hfinkel accepted this revision.Jan 27 2015, 9:31 AM
hfinkel edited edge metadata.

With modifications suggested below, LGTM. Thanks!

lib/Transforms/Scalar/LoopRerollPass.cpp
143

I'd prefer that we not do this just for access to the analysis variables. Just pass what is needed to the child class's constructor.

698

IIRC, the current version deals with duplicated. I'm not sure this is necessary (one could certainly argue that CSE should take care of anything interesting). Please explain why, however, you're ignoring duplicates in this comment.

This revision is now accepted and ready to land.Jan 27 2015, 9:31 AM

Hi Hal,

Thanks!

Comments inline.

James

lib/Transforms/Scalar/LoopRerollPass.cpp
143

Sure, I'll make that change.

698

That is true. The main reason is simplification of the code: I'm going to be expanding the model to deal with the case with multiple root sets: consider:

a[i*2+0] = ...; // one root set
a[i*2+1] = ...;
a[i*2+4] = ...; // next root set
a[i*2+5] = ...;
a[(i+45)*2+0] = ...; // and another root set
a[(i+45)*2+1] = ...;

And if one root set can have duplicate indices, it adds another level of indirection I need to look through.

It's doable, but as you say it should be unlikely to be needed given a trivial CSE.

jmolloy closed this revision.Jan 29 2015, 5:49 AM

r227439.