aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2026-02-08 11:55:11 +0000
committerFlorian Hahn <flo@fhahn.com>2026-02-08 11:55:12 +0000
commit3192fe2c7b08912cc72c86471a593165b615dc28 (patch)
tree88346bf642fa5d8a1d647e79c708b1cd0606d312 /llvm/lib/Transforms/Vectorize
parentb2f8a0f60134120586865bfb059b52929e6e8a04 (diff)
downloadllvm-3192fe2c7b08912cc72c86471a593165b615dc28.tar.gz
llvm-3192fe2c7b08912cc72c86471a593165b615dc28.tar.bz2
llvm-3192fe2c7b08912cc72c86471a593165b615dc28.zip
[VPlan] Fall back to legacy cost model if PtrSCEV is nullptr.
There are some cases when PtrSCEV can be nullptr. Fall back to legacy cost model, to not call isLoopInvariant with nullptr. Fixes a crash after 0c4f8094939d2.
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index accc4a3fb3ae..eea499aa345a 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -3523,7 +3523,7 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
if (ParentRegion && ParentRegion->isReplicator()) {
// TODO: Handle loop-invariant pointers in predicated blocks. For now,
// fall back to the legacy cost model.
- if (Ctx.PSE.getSE()->isLoopInvariant(PtrSCEV, Ctx.L))
+ if (!PtrSCEV || Ctx.PSE.getSE()->isLoopInvariant(PtrSCEV, Ctx.L))
break;
Cost /= Ctx.getPredBlockCostDivisor(UI->getParent());
Cost += Ctx.TTI.getCFInstrCost(Instruction::Br, Ctx.CostKind);