Skip to content

Commit f4c7cc2

Browse files
committed
[LV] Use more precise isPredicatedInst in legacy CCH (NFC).
Legal::isMaskRequired may be overly conservative and also return true when no mask is actually required. Use isPredicatedInst from the cost model instead, which fixes a cost-model divergence between legacy and VPlan cost model where the legacy cost model incorrectly assumed some loads were predicated. Fixes #148431.
1 parent f168175 commit f4c7cc2

File tree

2 files changed

+333
-2
lines changed

2 files changed

+333
-2
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6289,8 +6289,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
62896289
return TTI::CastContextHint::Interleave;
62906290
case LoopVectorizationCostModel::CM_Scalarize:
62916291
case LoopVectorizationCostModel::CM_Widen:
6292-
return Legal->isMaskRequired(I) ? TTI::CastContextHint::Masked
6293-
: TTI::CastContextHint::Normal;
6292+
return isPredicatedInst(I) ? TTI::CastContextHint::Masked
6293+
: TTI::CastContextHint::Normal;
62946294
case LoopVectorizationCostModel::CM_Widen_Reverse:
62956295
return TTI::CastContextHint::Reversed;
62966296
case LoopVectorizationCostModel::CM_Unknown:

0 commit comments

Comments
 (0)