[llvm] [LV] Support generating masks for switch terminators. (PR #99808)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 10:24:13 PDT 2024
================
@@ -6456,6 +6456,17 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
// a predicated block since it will become a fall-through, although we
// may decide in the future to call TTI for all branches.
}
+ case Instruction::Switch: {
+ if (VF.isScalar())
+ return TTI.getCFInstrCost(Instruction::Switch, CostKind);
----------------
ayalz wrote:
The above scalar cost seems right, wonder about the vector cost below - the cost associated with predicating conditional branches is collected when visiting each phi, rather than the branch itself. May be good to calibrate with some tests, can leave behind a TODO to be done separately.
https://github.com/llvm/llvm-project/pull/99808
More information about the llvm-commits
mailing list