[llvm] adb4cfe - [InstCombine] Use getAllOnesValue()
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 06:04:42 PDT 2024
Author: Nikita Popov
Date: 2024-08-13T15:04:23+02:00
New Revision: adb4cfe0b61859eb0911b34c6f27eb5925cb9d94
URL: https://github.com/llvm/llvm-project/commit/adb4cfe0b61859eb0911b34c6f27eb5925cb9d94
DIFF: https://github.com/llvm/llvm-project/commit/adb4cfe0b61859eb0911b34c6f27eb5925cb9d94.diff
LOG: [InstCombine] Use getAllOnesValue()
Split off from https://github.com/llvm/llvm-project/pull/80309.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 10a89b47e0753..2b0347073b7d1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -312,7 +312,7 @@ Instruction *InstCombinerImpl::foldCmpLoadFromIndexedGlobal(
DL.getTypeAllocSize(Init->getType()->getArrayElementType());
auto MaskIdx = [&](Value *Idx) {
if (!GEP->isInBounds() && llvm::countr_zero(ElementSize) != 0) {
- Value *Mask = ConstantInt::get(Idx->getType(), -1);
+ Value *Mask = Constant::getAllOnesValue(Idx->getType());
Mask = Builder.CreateLShr(Mask, llvm::countr_zero(ElementSize));
Idx = Builder.CreateAnd(Idx, Mask);
}
More information about the llvm-commits
mailing list