Home | History | Annotate | Download | only in IPO

Lines Matching defs:GEP

168     if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) {
169 if (!GEP->hasAllConstantIndices())
314 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) {
315 // Do not transform "gepinst (gep constexpr (GV))" here, because forming
316 // "gepconstexpr (gep constexpr (GV))" will cause the two gep's to fold
319 if (!isa<ConstantExpr>(GEP->getOperand(0))) {
321 dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP, DL, TLI));
325 // If the initializer is an all-null value and we have an inbounds GEP,
326 // we already know what the result of any load from that GEP is.
328 if (Init && isa<ConstantAggregateZero>(Init) && GEP->isInBounds())
329 SubInit = Constant::getNullValue(GEP->getType()->getElementType());
331 Changed |= CleanupConstantGlobalUsers(GEP, SubInit, DL, TLI);
333 if (GEP->use_empty()) {
334 GEP->eraseFromParent();
373 // Otherwise, it must be a GEP.
392 // The user of the global must be a GEP Inst or a ConstantExpr GEP.
398 // Check to see if this ConstantExpr GEP is SRA'able. In particular, we
400 // indices. This enforces that all uses are 'gep GV, 0, C, ...' for some
438 "Indexed GEP type is not array, vector, or struct!");
555 User *GEP = GV->user_back();
556 assert(((isa<ConstantExpr>(GEP) &&
557 cast<ConstantExpr>(GEP)->getOpcode()==Instruction::GetElementPtr)||
558 isa<GetElementPtrInst>(GEP)) && "NonGEP CE's are not SRAable!");
563 unsigned Val = cast<ConstantInt>(GEP->getOperand(2))->getZExtValue();
568 // Form a shorter GEP if needed.
569 if (GEP->getNumOperands() > 3) {
570 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(GEP)) {
577 GetElementPtrInst *GEPI = cast<GetElementPtrInst>(GEP);
586 GEP->replaceAllUsesWith(NewPtr);
588 if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(GEP))
591 cast<ConstantExpr>(GEP)->destroyConstant();
713 // Should handle GEP here.
945 // constant prop them. This will promote GEP instructions with constant
946 // indices into GEP constant-exprs, which will allow global-opt to hack on it.
1027 // If this is a "GEP bitcast" and the user is a store to the global, then
1032 // Must be bitcast GEP between the malloc and store to initialize
1047 /// of a load) are simple enough to perform heap SRA on. This permits GEP's
1070 // Otherwise the GEP is ok.
1223 // Create the new GEP idx vector.
1489 // GEP'd. These are all things we could transform to using the global
2031 // GEP is fine if it is simple + constant offset.
2061 /// We basically just support direct accesses to globals and GEP's of
2074 // Handle a constantexpr gep.
2111 /// At this point, the GEP operands of Addr [0, OpNo) have been stepped into.
2397 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(CurInst)) {
2398 Constant *P = getVal(GEP->getOperand(0));
2400 for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end();
2405 cast<GEPOperator>(GEP)->isInBounds());
2406 DEBUG(dbgs() << "Found a GEP! Simplifying: " << *InstResult