This is an archive of the discontinued LLVM Phabricator instance.

[LoopVectorize] Extract InductionInfo into a helper class
ClosedPublic

Authored by jmolloy on Aug 24 2015, 8:58 AM.

Details

Summary

... and move it into LoopUtils where it can be used by other passes, just like ReductionDescriptor.

NFC

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 32962.Aug 24 2015, 8:58 AM
jmolloy retitled this revision from to [LoopVectorize] Extract InductionInfo into a helper class.
jmolloy updated this object.
jmolloy added reviewers: anemet, mzolotukhin.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: llvm-commits.
anemet accepted this revision.Aug 25 2015, 3:58 PM
anemet edited edge metadata.

LGTM, a few things for you to consider:

include/llvm/Transforms/Utils/LoopUtils.h
211–213

Move this to the other private members? Also s/use/used by/

215

That's a pretty strange comment. It's made public so that isInductionPHI can do the actual initialization.

I actually don't think that's a very nice interface. If you want something like a factory method to create InductionDescriptors then I would name it something like createFromPHI. Then have an isInduction() member to check that the descriptor is an induction variable (!IK_NoInduction).

lib/Transforms/Utils/LoopUtils.cpp
520–521

I agree that this is the same loop whose header the phi is located in but I think it would be good to assert that.

This revision is now accepted and ready to land.Aug 25 2015, 3:58 PM

Also please upload patches with full context.

I've committed this with changes suggested by Adam in r246145.

Also please upload patches with full context.

Ach, sorry!

James

include/llvm/Transforms/Utils/LoopUtils.h
215

I fully agree - this interface is terrible. The reason I did it like this was twofold:

  1. Reduce code churn in one commit
  2. It matches the equally horrible isReductionPHI API.

I fully intend to go on a redesign here and make a much better API. It's just a nicer starting point if the induction code is already hoisted into Utils.

jmolloy closed this revision.Aug 30 2015, 3:01 AM