Lines Matching defs:GEP
174 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) {
175 if (!GEP->hasAllConstantIndices())
318 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) {
319 // Do not transform "gepinst (gep constexpr (GV))" here, because forming
320 // "gepconstexpr (gep constexpr (GV))" will cause the two gep's to fold
323 if (!isa<ConstantExpr>(GEP->getOperand(0))) {
325 ConstantFoldInstruction(GEP, DL, TLI));
329 // If the initializer is an all-null value and we have an inbounds GEP,
330 // we already know what the result of any load from that GEP is.
332 if (Init && isa<ConstantAggregateZero>(Init) && GEP->isInBounds())
333 SubInit = Constant::getNullValue(GEP->getType()->getElementType());
335 Changed |= CleanupConstantGlobalUsers(GEP, SubInit, DL, TLI);
337 if (GEP->use_empty()) {
338 GEP->eraseFromParent();
377 // Otherwise, it must be a GEP.
395 // The user of the global must be a GEP Inst or a ConstantExpr GEP.
401 // Check to see if this ConstantExpr GEP is SRA'able. In particular, we
403 // indices. This enforces that all uses are 'gep GV, 0, C, ...' for some
441 "Indexed GEP type is not array, vector, or struct!");
559 User *GEP = GV->user_back();
560 assert(((isa<ConstantExpr>(GEP) &&
561 cast<ConstantExpr>(GEP)->getOpcode()==Instruction::GetElementPtr)||
562 isa<GetElementPtrInst>(GEP)) && "NonGEP CE's are not SRAable!");
567 unsigned Val = cast<ConstantInt>(GEP->getOperand(2))->getZExtValue();
573 // Form a shorter GEP if needed.
574 if (GEP->getNumOperands() > 3) {
575 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(GEP)) {
583 GetElementPtrInst *GEPI = cast<GetElementPtrInst>(GEP);
592 GEP->replaceAllUsesWith(NewPtr);
594 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(GEP))
597 cast<ConstantExpr>(GEP)->destroyConstant();
719 // Should handle GEP here.
949 // constant prop them. This will promote GEP instructions with constant
950 // indices into GEP constant-exprs, which will allow global-opt to hack on it.
1029 // If this is a "GEP bitcast" and the user is a store to the global, then
1034 // Must be bitcast GEP between the malloc and store to initialize
1049 /// perform heap SRA on. This permits GEP's that index through the array and
1072 // Otherwise the GEP is ok.
1222 // Create the new GEP idx vector.
1482 // GEP'd. These are all things we could transform to using the global
1807 // to care about is a constant GEP or constant bitcast - so just looking
2157 // GEP is fine if it is simple + constant offset.
2188 /// globals and GEP's of globals. This should be kept up to date with
2201 // Handle a constantexpr gep.
2238 /// GEP operands of Addr [0, OpNo) have been stepped into.
2533 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(CurInst)) {
2534 Constant *P = getVal(GEP->getOperand(0));
2536 for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end();
2540 ConstantExpr::getGetElementPtr(GEP->getSourceElementType(), P, GEPOps,
2541 cast<GEPOperator>(GEP)->isInBounds());
2542 DEBUG(dbgs() << "Found a GEP! Simplifying: " << *InstResult