[PATCH] D101916: [LoopVectorize] Fix crash for predicated instructions with scalable VF
Caroline via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 18 01:31:48 PDT 2021
CarolineConcatto marked 3 inline comments as done.
CarolineConcatto added a comment.
Thank you @david-arm and @sdesmalen for the review.
I believe I've addressed all your comments.
I've updated the patch based on D102437 <https://reviews.llvm.org/D102437> because there was a dependency between the cost model and the scalarization.
I could only use predicateWithScalar if I was able to compute the cost model, but the cost model was only able to be computed if it was able to be scalarized, and in this case, that was not possible because of sdiv.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5605
+ if (loopHasScalarWithPredication(MaxScalableVF,isScalarEpilogueAllowed())) {
+ reportVectorizationInfo(
----------------
sdesmalen wrote:
> Should this be `!isScalarEpilogueAllowed()`? i.e. if a scalar epilogue loop is not allowed, then we know predication is required.
Hey Sander,
I may be wrong, but if the loop allows scalar epilogue then it should check if the instruction has a !mayDivideByZero(*I). If it does not allows scalar epilogue then we do not need to check the instruction, because the loop will not scalarize the epilogue.
```
// If predication is used for this block and the operation would otherwise
// be guarded, then this requires scalarizing.
if (blockNeedsPredication(I->getParent()) || VectorizeWithPredication)
return !mayDivideByZero(*I);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101916/new/
https://reviews.llvm.org/D101916
More information about the llvm-commits
mailing list