[PATCH] D68082: [LV] Emitting SCEV checks with OptForSize

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 14:45:12 PDT 2019


Ayal added a comment.

> At this point, PSE.getUnionPredicate().getPredicates() returns 0

Can you track where/when the predicate is generated and added to PSE?

The original bailout in `LoopVectorizationLegality::canVectorize()` checking `if (PSE.getUnionPredicate().getComplexity() > SCEVThreshold)` could potentially be extended - essentially zeroing SCEVThreshold for hasOptSize, but this takes place *earlier* than runtimeChecksRequired() which is claimed to be too early, contrary to the following claim:

  // Okay! We've done all the tests. If any have failed, return false. Otherwise
  // we can vectorize, and at this point we don't have any other mem analysis
  // which may limit our maximum vectorization factor, so just return true with
  // no restrictions.

The latest bailout is probably `LoopVectorizationCostModel::selectVectorizationFactor()`, but it's better to bailout earlier.

BTW, a related opportunity is `// FIXME: Avoid specializing for stride==1 instead of bailing out.`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68082/new/

https://reviews.llvm.org/D68082





More information about the llvm-commits mailing list