[PATCH] D73490: [LV] Remove nondeterminacy by changing LoopVectorizationLegality::Reductions from DenseMap to MapVector
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 00:54:23 PST 2020
Ayal added a comment.
Culprit is the following from LoopVectorize.cpp:
// Finally, if tail is folded by masking, introduce selects between the phi
// and the live-out instruction of each reduction, at the end of the latch.
if (CM.foldTailByMasking()) {
Builder.setInsertPoint(VPBB);
auto *Cond = RecipeBuilder.createBlockInMask(OrigLoop->getHeader(), Plan);
for (auto &Reduction : *Legal->getReductionVars()) {
VPValue *Phi = Plan->getVPValue(Reduction.first);
VPValue *Red = Plan->getVPValue(Reduction.second.getLoopExitInstr());
Builder.createNaryOp(Instruction::Select, {Cond, Red, Phi});
}
}
Hence small estimated trip-count based on branch weights in the above test is used to trigger foldTailByMasking. Another, more direct alternative is to specify -prefer-predicate-over-epilog.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73490/new/
https://reviews.llvm.org/D73490
More information about the llvm-commits
mailing list