diff options
author | Nikita Popov <npopov@redhat.com> | 2024-02-01 16:06:58 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2024-02-01 16:08:25 +0100 |
commit | 62ae7d976f494f3dbd297331b19cd1204750de6f (patch) | |
tree | 78656f3c1a54923078ab4911742e3b08c54bc957 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | f7b05e055fa63e1c4b5ae5e391b654b57161a0e4 (diff) | |
download | llvm-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.cpp | 2 |
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. |