Lines Matching refs:GEPI
879 static bool canReplaceGEPIdxWithZero(InstCombiner &IC, GetElementPtrInst *GEPI,
881 if (GEPI->getNumOperands() < 2)
886 auto FirstNZIdx = [](const GetElementPtrInst *GEPI) {
888 for (unsigned IE = GEPI->getNumOperands(); I != IE; ++I) {
889 Value *V = GEPI->getOperand(I);
902 Idx = FirstNZIdx(GEPI);
903 if (Idx == GEPI->getNumOperands())
905 if (isa<Constant>(GEPI->getOperand(Idx)))
908 SmallVector<Value *, 4> Ops(GEPI->idx_begin(), GEPI->idx_begin() + Idx);
910 GetElementPtrInst::getIndexedType(GEPI->getSourceElementType(), Ops);
921 for (unsigned i = Idx+1, e = GEPI->getNumOperands(); i != e; ++i) {
922 KnownBits Known = IC.computeKnownBits(GEPI->getOperand(i), 0, MemI);
936 if (Idx+1 != GEPI->getNumOperands() && !GEPI->isInBounds())
941 return isObjectSizeLessThanOrEq(GEPI->getOperand(0), TyAllocSize, DL) &&
951 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Ptr)) {
953 if (canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)) {
954 Instruction *NewGEPI = GEPI->clone();
956 ConstantInt::get(GEPI->getOperand(Idx)->getType(), 0));
957 NewGEPI->insertBefore(GEPI);
971 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Ptr))
972 Ptr = GEPI->getOperand(0);
978 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Op)) {
979 const Value *GEPI0 = GEPI->getOperand(0);
981 !NullPointerIsDefined(LI.getFunction(), GEPI->getPointerAddressSpace()))