Commit 5c8a71d8 authored by Nikita Popov's avatar Nikita Popov
Browse files

[InstCombine] Remove unnecessary icmp of all-zero gep folds (NFC)

All-zero GEPs will be removed anyway, no need to special-case them
here.
parent 54732a3e
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -846,17 +846,6 @@ Instruction *InstCombinerImpl::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
      return transformToIndexedCompare(GEPLHS, RHS, Cond, DL, *this);
    }

    // If one of the GEPs has all zero indices, recurse.
    // FIXME: Handle vector of pointers.
    if (!GEPLHS->getType()->isVectorTy() && GEPLHS->hasAllZeroIndices())
      return foldGEPICmp(GEPRHS, GEPLHS->getOperand(0),
                         ICmpInst::getSwappedPredicate(Cond), I);

    // If the other GEP has all zero indices, recurse.
    // FIXME: Handle vector of pointers.
    if (!GEPRHS->getType()->isVectorTy() && GEPRHS->hasAllZeroIndices())
      return foldGEPICmp(GEPLHS, GEPRHS->getOperand(0), Cond, I);

    bool GEPsInBounds = GEPLHS->isInBounds() && GEPRHS->isInBounds();
    if (GEPLHS->getNumOperands() == GEPRHS->getNumOperands() &&
        GEPLHS->getSourceElementType() == GEPRHS->getSourceElementType()) {