diff options
author | Florian Hahn <flo@fhahn.com> | 2024-06-04 20:37:45 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2024-06-04 20:37:46 +0100 |
commit | e775efcec476b3ec4eacfb14dc5bc7e86d9aa8fd (patch) | |
tree | f4a2059939615289f88adf9fd47a02b1f2f79a9f /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | fbaec0f46b5853cbdbdfe77fb87e1321a1967956 (diff) | |
download | llvm-e775efcec476b3ec4eacfb14dc5bc7e86d9aa8fd.zip llvm-e775efcec476b3ec4eacfb14dc5bc7e86d9aa8fd.tar.gz llvm-e775efcec476b3ec4eacfb14dc5bc7e86d9aa8fd.tar.bz2 |
[LV] Apply loop guards when checking recur during hoisting RT checks.
Apply loop guards when checking if the recurrence is non-negative in
cases where runtime checks are hoisted out of an inner loop.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index de3eb4a..922d4b6 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -1760,7 +1760,8 @@ static PointerBounds expandBounds(const RuntimeCheckingPtrGroup *CG, Low = cast<SCEVAddRecExpr>(Low)->getStart(); // If there is a possibility that the stride is negative then we have // to generate extra checks to ensure the stride is positive. - if (!SE.isKnownNonNegative(Recur)) { + if (!SE.isKnownNonNegative( + SE.applyLoopGuards(Recur, HighAR->getLoop()))) { Stride = Recur; LLVM_DEBUG(dbgs() << "LAA: ... but need to check stride is " "positive: " |