Home
last modified time | relevance | path

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

1234567

/freebsd/contrib/llvm-project/llvm/lib/Target/BPF/
H A DBPFPreserveStaticOffset.cpp208 GEPChainInfo &GEP, T *Insn) { in fillCommonArgs() argument
213 Args.push_back(GEP.Members[0]->getPointerOperand()); in fillCommonArgs()
218 Args.push_back(ConstantInt::get(Int1Ty, GEP.InBounds)); in fillCommonArgs()
219 Args.append(GEP.Indices.begin(), GEP.Indices.end()); in fillCommonArgs()
222 static Instruction *makeGEPAndLoad(Module *M, GEPChainInfo &GEP, in makeGEPAndLoad() argument
225 fillCommonArgs(M->getContext(), Args, GEP, Load); in makeGEPAndLoad()
228 setParamElementType(Call, 0, GEP.SourceElementType); in makeGEPAndLoad()
229 Call->applyMergedLocation(mergeDebugLocs(GEP.Members), Load->getDebugLoc()); in makeGEPAndLoad()
230 Call->setName((*GEP.Members.rbegin())->getName()); in makeGEPAndLoad()
242 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.cpp369 auto [GEP, Load] = BPFPreserveStaticOffsetPass::reconstructLoad(Call); in unrollGEPLoad()
370 GEP->insertBefore(Call->getIterator()); in unrollGEPLoad()
377 auto [GEP, Store] = BPFPreserveStaticOffsetPass::reconstructStore(Call); in unrollGEPStore()
378 GEP->insertBefore(Call->getIterator()); in unrollGEPStore()
434 if (auto *GEP = dyn_cast<GetElementPtrInst>(ToWrap)) { in aspaceWrapValue() local
435 Value *Ptr = GEP->getPointerOperand(); in aspaceWrapValue()
437 auto *GEPTy = cast<PointerType>(GEP->getType()); in aspaceWrapValue()
438 auto *NewGEP = GEP->clone(); in aspaceWrapValue()
439 NewGEP->insertAfter(GEP->getIterator()); in aspaceWrapValue()
441 NewGEP->setOperand(GEP->getPointerOperandIndex(), WrappedPtr); in aspaceWrapValue()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Transforms/Scalar/
H A DSeparateConstOffsetFromGEP.cpp240 static Value *Extract(Value *Idx, GetElementPtrInst *GEP,
246 static int64_t Find(Value *Idx, GetElementPtrInst *GEP);
394 bool splitGEP(GetElementPtrInst *GEP);
399 bool reorderGEP(GetElementPtrInst *GEP, TargetTransformInfo &TTI);
426 int64_t accumulateByteOffset(GetElementPtrInst *GEP, bool &NeedsExtraction);
443 bool canonicalizeArrayIndicesToIndexSize(GetElementPtrInst *GEP);
806 Value *ConstantOffsetExtractor::Extract(Value *Idx, GetElementPtrInst *GEP, in Extract() argument
809 ConstantOffsetExtractor Extractor(GEP->getIterator()); in Extract()
813 GEP->isInBounds()); in Extract()
828 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.cpp142 GEP, // &B[..][i * S][..] enumerator
217 void allocateCandidatesAndFindBasisForGEP(GetElementPtrInst *GEP);
238 GetElementPtrInst *GEP);
285 static bool isGEPFoldable(GetElementPtrInst *GEP, in isGEPFoldable() argument
287 SmallVector<const Value *, 4> Indices(GEP->indices()); in isGEPFoldable()
288 return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(), in isGEPFoldable()
306 if (C.CandidateKind == Candidate::GEP) in isFoldable()
312 static bool hasOnlyOneNonZeroIndex(GetElementPtrInst *GEP) { in hasOnlyOneNonZeroIndex() argument
314 for (Use &Idx : GEP->indices()) { in hasOnlyOneNonZeroIndex()
331 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/Target/DirectX/
H A DDXILFlattenArrays.cpp215 bool DXILFlattenArraysVisitor::visitGetElementPtrInst(GetElementPtrInst &GEP) { in visitGetElementPtrInst() argument
217 if (GEPChainInfoMap.contains(cast<GEPOperator>(&GEP))) in visitGetElementPtrInst()
220 Value *PtrOperand = GEP.getPointerOperand(); in visitGetElementPtrInst()
233 OldGEPI->insertBefore(GEP.getIterator()); in visitGetElementPtrInst()
235 IRBuilder<> Builder(&GEP); in visitGetElementPtrInst()
236 SmallVector<Value *> Indices(GEP.indices()); in visitGetElementPtrInst()
238 Builder.CreateGEP(GEP.getSourceElementType(), OldGEPI, Indices, in visitGetElementPtrInst()
239 GEP.getName(), GEP.getNoWrapFlags()); in visitGetElementPtrInst()
244 GEP.replaceAllUsesWith(NewGEPI); in visitGetElementPtrInst()
245 GEP.eraseFromParent(); in visitGetElementPtrInst()
[all …]
H A DDXILLegalizePass.cpp99 if (auto *GEP = dyn_cast<GetElementPtrInst>(NewOperands[0])) { in fixI8UseChain() local
100 ElementType = GEP->getSourceElementType(); in fixI8UseChain()
115 auto *GEP = dyn_cast<GEPOperator>(CE); in fixI8UseChain() local
116 if (!GEP->getSourceElementType()->isIntegerTy(8)) in fixI8UseChain()
120 ConstantInt *Offset = dyn_cast<ConstantInt>(GEP->getOperand(1)); in fixI8UseChain()
125 Value *PtrOperand = GEP->getPointerOperand(); in fixI8UseChain()
126 Type *GEPType = GEP->getPointerOperandType(); in fixI8UseChain()
140 GEP->getName(), GEP->getNoWrapFlags()); in fixI8UseChain()
213 if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) { in fixI8UseChain() local
214 if (!GEP->getType()->isPointerTy() || in fixI8UseChain()
[all …]
H A DDXILResourceAccess.cpp24 static Value *calculateGEPOffset(GetElementPtrInst *GEP, Value *PrevOffset, in calculateGEPOffset() argument
28 const DataLayout &DL = GEP->getDataLayout(); in calculateGEPOffset()
39 APInt ConstantOffset(DL.getIndexTypeSizeInBits(GEP->getType()), 0); in calculateGEPOffset()
40 if (GEP->accumulateConstantOffset(DL, ConstantOffset)) { in calculateGEPOffset()
42 return ConstantInt::get(Type::getInt32Ty(GEP->getContext()), Scaled); in calculateGEPOffset()
45 auto IndexIt = GEP->idx_begin(); in calculateGEPOffset()
50 assert(++IndexIt == GEP->idx_end() && "Too many indices in GEP"); in calculateGEPOffset()
216 if (auto *GEP = dyn_cast<GetElementPtrInst>(Current.Access)) { in replaceAccess() local
217 IRBuilder<> Builder(GEP); in replaceAccess()
219 Value *Offset = calculateGEPOffset(GEP, Current.Offset, RTI); in replaceAccess()
[all …]
H A DDXILCBufferAccess.cpp88 if (auto *GEP = dyn_cast<GEPOperator>(Val)) { in getOffsetForCBufferGEP() local
91 assert(GEP->getPointerOperand() == Member && in getOffsetForCBufferGEP()
95 APInt ConstantOffset(DL.getIndexTypeSizeInBits(GEP->getType()), 0); in getOffsetForCBufferGEP()
96 bool Success = GEP->accumulateConstantOffset(DL, ConstantOffset); in getOffsetForCBufferGEP()
224 Value *GEP = in copyArrayElemsForMemCpy() local
227 Builder.CreateStore(CBufferVal, GEP, MCI->isVolatile()); in copyArrayElemsForMemCpy()
/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()
232 if (GEPI->getType() == GEP->getType() && in translateSubExpr()
233 GEPI->getSourceElementType() == GEP->getSourceElementType() && in translateSubExpr()
383 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in insertTranslatedSubExpr() local
385 BasicBlock *CurBB = GEP->getParent(); in insertTranslatedSubExpr()
386 for (Value *Op : GEP->operands()) { in insertTranslatedSubExpr()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Transforms/IPO/
H A DGlobalSplit.cpp57 GEPOperator *GEP; in splitGlobal() member
61 GEPInfo(GEPOperator *GEP, unsigned MemberIndex, APInt MemberRelativeOffset) in splitGlobal()
62 : GEP(GEP), MemberIndex(MemberIndex), in splitGlobal()
67 auto *GEP = dyn_cast<GEPOperator>(U); in splitGlobal() local
68 if (!GEP) in splitGlobal()
71 std::optional<ConstantRange> InRange = GEP->getInRange(); in splitGlobal()
76 if (!GEP->accumulateConstantOffset(DL, Offset)) in splitGlobal()
103 Infos.emplace_back(GEP, MemberIndex, Offset - MemberStart); in splitGlobal()
159 Info.GEP->isInBounds()); in splitGlobal()
160 Info.GEP->replaceAllUsesWith(NewGEP); in splitGlobal()
/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()
152 GetElementPtrInst *GEP = in convertToRelLookupTable() local
154 LoadInst *Load = cast<LoadInst>(GEP->use_begin()->getUser()); in convertToRelLookupTable()
157 BasicBlock *BB = GEP->getParent(); in convertToRelLookupTable()
165 Builder.SetInsertPoint(GEP); in convertToRelLookupTable()
166 Value *Index = GEP->getOperand(2); in convertToRelLookupTable()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/
H A DRISCVGatherScatterLowering.cpp351 auto *GEP = dyn_cast<GetElementPtrInst>(Ptr); in determineBaseAndStride() local
352 if (!GEP) in determineBaseAndStride()
355 auto I = StridedAddrs.find(GEP); in determineBaseAndStride()
359 SmallVector<Value *, 2> Ops(GEP->operands()); in determineBaseAndStride()
362 Value *Base = GEP->getPointerOperand(); in determineBaseAndStride()
367 if (all_of(GEP->indices(), IsScalar)) { in determineBaseAndStride()
370 Builder.SetInsertPoint(GEP); in determineBaseAndStride()
371 SmallVector<Value *> Indices(GEP->indices()); in determineBaseAndStride()
373 Builder.CreateGEP(GEP->getSourceElementType(), BaseBase, Indices, in determineBaseAndStride()
374 GEP->getName() + "offset", GEP->isInBounds()); in determineBaseAndStride()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Target/ARM/
H A DMVEGatherScatterLowering.cpp95 GetElementPtrInst *GEP, IRBuilder<> &Builder);
147 Value *foldGEP(GetElementPtrInst *GEP, Value *&Offsets, unsigned &Scale,
230 if (auto *GEP = dyn_cast<GetElementPtrInst>(Ptr)) { in decomposePtr() local
231 if (Value *V = decomposeGEP(Offsets, Ty, GEP, Builder)) { in decomposePtr()
233 computeScale(GEP->getSourceElementType()->getPrimitiveSizeInBits(), in decomposePtr()
255 GetElementPtrInst *GEP, in decomposeGEP() argument
257 if (!GEP) { in decomposeGEP()
264 Value *GEPPtr = GEP->getPointerOperand(); in decomposeGEP()
265 Offsets = GEP->getOperand(1); in decomposeGEP()
270 if (GEP->getNumOperands() != 2) { in decomposeGEP()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Transforms/InstCombine/
H A DInstructionCombining.cpp198 Value *InstCombinerImpl::EmitGEPOffset(GEPOperator *GEP, bool RewriteGEP) { in EmitGEPOffset() argument
200 return llvm::emitGEPOffset(&Builder, DL, GEP); in EmitGEPOffset()
203 auto *Inst = dyn_cast<Instruction>(GEP); in EmitGEPOffset()
207 Value *Offset = EmitGEPOffset(GEP); in EmitGEPOffset()
209 if (Inst && !GEP->hasAllConstantIndices() && in EmitGEPOffset()
210 !GEP->getSourceElementType()->isIntegerTy(8)) { in EmitGEPOffset()
212 *Inst, Builder.CreateGEP(Builder.getInt8Ty(), GEP->getPointerOperand(), in EmitGEPOffset()
213 Offset, "", GEP->getNoWrapFlags())); in EmitGEPOffset()
223 for (GEPOperator *GEP : reverse(GEPs)) { in EmitGEPOffsets()
224 Value *Offset = EmitGEPOffset(GEP, RewriteGEPs); in EmitGEPOffsets()
[all …]
H A DInstCombineLoadStoreAlloca.cpp87 if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) { in isOnlyCopiedFromConstantMemory() local
90 Worklist.emplace_back(I, IsOffset || !GEP->hasAllZeroIndices()); in isOnlyCopiedFromConstantMemory()
327 } else if (auto *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in collectUsers() local
328 UsersToReplace.insert(GEP); in collectUsers()
329 PushUsersToWorklist(GEP); in collectUsers()
413 } else if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) { in replace() local
414 auto *V = getReplacement(GEP->getPointerOperand()); in replace()
416 SmallVector<Value *, 8> Indices(GEP->indices()); in replace()
418 GetElementPtrInst::Create(GEP->getSourceElementType(), V, Indices); in replace()
419 IC.InsertNewInstWith(NewI, GEP->getIterator()); in replace()
[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.cpp160 if (const auto *GEP = dyn_cast<GetElementPtrInst>(V)) { in isIndirectAccess() local
161 const auto *P = GEP->getPointerOperand(); in isIndirectAccess()
163 for (unsigned I = 1, E = GEP->getNumIndices() + 1; I != E; ++I) in isIndirectAccess()
164 WorkSet.insert(GEP->getOperand(I)); in isIndirectAccess()
255 } else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) { in visit() local
257 auto *Ptr = GetPointerBaseWithConstantOffset(GEP, AM.BaseOffs, *DL); in visit()
260 if (TLI->isLegalAddressingMode(*DL, AM, GEP->getResultElementType(), in visit()
261 GEP->getPointerAddressSpace())) in visit()
/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()

1234567