aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-02-01 16:06:58 +0100
committerNikita Popov <npopov@redhat.com>2024-02-01 16:08:25 +0100
commit62ae7d976f494f3dbd297331b19cd1204750de6f (patch)
tree78656f3c1a54923078ab4911742e3b08c54bc957 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
parentf7b05e055fa63e1c4b5ae5e391b654b57161a0e4 (diff)
downloadllvm-62ae7d976f494f3dbd297331b19cd1204750de6f.zip
llvm-62ae7d976f494f3dbd297331b19cd1204750de6f.tar.gz
llvm-62ae7d976f494f3dbd297331b19cd1204750de6f.tar.bz2
[LoopUnroll] Fix missing sign extension
For integers larger than 64-bit, this would zero-extend a -1 value, instead of sign-extending it. Fixes https://github.com/llvm/llvm-project/issues/80289.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
index 612f699..650f055 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -776,7 +776,7 @@ bool llvm::UnrollRuntimeLoopRemainder(
!isGuaranteedNotToBeUndefOrPoison(TripCount, AC, PreHeaderBR, DT)) {
TripCount = B.CreateFreeze(TripCount);
BECount =
- B.CreateAdd(TripCount, ConstantInt::get(TripCount->getType(), -1));
+ B.CreateAdd(TripCount, Constant::getAllOnesValue(TripCount->getType()));
} else {
// If we don't need to freeze, use SCEVExpander for BECount as well, to
// allow slightly better value reuse.