Home
last modified time | relevance | path

Searched refs:GEP (Results 1 – 25 of 142) sorted by relevance

123456

/freebsd/contrib/llvm-project/llvm/lib/Target/BPF/
H A DBPFPreserveStaticOffset.cpp210 GEPChainInfo &GEP, T *Insn) { in fillCommonArgs() argument
215 Args.push_back(GEP.Members[0]->getPointerOperand()); in fillCommonArgs()
220 Args.push_back(ConstantInt::get(Int1Ty, GEP.InBounds)); in fillCommonArgs()
221 Args.append(GEP.Indices.begin(), GEP.Indices.end()); in fillCommonArgs()
224 static Instruction *makeGEPAndLoad(Module *M, GEPChainInfo &GEP, in makeGEPAndLoad() argument
227 fillCommonArgs(M->getContext(), Args, GEP, Load); in makeGEPAndLoad()
230 setParamElementType(Call, 0, GEP.SourceElementType); in makeGEPAndLoad()
231 Call->applyMergedLocation(mergeDILocations(GEP.Members), Load->getDebugLoc()); in makeGEPAndLoad()
232 Call->setName((*GEP.Members.rbegin())->getName()); in makeGEPAndLoad()
244 static Instruction *makeGEPAndStore(Module *M, GEPChainInfo &GEP, in makeGEPAndStore() argument
[all …]
H A DBPFASpaceCastSimplifyPass.cpp30 auto *GEP = dyn_cast<GetElementPtrInst>(OuterCast->getPointerOperand()); in match() local
31 if (!GEP) in match()
33 auto *InnerCast = dyn_cast<AddrSpaceCastInst>(GEP->getPointerOperand()); in match()
52 auto *GEP = cast<GetElementPtrInst>(OuterCast->getPointerOperand()); in rewrite() local
53 auto *InnerCast = cast<AddrSpaceCastInst>(GEP->getPointerOperand()); in rewrite()
55 auto *NewGEP = cast<GetElementPtrInst>(GEP->clone()); in rewrite()
56 NewGEP->setName(GEP->getName()); in rewrite()
59 auto *GEPTy = cast<PointerType>(GEP->getType()); in rewrite()
63 if (GEP->use_empty()) in rewrite()
64 GEP->eraseFromParent(); in rewrite()
H A DBPFCheckAndAdjustIR.cpp372 auto [GEP, Load] = BPFPreserveStaticOffsetPass::reconstructLoad(Call); in unrollGEPLoad()
373 GEP->insertBefore(Call); in unrollGEPLoad()
380 auto [GEP, Store] = BPFPreserveStaticOffsetPass::reconstructStore(Call); in unrollGEPStore()
381 GEP->insertBefore(Call); in unrollGEPStore()
437 if (auto *GEP = dyn_cast<GetElementPtrInst>(ToWrap)) { in aspaceWrapValue() local
438 Value *Ptr = GEP->getPointerOperand(); in aspaceWrapValue()
440 auto *GEPTy = cast<PointerType>(GEP->getType()); in aspaceWrapValue()
441 auto *NewGEP = GEP->clone(); in aspaceWrapValue()
442 NewGEP->insertAfter(GEP); in aspaceWrapValue()
444 NewGEP->setOperand(GEP->getPointerOperandIndex(), WrappedPtr); in aspaceWrapValue()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Transforms/Scalar/
H A DSeparateConstOffsetFromGEP.cpp238 static Value *Extract(Value *Idx, GetElementPtrInst *GEP,
244 static int64_t Find(Value *Idx, GetElementPtrInst *GEP);
392 bool splitGEP(GetElementPtrInst *GEP);
397 bool reorderGEP(GetElementPtrInst *GEP, TargetTransformInfo &TTI);
424 int64_t accumulateByteOffset(GetElementPtrInst *GEP, bool &NeedsExtraction);
441 bool canonicalizeArrayIndicesToIndexSize(GetElementPtrInst *GEP);
781 Value *ConstantOffsetExtractor::Extract(Value *Idx, GetElementPtrInst *GEP, in Extract() argument
783 ConstantOffsetExtractor Extractor(GEP->getIterator()); in Extract()
787 GEP->isInBounds()); in Extract()
798 int64_t ConstantOffsetExtractor::Find(Value *Idx, GetElementPtrInst *GEP) { in Find() argument
[all …]
H A DNaryReassociate.cpp328 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()
[all …]
H A DStraightLineStrengthReduce.cpp138 GEP, // &B[..][i * S][..] enumerator
213 void allocateCandidatesAndFindBasisForGEP(GetElementPtrInst *GEP);
234 GetElementPtrInst *GEP);
281 static bool isGEPFoldable(GetElementPtrInst *GEP, in isGEPFoldable() argument
283 SmallVector<const Value *, 4> Indices(GEP->indices()); in isGEPFoldable()
284 return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(), in isGEPFoldable()
302 if (C.CandidateKind == Candidate::GEP) in isFoldable()
308 static bool hasOnlyOneNonZeroIndex(GetElementPtrInst *GEP) { in hasOnlyOneNonZeroIndex() argument
310 for (Use &Idx : GEP->indices()) { in hasOnlyOneNonZeroIndex()
327 if (C.CandidateKind == Candidate::GEP) { in isSimplestForm()
[all …]
H A DMergeICmps.cpp76 BCEAtom(GetElementPtrInst *GEP, LoadInst *LoadI, int BaseId, APInt Offset) in BCEAtom()
77 : GEP(GEP), LoadI(LoadI), BaseId(BaseId), Offset(std::move(Offset)) {} in BCEAtom()
86 GEP = that.GEP; in operator =()
107 GetElementPtrInst *GEP = nullptr; member
164 auto *GEP = dyn_cast<GetElementPtrInst>(Addr); in visitICmpLoadOperand() local
165 if (GEP) { in visitICmpLoadOperand()
167 if (GEP->isUsedOutsideOfBlock(LoadI->getParent())) { in visitICmpLoadOperand()
171 if (!GEP->accumulateConstantOffset(DL, Offset)) in visitICmpLoadOperand()
173 Base = GEP->getPointerOperand(); in visitICmpLoadOperand()
175 return BCEAtom(GEP, LoadI, BaseId.getBaseId(Base), Offset); in visitICmpLoadOperand()
[all …]
H A DJumpTableToSwitch.cpp45 static std::optional<JumpTableTy> parseJumpTable(GetElementPtrInst *GEP, in parseJumpTable() argument
47 Constant *Ptr = dyn_cast<Constant>(GEP->getPointerOperand()); in parseJumpTable()
55 Function &F = *GEP->getParent()->getParent(); in parseJumpTable()
58 DL.getIndexSizeInBits(GEP->getPointerAddressSpace()); in parseJumpTable()
61 if (!GEP->collectOffset(DL, BitWidth, VariableOffsets, ConstantOffset)) in parseJumpTable()
165 auto *GEP = dyn_cast<GetElementPtrInst>(L->getPointerOperand()); in run() local
166 if (!GEP) in run()
170 std::optional<JumpTableTy> JumpTable = parseJumpTable(GEP, PtrTy); in run()
H A DLoopFlatten.cpp662 auto CheckGEP = [&](GetElementPtrInst *GEP, Value *GEPOperand) { in checkOverflow() argument
663 for (Value *GEPUser : GEP->users()) { in checkOverflow()
666 !(isa<StoreInst>(GEPUserInst) && GEP == GEPUserInst->getOperand(1))) in checkOverflow()
674 if (GEP->isInBounds() && in checkOverflow()
676 DL.getPointerTypeSizeInBits(GEP->getType())) { in checkOverflow()
679 GEP->dump()); in checkOverflow()
689 if (auto *GEP = dyn_cast<GetElementPtrInst>(V)) in checkOverflow() local
690 if (GEP->getNumIndices() == 1 && CheckGEP(GEP, GEP->getOperand(1))) in checkOverflow()
693 if (auto *GEP = dyn_cast<GetElementPtrInst>(U)) in checkOverflow() local
694 if (CheckGEP(GEP, V)) in checkOverflow()
[all …]
/freebsd/contrib/llvm-project/llvm/include/llvm/IR/
H A DGetElementPtrTypeIterator.h34 // We use two different mechanisms to store the type a GEP index applies to.
53 // Iterating over the indices of this GEP, CurTy will contain the following in end()
55 // * i32 10: The outer index always operates on the GEP value type. in end()
60 // for arrays which is also used in the top level GEP index.
133 // the first element this is an unbounded array of the GEP's source element
149 // For sequential GEP indices (all except those into structs), the index value in gep_type_begin()
173 inline gep_type_iterator gep_type_begin(const User *GEP) {
174 auto *GEPOp = cast<GEPOperator>(GEP);
177 GEP->op_begin() + 1);
180 inline gep_type_iterator gep_type_end(const User *GEP) {
123 gep_type_begin(const User * GEP) gep_type_begin() argument
130 gep_type_end(const User * GEP) gep_type_end() argument
134 gep_type_begin(const User & GEP) gep_type_begin() argument
141 gep_type_end(const User & GEP) gep_type_end() argument
[all...]
/freebsd/contrib/llvm-project/llvm/lib/Transforms/Utils/
H A DRelLookupTableConverter.cpp36 GetElementPtrInst *GEP = in shouldConvertToRelLookupTable() local
38 if (!GEP || !GEP->hasOneUse() || in shouldConvertToRelLookupTable()
39 GV.getValueType() != GEP->getSourceElementType()) in shouldConvertToRelLookupTable()
42 LoadInst *Load = dyn_cast<LoadInst>(GEP->use_begin()->getUser()); in shouldConvertToRelLookupTable()
44 Load->getType() != GEP->getResultElementType()) in shouldConvertToRelLookupTable()
131 GetElementPtrInst *GEP = in convertToRelLookupTable() local
133 LoadInst *Load = cast<LoadInst>(GEP->use_begin()->getUser()); in convertToRelLookupTable()
136 BasicBlock *BB = GEP->getParent(); in convertToRelLookupTable()
144 Builder.SetInsertPoint(GEP); in convertToRelLookupTable()
145 Value *Index = GEP->getOperand(2); in convertToRelLookupTable()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Analysis/
H A DLocal.cpp23 User *GEP, bool NoAssumptions) { in emitGEPOffset() argument
24 GEPOperator *GEPOp = cast<GEPOperator>(GEP); in emitGEPOffset()
25 Type *IntIdxTy = DL.getIndexType(GEP->getType()); in emitGEPOffset()
33 Result = Builder->CreateAdd(Result, Offset, GEP->getName() + ".offs", in emitGEPOffset()
39 gep_type_iterator GTI = gep_type_begin(GEP); in emitGEPOffset()
40 for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); i != e; in emitGEPOffset()
74 Op = Builder->CreateMul(Op, Scale, GEP->getName() + ".idx", NUW, NSW); in emitGEPOffset()
H A DPHITransAddr.cpp201 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in translateSubExpr() local
204 for (Value *Op : GEP->operands()) { in translateSubExpr()
213 return GEP; in translateSubExpr()
216 if (Value *V = simplifyGEPInst(GEP->getSourceElementType(), GEPOps[0], in translateSubExpr()
218 GEP->getNoWrapFlags(), {DL, TLI, DT, AC})) { in translateSubExpr()
229 if (GEPI->getType() == GEP->getType() && in translateSubExpr()
230 GEPI->getSourceElementType() == GEP->getSourceElementType() && in translateSubExpr()
380 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in insertTranslatedSubExpr() local
382 BasicBlock *CurBB = GEP->getParent(); in insertTranslatedSubExpr()
383 for (Value *Op : GEP->operands()) { in insertTranslatedSubExpr()
[all …]
H A DTypeMetadataUtils.cpp61 } else if (auto GEP = dyn_cast<GetElementPtrInst>(User)) { in findLoadCallsAtConstantOffset() local
63 if (VPtr == GEP->getPointerOperand() && GEP->hasAllConstantIndices()) { in findLoadCallsAtConstantOffset()
64 SmallVector<Value *, 8> Indices(drop_begin(GEP->operands())); in findLoadCallsAtConstantOffset()
66 GEP->getSourceElementType(), Indices); in findLoadCallsAtConstantOffset()
/freebsd/contrib/llvm-project/llvm/lib/Transforms/IPO/
H A DGlobalSplit.cpp58 GEPOperator *GEP; in splitGlobal() member
62 GEPInfo(GEPOperator *GEP, unsigned MemberIndex, APInt MemberRelativeOffset) in splitGlobal()
63 : GEP(GEP), MemberIndex(MemberIndex), in splitGlobal()
68 auto *GEP = dyn_cast<GEPOperator>(U); in splitGlobal() local
69 if (!GEP) in splitGlobal()
72 std::optional<ConstantRange> InRange = GEP->getInRange(); in splitGlobal()
77 if (!GEP->accumulateConstantOffset(DL, Offset)) in splitGlobal()
104 Infos.emplace_back(GEP, MemberIndex, Offset - MemberStart); in splitGlobal()
160 Info.GEP->isInBounds()); in splitGlobal()
161 Info.GEP->replaceAllUsesWith(NewGEP); in splitGlobal()
/freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/
H A DRISCVGatherScatterLowering.cpp342 auto *GEP = dyn_cast<GetElementPtrInst>(Ptr); in determineBaseAndStride() local
343 if (!GEP) in determineBaseAndStride()
346 auto I = StridedAddrs.find(GEP); in determineBaseAndStride()
350 SmallVector<Value *, 2> Ops(GEP->operands()); in determineBaseAndStride()
353 Value *Base = GEP->getPointerOperand(); in determineBaseAndStride()
358 if (all_of(GEP->indices(), IsScalar)) { in determineBaseAndStride()
361 Builder.SetInsertPoint(GEP); in determineBaseAndStride()
362 SmallVector<Value *> Indices(GEP->indices()); in determineBaseAndStride()
364 Builder.CreateGEP(GEP->getSourceElementType(), BaseBase, Indices, in determineBaseAndStride()
365 GEP->getName() + "offset", GEP->isInBounds()); in determineBaseAndStride()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Target/ARM/
H A DMVEGatherScatterLowering.cpp96 GetElementPtrInst *GEP, IRBuilder<> &Builder);
148 Value *foldGEP(GetElementPtrInst *GEP, Value *&Offsets, unsigned &Scale,
231 if (auto *GEP = dyn_cast<GetElementPtrInst>(Ptr)) { in decomposePtr() local
232 if (Value *V = decomposeGEP(Offsets, Ty, GEP, Builder)) { in decomposePtr()
234 computeScale(GEP->getSourceElementType()->getPrimitiveSizeInBits(), in decomposePtr()
256 GetElementPtrInst *GEP, in decomposeGEP() argument
258 if (!GEP) { in decomposeGEP()
265 Value *GEPPtr = GEP->getPointerOperand(); in decomposeGEP()
266 Offsets = GEP->getOperand(1); in decomposeGEP()
271 if (GEP->getNumOperands() != 2) { in decomposeGEP()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Transforms/InstCombine/
H A DInstructionCombining.cpp193 Value *InstCombinerImpl::EmitGEPOffset(GEPOperator *GEP, bool RewriteGEP) { in EmitGEPOffset() argument
195 return llvm::emitGEPOffset(&Builder, DL, GEP); in EmitGEPOffset()
198 auto *Inst = dyn_cast<Instruction>(GEP); in EmitGEPOffset()
202 Value *Offset = EmitGEPOffset(GEP); in EmitGEPOffset()
205 if (Inst && !GEP->hasOneUse() && !GEP->hasAllConstantIndices() && in EmitGEPOffset()
206 !GEP->getSourceElementType()->isIntegerTy(8)) { in EmitGEPOffset()
208 *Inst, Builder.CreateGEP(Builder.getInt8Ty(), GEP->getPointerOperand(), in EmitGEPOffset()
209 Offset, "", GEP->getNoWrapFlags())); in EmitGEPOffset()
2001 static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { in shouldMergeGEPs() argument
2005 if (GEP.hasAllZeroIndices() && !Src.hasAllZeroIndices() && in shouldMergeGEPs()
[all …]
/freebsd/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar/
H A DNaryReassociate.h120 Instruction *tryReassociateGEP(GetElementPtrInst *GEP);
129 GetElementPtrInst *tryReassociateGEPAtIndex(GetElementPtrInst *GEP,
134 GetElementPtrInst *tryReassociateGEPAtIndex(GetElementPtrInst *GEP,
178 bool requiresSignExtension(Value *Index, GetElementPtrInst *GEP);
/freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/
H A DAMDGPUPerfHintAnalysis.cpp163 if (auto GEP = dyn_cast<GetElementPtrInst>(V)) { in isIndirectAccess() local
164 auto P = GEP->getPointerOperand(); in isIndirectAccess()
166 for (unsigned I = 1, E = GEP->getNumIndices() + 1; I != E; ++I) in isIndirectAccess()
167 WorkSet.insert(GEP->getOperand(I)); in isIndirectAccess()
258 } else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) { in visit() local
260 auto *Ptr = GetPointerBaseWithConstantOffset(GEP, AM.BaseOffs, *DL); in visit()
263 if (TLI->isLegalAddressingMode(*DL, AM, GEP->getResultElementType(), in visit()
264 GEP->getPointerAddressSpace())) in visit()
H A DAMDGPULowerModuleLDSPass.cpp894 auto GEP = ConstantExpr::getGetElementPtr( in lowerDynamicLDSVariables() local
896 newDynamicLDS.push_back(ConstantExpr::getPtrToInt(GEP, I32)); in lowerDynamicLDSVariables()
1245 Constant *GEP = ConstantExpr::getGetElementPtr(LDSTy, SGV, GEPIdx, true); in createLDSVariableReplacement() local
1250 Map[GV] = GEP; in createLDSVariableReplacement()
1290 Constant *GEP = Replacement.LDSVarsToConstantGEP.at(GV); in replaceLDSVariablesWithStruct() local
1292 GV->replaceUsesWithIf(GEP, Predicate); in replaceLDSVariablesWithStruct()
1294 APInt APOff(DL.getIndexTypeSizeInBits(GEP->getType()), 0); in replaceLDSVariablesWithStruct()
1295 GEP->stripAndAccumulateInBoundsConstantOffsets(DL, APOff); in replaceLDSVariablesWithStruct()
1308 refineUsesAlignmentAndAA(GEP, A, DL, AliasScope, NoAlias); in replaceLDSVariablesWithStruct()
1353 if (auto *GEP = dyn_cast<GetElementPtrInst>(U)) { in refineUsesAlignmentAndAA() local
[all …]
/freebsd/contrib/llvm-project/llvm/lib/IR/
H A DTypeFinder.cpp79 if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) in run() local
80 incorporateType(GEP->getSourceElementType()); in run()
174 if (auto *GEP = dyn_cast<GEPOperator>(V)) in incorporateValue() local
175 incorporateType(GEP->getSourceElementType()); in incorporateValue()
H A DValue.cpp635 if (auto *GEP = dyn_cast<GEPOperator>(V)) { in stripPointerCastsAndOffsets() local
641 if (!GEP->hasAllZeroIndices()) in stripPointerCastsAndOffsets()
645 if (!GEP->hasAllConstantIndices()) in stripPointerCastsAndOffsets()
649 if (!GEP->isInBounds()) in stripPointerCastsAndOffsets()
653 V = GEP->getPointerOperand(); in stripPointerCastsAndOffsets()
731 if (auto *GEP = dyn_cast<GEPOperator>(V)) { in stripAndAccumulateConstantOffsets() local
733 if (!AllowNonInbounds && !GEP->isInBounds()) in stripAndAccumulateConstantOffsets()
743 if (!GEP->accumulateConstantOffset(DL, GEPOffset, ExternalAnalysis)) in stripAndAccumulateConstantOffsets()
766 V = GEP->getPointerOperand(); in stripAndAccumulateConstantOffsets()
996 getOffsetFromIndex(const GEPOperator *GEP, unsigned Idx, const DataLayout &DL) { in getOffsetFromIndex() argument
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Target/DirectX/
H A DDXILPrepare.cpp224 if (auto GEP = dyn_cast<GetElementPtrInst>(&I)) { in runOnModule() local
226 Builder, PointerTypes, I, GEP->getPointerOperand(), in runOnModule()
227 GEP->getSourceElementType())) in runOnModule()
228 GEP->setOperand(0, NoOpBitcast); in runOnModule()
/freebsd/contrib/llvm-project/llvm/lib/Target/NVPTX/
H A DNVPTXLowerArgs.cpp236 if (auto *GEP = dyn_cast<GetElementPtrInst>(I.OldInstruction)) { in INITIALIZE_PASS_DEPENDENCY() local
237 SmallVector<Value *, 4> Indices(GEP->indices()); in INITIALIZE_PASS_DEPENDENCY()
239 GEP->getSourceElementType(), I.NewParam, Indices, GEP->getName(), in INITIALIZE_PASS_DEPENDENCY()
240 GEP->getIterator()); in INITIALIZE_PASS_DEPENDENCY()
241 NewGEP->setIsInBounds(GEP->isInBounds()); in INITIALIZE_PASS_DEPENDENCY()

123456