Lines Matching refs:GEP

328 static bool isGEPFoldable(GetElementPtrInst *GEP,  in isGEPFoldable()  argument
330 SmallVector<const Value *, 4> Indices(GEP->indices()); in isGEPFoldable()
331 return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(), in isGEPFoldable()
335 Instruction *NaryReassociatePass::tryReassociateGEP(GetElementPtrInst *GEP) { in tryReassociateGEP() argument
337 if (isGEPFoldable(GEP, TTI)) in tryReassociateGEP()
340 gep_type_iterator GTI = gep_type_begin(*GEP); in tryReassociateGEP()
341 for (unsigned I = 1, E = GEP->getNumOperands(); I != E; ++I, ++GTI) { in tryReassociateGEP()
343 if (auto *NewGEP = tryReassociateGEPAtIndex(GEP, I - 1, in tryReassociateGEP()
353 GetElementPtrInst *GEP) { in requiresSignExtension() argument
355 DL->getIndexSizeInBits(GEP->getType()->getPointerAddressSpace()); in requiresSignExtension()
360 NaryReassociatePass::tryReassociateGEPAtIndex(GetElementPtrInst *GEP, in tryReassociateGEPAtIndex() argument
362 SimplifyQuery SQ(*DL, DT, AC, GEP); in tryReassociateGEPAtIndex()
363 Value *IndexToSplit = GEP->getOperand(I + 1); in tryReassociateGEPAtIndex()
376 if (requiresSignExtension(IndexToSplit, GEP) && in tryReassociateGEPAtIndex()
382 if (auto *NewGEP = tryReassociateGEPAtIndex(GEP, I, LHS, RHS, IndexedType)) in tryReassociateGEPAtIndex()
387 tryReassociateGEPAtIndex(GEP, I, RHS, LHS, IndexedType)) in tryReassociateGEPAtIndex()
395 NaryReassociatePass::tryReassociateGEPAtIndex(GetElementPtrInst *GEP, in tryReassociateGEPAtIndex() argument
401 for (Use &Index : GEP->indices()) in tryReassociateGEPAtIndex()
405 if (isKnownNonNegative(LHS, SimplifyQuery(*DL, DT, AC, GEP)) && in tryReassociateGEPAtIndex()
407 DL->getTypeSizeInBits(GEP->getOperand(I)->getType()) in tryReassociateGEPAtIndex()
414 SE->getZeroExtendExpr(IndexExprs[I], GEP->getOperand(I)->getType()); in tryReassociateGEPAtIndex()
416 const SCEV *CandidateExpr = SE->getGEPExpr(cast<GEPOperator>(GEP), in tryReassociateGEPAtIndex()
419 Value *Candidate = findClosestMatchingDominator(CandidateExpr, GEP); in tryReassociateGEPAtIndex()
423 IRBuilder<> Builder(GEP); in tryReassociateGEPAtIndex()
427 Candidate = Builder.CreateBitOrPointerCast(Candidate, GEP->getType()); in tryReassociateGEPAtIndex()
428 assert(Candidate->getType() == GEP->getType()); in tryReassociateGEPAtIndex()
432 Type *ElementType = GEP->getResultElementType(); in tryReassociateGEPAtIndex()
452 Type *PtrIdxTy = DL->getIndexType(GEP->getType()); in tryReassociateGEPAtIndex()
460 Builder.CreateGEP(GEP->getResultElementType(), Candidate, RHS)); in tryReassociateGEPAtIndex()
461 NewGEP->setIsInBounds(GEP->isInBounds()); in tryReassociateGEPAtIndex()
462 NewGEP->takeName(GEP); in tryReassociateGEPAtIndex()