[PATCH] D35227: [LV] Don't allow outside uses of IVs if the SCEV is predicated on loop conditions
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 27 01:00:51 PDT 2017
Ayal added a comment.
Instead of refraining to vectorize a loop which has an externally used phi (or rather the bump thereof) and any predicate, can a predicate be added (or an existing one be extended) to also cover the last iteration? Pity to bail out on such corner cases.
================
Comment at: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp:5321
+ // currently means re-using this SCEV outside the loop.
+ if (PSE.getUnionPredicate().isAlwaysTrue()) {
+ AllowedExit.insert(Phi);
----------------
mkuper wrote:
> gilr wrote:
> > Can we narrow the check as documented above to only check if the phi's SCEV relies on predicates?
> I don't think so - IIUC, once we've added the predicate to PSCEV, all further SCEV expressions we get from it can rely the same predicate, and I'm not sure there's a way to query whether a specific one did.
Yeah; we could try to note if addInductionPhi() is being called from the first attempt to recognize isInductionPHI() which adds no new predicates, or otherwise from the second attempt which does. But in both cases isInductionPHI() calls PSE.getSCEV(Phi) which may use existing predicates. Probably needs restructuring to first check the result of SE.getSCEV(Phi).
Best clarify the documentation above to match the code.
Repository:
rL LLVM
https://reviews.llvm.org/D35227
More information about the llvm-commits
mailing list