[llvm] [InstCombine] Don't handle non-canonical index type in icmp of load fold (PR #151346)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 06:17:22 PDT 2025
================
@@ -290,17 +295,6 @@ Instruction *InstCombinerImpl::foldCmpLoadFromIndexedGlobal(
// Now that we've scanned the entire array, emit our new comparison(s). We
// order the state machines in complexity of the generated code.
- Value *Idx = GEP->getOperand(2);
-
- // If the index is larger than the pointer offset size of the target, truncate
- // the index down like the GEP would do implicitly. We don't have to do this
- // for an inbounds GEP because the index can't be out of range.
- if (!GEP->isInBounds()) {
- Type *PtrIdxTy = DL.getIndexType(GEP->getType());
- unsigned OffsetSize = PtrIdxTy->getIntegerBitWidth();
- if (Idx->getType()->getPrimitiveSizeInBits().getFixedValue() > OffsetSize)
- Idx = Builder.CreateTrunc(Idx, PtrIdxTy);
----------------
nikic wrote:
https://github.com/llvm/llvm-project/pull/151516
https://github.com/llvm/llvm-project/pull/151346
More information about the llvm-commits
mailing list