diff options
author | Florian Hahn <flo@fhahn.com> | 2025-05-18 10:17:20 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2025-05-18 10:17:21 +0100 |
commit | 7e14161f49b32387988cf9d937bbfaa27d0fbdd5 (patch) | |
tree | c59a66a7ce732532082d8b8208c3b83cccd4d831 /llvm/lib/Transforms/Utils/LoopPeel.cpp | |
parent | b18ebd17b82db0bdf5bb8cae59c3208288fbef93 (diff) | |
download | llvm-7e14161f49b32387988cf9d937bbfaa27d0fbdd5.zip llvm-7e14161f49b32387988cf9d937bbfaa27d0fbdd5.tar.gz llvm-7e14161f49b32387988cf9d937bbfaa27d0fbdd5.tar.bz2 |
[LoopPeel] Handle constants when updating exit values when peeling last.
Account for constant values when updating exit values after peeling an
iteration from the end. This can happen if the inner loop gets unrolled
and simplified.
Fixes https://github.com/llvm/llvm-project/issues/140442.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopPeel.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopPeel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp index c5c637a..646354bb 100644 --- a/llvm/lib/Transforms/Utils/LoopPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp @@ -1214,7 +1214,7 @@ bool llvm::peelLoop(Loop *L, unsigned PeelCount, bool PeelLast, LoopInfo *LI, // Now adjust users of the original exit values by replacing them with the // exit value from the peeled iteration. for (const auto &[P, E] : ExitValues) - P->replaceAllUsesWith(VMap.lookup(E)); + P->replaceAllUsesWith(isa<Constant>(E) ? E : &*VMap.lookup(E)); formLCSSA(*L, DT, LI, SE); } else { // Now adjust the phi nodes in the loop header to get their initial values |