Lines Matching defs:GEPLHS
630 /// Converts (CMP GEPLHS, RHS) if this change would make RHS a constant.
632 /// between GEPLHS and RHS.
633 static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS,
638 if (GEPLHS->getType()->isVectorTy())
641 if (!GEPLHS->hasAllConstantIndices())
644 APInt Offset(DL.getIndexTypeSizeInBits(GEPLHS->getType()), 0);
646 GEPLHS->stripAndAccumulateConstantOffsets(DL, Offset,
650 if (PtrBase->getType() != GEPLHS->getType())
655 GEPNoWrapFlags NW = GEPLHS->getNoWrapFlags();
677 Instruction *InstCombinerImpl::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
712 Value *PtrBase = GEPLHS->getOperand(0);
713 if (PtrBase == RHS && CanFold(GEPLHS->getNoWrapFlags())) {
715 Value *Offset = EmitGEPOffset(GEPLHS);
716 return NewICmp(GEPLHS->getNoWrapFlags(), Offset,
720 if (GEPLHS->isInBounds() && ICmpInst::isEquality(Cond) &&
741 auto *Base = GEPLHS->getPointerOperand();
742 if (GEPLHS->getType()->isVectorTy() && Base->getType()->isPointerTy()) {
743 auto EC = cast<VectorType>(GEPLHS->getType())->getElementCount();
750 GEPNoWrapFlags NW = GEPLHS->getNoWrapFlags() & GEPRHS->getNoWrapFlags();
756 GEPLHS->getNumOperands() == GEPRHS->getNumOperands() &&
757 GEPLHS->getPointerOperand()->getType() ==
759 GEPLHS->getSourceElementType() == GEPRHS->getSourceElementType();
761 for (unsigned i = 1, e = GEPLHS->getNumOperands(); i != e; ++i)
762 if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) {
768 Type *BaseType = GEPLHS->getOperand(0)->getType();
771 return new ICmpInst(Cond, GEPLHS->getOperand(0), GEPRHS->getOperand(0));
777 if (GEPLHS->isInBounds() && GEPRHS->isInBounds() &&
778 (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) &&
782 !GEPLHS->getType()->isVectorTy()) {
783 Value *LOffset = EmitGEPOffset(GEPLHS);
807 return transformToIndexedCompare(GEPLHS, RHS, Cond, DL, *this);
810 if (GEPLHS->getNumOperands() == GEPRHS->getNumOperands() &&
811 GEPLHS->getSourceElementType() == GEPRHS->getSourceElementType()) {
816 if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) {
817 Type *LHSType = GEPLHS->getOperand(i)->getType();
822 (GEPLHS->getType()->isVectorTy() &&
838 Value *LHSV = GEPLHS->getOperand(DiffOperand);
846 Value *L = EmitGEPOffset(GEPLHS, /*RewriteGEP=*/true);
854 return transformToIndexedCompare(GEPLHS, RHS, Cond, DL, *this);