diff options
author | Philip Reames <preames@rivosinc.com> | 2025-06-17 11:22:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-17 11:22:23 -0700 |
commit | bb288de4e0e74f235402ff41be60dabcd57e379f (patch) | |
tree | 2cd0c37b1a53a1f1c6ddc33d15e1661537ec2970 /llvm/lib/Transforms/Utils/LoopPeel.cpp | |
parent | 2ab9c35ea93f8557827d4cadcceb05e4eed2d30a (diff) | |
download | llvm-bb288de4e0e74f235402ff41be60dabcd57e379f.zip llvm-bb288de4e0e74f235402ff41be60dabcd57e379f.tar.gz llvm-bb288de4e0e74f235402ff41be60dabcd57e379f.tar.bz2 |
[LoopPeel] Support last iteration peeling of min/max intrinsics (#143598)
This isn't terribly useful at the moment because of the step=1
restriction but it should be functionally sound. This is mostly just
making sure the codepaths don't diverge as we make other changes.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopPeel.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopPeel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp index f343962..27e70c5 100644 --- a/llvm/lib/Transforms/Utils/LoopPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp @@ -545,8 +545,11 @@ countToEliminateCompares(Loop &L, unsigned MaxPeelCount, ScalarEvolution &SE, const SCEV *IterVal = AddRec->evaluateAtIteration( SE.getConstant(AddRec->getType(), NewPeelCount), SE); if (!PeelWhilePredicateIsKnown(NewPeelCount, IterVal, BoundSCEV, Step, - Pred)) + Pred)) { + if (shouldPeelLastIteration(L, Pred, AddRec, BoundSCEV, SE, TTI)) + DesiredPeelCountLast = 1; return; + } DesiredPeelCount = NewPeelCount; }; |