aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2026-02-11 20:52:07 +0000
committerFlorian Hahn <flo@fhahn.com>2026-02-11 20:52:08 +0000
commitd3afa171ee236dfef4b7cd4b4dd0b0fb165a48cc (patch)
tree299e5537957762ff41d490adb3a6f322d73a6d79 /llvm/lib/Transforms/Vectorize
parent0215f6b6cf810d9ab6d02fc7bbec5c26ad4701ff (diff)
downloadllvm-d3afa171ee236dfef4b7cd4b4dd0b0fb165a48cc.tar.gz
llvm-d3afa171ee236dfef4b7cd4b4dd0b0fb165a48cc.tar.bz2
llvm-d3afa171ee236dfef4b7cd4b4dd0b0fb165a48cc.zip
[LV] Don't scalarize loads that need predication in legacy CM.
The legacy cost model tries to scalarize loads that are used as pointers. Skip if the load would need predicating when scalarized, because that would incur very high costs, see useEmulatedMaskMemRefHack. Fixes https://github.com/llvm/llvm-project/issues/180780.
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 164d74f1a440..9b2641c2b9bb 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5883,9 +5883,9 @@ void LoopVectorizationCostModel::setCostBasedWideningDecision(ElementCount VF) {
// if the loaded register is involved in an address computation, it is
// instead changed here when we know this is the case.
InstWidening Decision = getWideningDecision(I, VF);
- if (Decision == CM_Widen || Decision == CM_Widen_Reverse ||
- (!isPredicatedInst(I) && !Legal->isUniformMemOp(*I, VF) &&
- Decision == CM_Scalarize)) {
+ if (!isPredicatedInst(I) &&
+ (Decision == CM_Widen || Decision == CM_Widen_Reverse ||
+ (!Legal->isUniformMemOp(*I, VF) && Decision == CM_Scalarize))) {
// Scalarize a widened load of address or update the cost of a scalar
// load of an address.
setWideningDecision(