Lines Matching refs:GEPI
337 GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I);
338 if (!GEPI) return false;
340 if (GEPI->getNumOperands() < 3 || !isa<Constant>(GEPI->getOperand(1)) ||
341 !cast<Constant>(GEPI->getOperand(1))->isNullValue())
344 for (User *U : GEPI->users())
369 gep_type_iterator GEPI = gep_type_begin(U), E = gep_type_end(U);
370 ++GEPI; // Skip over the pointer index.
373 if (ArrayType *AT = dyn_cast<ArrayType>(*GEPI)) {
390 for (++GEPI; // Skip array index.
391 GEPI != E;
392 ++GEPI) {
394 if (ArrayType *SubArrayTy = dyn_cast<ArrayType>(*GEPI))
396 else if (VectorType *SubVectorTy = dyn_cast<VectorType>(*GEPI))
399 assert((*GEPI)->isStructTy() &&
404 ConstantInt *IdxVal = dyn_cast<ConstantInt>(GEPI.getOperand());
544 GetElementPtrInst *GEPI = cast<GetElementPtrInst>(GEP);
547 for (unsigned i = 3, e = GEPI->getNumOperands(); i != e; ++i)
548 Idxs.push_back(GEPI->getOperand(i));
550 NewTy, NewPtr, Idxs, GEPI->getName() + "." + Twine(Val), GEPI);
555 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(GEP))
556 GEPI->eraseFromParent();
603 } else if (const GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) {
604 if (!AllUsesOfValueWillTrapIfNull(GEPI, PHIs)) return false;
679 } else if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I)) {
682 Idxs.reserve(GEPI->getNumOperands()-1);
683 for (User::op_iterator i = GEPI->op_begin() + 1, e = GEPI->op_end();
689 if (Idxs.size() == GEPI->getNumOperands()-1)
691 GEPI, ConstantExpr::getGetElementPtr(nullptr, NewV, Idxs));
692 if (GEPI->use_empty()) {
694 GEPI->eraseFromParent();
985 } else if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) {
988 if (GEPI->hasAllZeroIndices() && GEPI->hasOneUse())
989 if (StoreInst *SI = dyn_cast<StoreInst>(GEPI->user_back()))
993 ReplaceUsesOfMallocWithGlobal(GEPI, GV);
994 GEPI->eraseFromParent();
1024 if (const GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(UI)) {
1026 if (GEPI->getNumOperands() < 3)
1170 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(LoadUser)) {
1171 assert(GEPI->getNumOperands() >= 3 && isa<ConstantInt>(GEPI->getOperand(2))
1172 && "Unexpected GEPI!");
1175 unsigned FieldNo = cast<ConstantInt>(GEPI->getOperand(2))->getZExtValue();
1176 Value *NewPtr = GetHeapSROAValue(GEPI->getOperand(0), FieldNo,
1181 GEPIdx.push_back(GEPI->getOperand(1));
1182 GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end());
1184 Value *NGEPI = GetElementPtrInst::Create(GEPI->getResultElementType(), NewPtr, GEPIdx,
1185 GEPI->getName(), GEPI);
1186 GEPI->replaceAllUsesWith(NGEPI);
1187 GEPI->eraseFromParent();