summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-10-25 10:30:09 +0200
committerNikita Popov <npopov@redhat.com>2023-10-25 10:31:02 +0200
commit7df92fbe74e3c1b41c06f5fc784473f7f22aeed7 (patch)
treea5370b446aa5c1e517717acfc7c507e89414a2e8
parent8d80a452b841a211e0f3bce01a01c9a015d287f3 (diff)
[InstCombine] Remove redundant icmp gep fold (NFCI)
Gep with zero indices will be folded away independently. It will only be retained for splat geps, for which the transform is not applicable anyway.
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 5e16afa32e56..f39bfc655bf9 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -3952,14 +3952,6 @@ Instruction *InstCombinerImpl::foldICmpInstWithConstantNotInt(ICmpInst &I) {
return nullptr;
switch (LHSI->getOpcode()) {
- case Instruction::GetElementPtr:
- // icmp pred GEP (P, int 0, int 0, int 0), null -> icmp pred P, null
- if (RHSC->isNullValue() &&
- cast<GetElementPtrInst>(LHSI)->hasAllZeroIndices())
- return new ICmpInst(
- I.getPredicate(), LHSI->getOperand(0),
- Constant::getNullValue(LHSI->getOperand(0)->getType()));
- break;
case Instruction::PHI:
if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI)))
return NV;