diff options
| author | Graham Hunter <graham.hunter@arm.com> | 2025-09-11 11:03:05 +0000 |
|---|---|---|
| committer | Graham Hunter <graham.hunter@arm.com> | 2025-09-11 11:18:22 +0000 |
| commit | e285602fdab9d8c4f17c35727624446b69e038ba (patch) | |
| tree | 7d31cc590e15df86c8bee1d9cd3736d4d91028fc /llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | |
| parent | 61f7f9bddc7f337972c41922259cae42a589fa65 (diff) | |
[LV] Enforce addrec in current loop for uncountable exit load address check
Addresses post-commit review raised for #145663
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp index 2704e66f3a70..85a6fcaf3ecd 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp @@ -1878,11 +1878,11 @@ bool LoopVectorizationLegality::canUncountableExitConditionLoadBeMoved( // Make sure that the load address is not loop invariant; we want an // address calculation that we can rotate to the next vector iteration. - const SCEV *PtrScev = PSE.getSE()->getSCEV(Ptr); - if (!isa<SCEVAddRecExpr>(PtrScev)) { + const auto *AR = dyn_cast<SCEVAddRecExpr>(PSE.getSE()->getSCEV(Ptr)); + if (!AR || AR->getLoop() != TheLoop || !AR->isAffine()) { reportVectorizationFailure( "Uncountable exit condition depends on load with an address that is " - "not an add recurrence", + "not an add recurrence in the loop", "EarlyExitLoadInvariantAddress", ORE, TheLoop); return false; } |
