Lines Matching refs:GEPI
700 static bool canReplaceGEPIdxWithZero(InstCombiner &IC, GetElementPtrInst *GEPI,
702 if (GEPI->getNumOperands() < 2)
707 auto FirstNZIdx = [](const GetElementPtrInst *GEPI) {
709 for (unsigned IE = GEPI->getNumOperands(); I != IE; ++I) {
710 Value *V = GEPI->getOperand(I);
723 Idx = FirstNZIdx(GEPI);
724 if (Idx == GEPI->getNumOperands())
726 if (isa<Constant>(GEPI->getOperand(Idx)))
729 SmallVector<Value *, 4> Ops(GEPI->idx_begin(), GEPI->idx_begin() + Idx);
731 GetElementPtrInst::getIndexedType(GEPI->getSourceElementType(), Ops);
742 for (unsigned i = Idx+1, e = GEPI->getNumOperands(); i != e; ++i) {
744 IC.ComputeSignBit(GEPI->getOperand(i), KnownNonNegative,
759 if (Idx+1 != GEPI->getNumOperands() && !GEPI->isInBounds())
764 return isObjectSizeLessThanOrEq(GEPI->getOperand(0), TyAllocSize, DL) &&
774 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Ptr)) {
776 if (canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)) {
777 Instruction *NewGEPI = GEPI->clone();
779 ConstantInt::get(GEPI->getOperand(Idx)->getType(), 0));
780 NewGEPI->insertBefore(GEPI);
848 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Op)) {
849 const Value *GEPI0 = GEPI->getOperand(0);
851 if (isa<ConstantPointerNull>(GEPI0) && GEPI->getPointerAddressSpace() == 0){