Lines Matching refs:GEP

238   static Value *Extract(Value *Idx, GetElementPtrInst *GEP,
244 static int64_t Find(Value *Idx, GetElementPtrInst *GEP,
387 bool splitGEP(GetElementPtrInst *GEP);
414 int64_t accumulateByteOffset(GetElementPtrInst *GEP, bool &NeedsExtraction);
431 bool canonicalizeArrayIndicesToPointerSize(GetElementPtrInst *GEP);
767 Value *ConstantOffsetExtractor::Extract(Value *Idx, GetElementPtrInst *GEP, in Extract() argument
770 ConstantOffsetExtractor Extractor(GEP, DT); in Extract()
774 GEP->isInBounds()); in Extract()
785 int64_t ConstantOffsetExtractor::Find(Value *Idx, GetElementPtrInst *GEP, in Find() argument
788 return ConstantOffsetExtractor(GEP, DT) in Find()
790 GEP->isInBounds()) in Find()
795 GetElementPtrInst *GEP) { in canonicalizeArrayIndicesToPointerSize() argument
797 Type *IntPtrTy = DL->getIntPtrType(GEP->getType()); in canonicalizeArrayIndicesToPointerSize()
798 gep_type_iterator GTI = gep_type_begin(*GEP); in canonicalizeArrayIndicesToPointerSize()
799 for (User::op_iterator I = GEP->op_begin() + 1, E = GEP->op_end(); in canonicalizeArrayIndicesToPointerSize()
804 *I = CastInst::CreateIntegerCast(*I, IntPtrTy, true, "idxprom", GEP); in canonicalizeArrayIndicesToPointerSize()
813 SeparateConstOffsetFromGEP::accumulateByteOffset(GetElementPtrInst *GEP, in accumulateByteOffset() argument
817 gep_type_iterator GTI = gep_type_begin(*GEP); in accumulateByteOffset()
818 for (unsigned I = 1, E = GEP->getNumOperands(); I != E; ++I, ++GTI) { in accumulateByteOffset()
822 ConstantOffsetExtractor::Find(GEP->getOperand(I), GEP, DT); in accumulateByteOffset()
833 uint64_t Field = cast<ConstantInt>(GEP->getOperand(I))->getZExtValue(); in accumulateByteOffset()
962 bool SeparateConstOffsetFromGEP::splitGEP(GetElementPtrInst *GEP) { in splitGEP() argument
964 if (GEP->getType()->isVectorTy()) in splitGEP()
969 if (GEP->hasAllConstantIndices()) in splitGEP()
972 bool Changed = canonicalizeArrayIndicesToPointerSize(GEP); in splitGEP()
975 int64_t AccumulativeByteOffset = accumulateByteOffset(GEP, NeedsExtraction); in splitGEP()
980 TargetTransformInfo &TTI = GetTTI(*GEP->getFunction()); in splitGEP()
990 unsigned AddrSpace = GEP->getPointerAddressSpace(); in splitGEP()
991 if (!TTI.isLegalAddressingMode(GEP->getResultElementType(), in splitGEP()
1006 gep_type_iterator GTI = gep_type_begin(*GEP); in splitGEP()
1007 for (unsigned I = 1, E = GEP->getNumOperands(); I != E; ++I, ++GTI) { in splitGEP()
1011 Value *OldIdx = GEP->getOperand(I); in splitGEP()
1014 ConstantOffsetExtractor::Extract(OldIdx, GEP, UserChainTail, DT); in splitGEP()
1017 GEP->setOperand(I, NewIdx); in splitGEP()
1045 bool GEPWasInBounds = GEP->isInBounds(); in splitGEP()
1046 GEP->setIsInBounds(false); in splitGEP()
1053 lowerToSingleIndexGEPs(GEP, AccumulativeByteOffset); in splitGEP()
1055 lowerToArithmetics(GEP, AccumulativeByteOffset); in splitGEP()
1091 Instruction *NewGEP = GEP->clone(); in splitGEP()
1092 NewGEP->insertBefore(GEP); in splitGEP()
1098 DL->getTypeAllocSize(GEP->getResultElementType())); in splitGEP()
1099 Type *IntPtrTy = DL->getIntPtrType(GEP->getType()); in splitGEP()
1104 NewGEP = GetElementPtrInst::Create(GEP->getResultElementType(), NewGEP, in splitGEP()
1106 GEP->getName(), GEP); in splitGEP()
1107 NewGEP->copyMetadata(*GEP); in splitGEP()
1125 Type *I8PtrTy = Type::getInt8PtrTy(GEP->getContext(), in splitGEP()
1126 GEP->getPointerAddressSpace()); in splitGEP()
1127 NewGEP = new BitCastInst(NewGEP, I8PtrTy, "", GEP); in splitGEP()
1129 Type::getInt8Ty(GEP->getContext()), NewGEP, in splitGEP()
1131 GEP); in splitGEP()
1132 NewGEP->copyMetadata(*GEP); in splitGEP()
1135 if (GEP->getType() != I8PtrTy) in splitGEP()
1136 NewGEP = new BitCastInst(NewGEP, GEP->getType(), GEP->getName(), GEP); in splitGEP()
1139 GEP->replaceAllUsesWith(NewGEP); in splitGEP()
1140 GEP->eraseFromParent(); in splitGEP()
1170 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(&I)) in run() local
1171 Changed |= splitGEP(GEP); in run()