[PATCH] D112552: [LoopVectorize] When tail-folding, don't always predicate uniform loads
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 1 02:05:17 PDT 2021
david-arm added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9070
+ if (IsUniform && isa<LoadInst>(I) &&
+ !Legal->blockNeedsPredication(I->getParent()) && Range.Start.isVector()) {
+ assert(CM.foldTailByMasking() &&
----------------
fhahn wrote:
> The problem with the workaround is that `IsPredicated` is now inaccurate for the recipe I think.
>
> It looks like the cost-model already accurately estimates the cost as not requiring predication. So perhaps it would be better to not claim the instruction requires predication in the first place in `LoopVectorizationCostModel::isPredicated`?
Hi @fhahn, are you suggesting that `IsPredicated` is being set incorrectly above? If I understand correctly, I believe you're suggesting the answer would be to add more logic to `isPredicatedInst`? i.e. something like:
bool isPredicatedInst(Instruction *I, bool IsUniform) {
if (IsUniform && isa<LoadInst>(I) &&
!Legal->blockNeedsPredication(I->getParent()))
return false;
if (!blockNeedsPredication(I->getParent()))
...
}
That feels a bit messy. Would it be better to simply adjust the IsPredicated boolean value instead in this function?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112552/new/
https://reviews.llvm.org/D112552
More information about the llvm-commits
mailing list