Home
last modified time | relevance | path

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

12345678910>>...18

/llvm-project-15.0.7/llvm/lib/Transforms/Scalar/
H A DSeparateConstOffsetFromGEP.cpp790 GEP->isInBounds()) in Find()
795 GetElementPtrInst *GEP) { in canonicalizeArrayIndicesToPointerSize() argument
799 for (User::op_iterator I = GEP->op_begin() + 1, E = GEP->op_end(); in canonicalizeArrayIndicesToPointerSize()
822 ConstantOffsetExtractor::Find(GEP->getOperand(I), GEP, DT); in accumulateByteOffset()
1046 GEP->setIsInBounds(false); in splitGEP()
1092 NewGEP->insertBefore(GEP); in splitGEP()
1106 GEP->getName(), GEP); in splitGEP()
1107 NewGEP->copyMetadata(*GEP); in splitGEP()
1131 GEP); in splitGEP()
1136 NewGEP = new BitCastInst(NewGEP, GEP->getType(), GEP->getName(), GEP); in splitGEP()
[all …]
H A DNaryReassociate.cpp328 static bool isGEPFoldable(GetElementPtrInst *GEP, in isGEPFoldable() argument
331 return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(), in isGEPFoldable()
337 if (isGEPFoldable(GEP, TTI)) in tryReassociateGEP()
340 gep_type_iterator GTI = gep_type_begin(*GEP); in tryReassociateGEP()
362 Value *IndexToSplit = GEP->getOperand(I + 1); in tryReassociateGEPAtIndex()
401 for (Use &Index : GEP->indices()) in tryReassociateGEPAtIndex()
422 IRBuilder<> Builder(GEP); in tryReassociateGEPAtIndex()
427 assert(Candidate->getType() == GEP->getType()); in tryReassociateGEPAtIndex()
431 Type *ElementType = GEP->getResultElementType(); in tryReassociateGEPAtIndex()
460 NewGEP->setIsInBounds(GEP->isInBounds()); in tryReassociateGEPAtIndex()
[all …]
H A DStraightLineStrengthReduce.cpp138 GEP, // &B[..][i * S][..] enumerator
288 return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(), in isGEPFoldable()
306 if (C.CandidateKind == Candidate::GEP) in isFoldable()
314 for (Use &Idx : GEP->indices()) { in hasOnlyOneNonZeroIndex()
331 if (C.CandidateKind == Candidate::GEP) { in isSimplestForm()
500 ArrayIdx, ElementSize, GEP); in factorArrayIndex()
529 GetElementPtrInst *GEP) { in allocateCandidatesAndFindBasisForGEP() argument
531 if (GEP->getType()->isVectorTy()) in allocateCandidatesAndFindBasisForGEP()
535 for (Use &Idx : GEP->indices()) in allocateCandidatesAndFindBasisForGEP()
549 Value *ArrayIdx = GEP->getOperand(I); in allocateCandidatesAndFindBasisForGEP()
[all …]
H A DMergeICmps.cpp75 : GEP(GEP), LoadI(LoadI), BaseId(BaseId), Offset(Offset) {} in BCEAtom()
84 GEP = that.GEP; in operator =()
105 GetElementPtrInst *GEP = nullptr; member
163 if (GEP) { in visitICmpLoadOperand()
171 Base = GEP->getPointerOperand(); in visitICmpLoadOperand()
373 if (Result->Lhs.GEP) in visitCmpBlock()
374 BlockInsts.insert(Result->Lhs.GEP); in visitCmpBlock()
375 if (Result->Rhs.GEP) in visitCmpBlock()
376 BlockInsts.insert(Result->Rhs.GEP); in visitCmpBlock()
612 if (FirstCmp.Lhs().GEP) in mergeComparisons()
[all …]
H A DConstraintElimination.cpp200 auto *GEP = dyn_cast<GetElementPtrInst>(V); in decompose() local
201 if (GEP && GEP->getNumOperands() == 2 && GEP->isInBounds()) { in decompose()
206 if (match(GEP->getOperand(GEP->getNumOperands() - 1), in decompose()
211 {1, GEP->getPointerOperand()}, in decompose()
216 {1, GEP->getPointerOperand()}, in decompose()
221 if (match(GEP->getOperand(GEP->getNumOperands() - 1), m_ConstantInt(CI)) && in decompose()
226 if (match(GEP->getOperand(GEP->getNumOperands() - 1), in decompose()
230 {1, GEP->getPointerOperand()}, in decompose()
232 else if (match(GEP->getOperand(GEP->getNumOperands() - 1), in decompose()
236 {1, GEP->getPointerOperand()}, in decompose()
[all …]
/llvm-project-15.0.7/llvm/lib/Transforms/IPO/
H A DGlobalSplit.cpp60 auto *GEP = dyn_cast<GEPOperator>(U); in splitGlobal() local
61 if (!GEP || !GEP->getInRangeIndex() || *GEP->getInRangeIndex() != 1 || in splitGlobal()
62 !isa<ConstantInt>(GEP->getOperand(1)) || in splitGlobal()
63 !cast<ConstantInt>(GEP->getOperand(1))->isZero() || in splitGlobal()
64 !isa<ConstantInt>(GEP->getOperand(2))) in splitGlobal()
120 auto *GEP = cast<GEPOperator>(U); in splitGlobal() local
121 unsigned I = cast<ConstantInt>(GEP->getOperand(2))->getZExtValue(); in splitGlobal()
127 for (unsigned I = 3; I != GEP->getNumOperands(); ++I) in splitGlobal()
128 Ops.push_back(GEP->getOperand(I)); in splitGlobal()
132 GEP->isInBounds()); in splitGlobal()
[all …]
/llvm-project-15.0.7/llvm/include/llvm/IR/
H A DGetElementPtrTypeIterator.h123 inline gep_type_iterator gep_type_begin(const User *GEP) { in gep_type_begin() argument
124 auto *GEPOp = cast<GEPOperator>(GEP); in gep_type_begin()
127 GEP->op_begin() + 1); in gep_type_begin()
130 inline gep_type_iterator gep_type_end(const User *GEP) { in gep_type_end() argument
131 return gep_type_iterator::end(GEP->op_end()); in gep_type_end()
134 inline gep_type_iterator gep_type_begin(const User &GEP) { in gep_type_begin() argument
135 auto &GEPOp = cast<GEPOperator>(GEP); in gep_type_begin()
138 GEP.op_begin() + 1); in gep_type_begin()
141 inline gep_type_iterator gep_type_end(const User &GEP) { in gep_type_end() argument
142 return gep_type_iterator::end(GEP.op_end()); in gep_type_end()
/llvm-project-15.0.7/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 …]
/llvm-project-15.0.7/llvm/include/llvm/Analysis/Utils/
H A DLocal.h29 Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &DL, User *GEP,
31 GEPOperator *GEPOp = cast<GEPOperator>(GEP);
32 Type *IntIdxTy = DL.getIndexType(GEP->getType());
44 gep_type_iterator GTI = gep_type_begin(GEP);
45 for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); i != e;
86 GEP->getName().str() + ".idx", false /*NUW*/,
93 Result = Builder->CreateAdd(Result, Offset, GEP->getName().str()+".offs",
/llvm-project-15.0.7/llvm/test/Transforms/Inline/
H A Dret_attr_update.ll18 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[X:%.*]]
19 ; CHECK-NEXT: [[R_I:%.*]] = call nonnull i8* @foo(i8* noalias [[GEP]])
54 ; CHECK-NEXT: [[R_I:%.*]] = call i8* @foo(i8* [[GEP]])
57 ; CHECK-NEXT: [[R_I1:%.*]] = call i8* @bar(i8* [[GEP]])
114 ; CHECK-NEXT: [[R_I:%.*]] = call i8* @foo(i8* [[GEP]])
115 ; CHECK-NEXT: [[V_I:%.*]] = call i8* @inf_loop_call(i8* [[GEP]])
135 ; CHECK-NEXT: [[V_I:%.*]] = call i8* @baz(i8* [[GEP]])
157 ; CHECK-NEXT: [[V_I:%.*]] = call i8* @baz(i8* [[GEP]])
183 ; CHECK-NEXT: [[R_I:%.*]] = call nonnull i8* @foo(i8* noalias [[GEP]])
186 ; CHECK-NEXT: [[S_I:%.*]] = call nonnull i8* @baz(i8* [[GEP]])
[all …]
/llvm-project-15.0.7/llvm/docs/
H A DGetElementPtr.rst2 The Often Misunderstood GEP Instruction
27 What is the first index of the GEP instruction?
129 directly to the GEP instructions.
172 What is dereferenced by GEP?
209 Why don't GEP x,0,0,1 and GEP x,1 alias?
230 Why do GEP x,1,0,0 and GEP x,1 alias?
247 Can GEP index into vector elements?
272 Also, GEP carries additional pointer aliasing rules. It's invalid to take a GEP
278 And, GEP is more concise in common cases.
423 What happens if a GEP computation overflows?
[all …]
/llvm-project-15.0.7/llvm/lib/Transforms/InstCombine/
H A DInstructionCombining.cpp2134 return &GEP; in visitGEPOfGEP()
2138 Indices.append(GEP.op_begin()+2, GEP.op_end()); in visitGEPOfGEP()
2144 Indices.append(GEP.idx_begin()+1, GEP.idx_end()); in visitGEPOfGEP()
2234 return &GEP; in visitGEPOfBitcast()
2283 if (V != &GEP) in visitGetElementPtrInst()
2285 return &GEP; in visitGetElementPtrInst()
2303 for (User::op_iterator I = GEP.op_begin() + 1, E = GEP.op_end(); I != E; in visitGetElementPtrInst()
2334 return &GEP; in visitGetElementPtrInst()
2348 if (Op1 == &GEP) in visitGetElementPtrInst()
2553 GEP.getName(), GEP.isInBounds()); in visitGetElementPtrInst()
[all …]
/llvm-project-15.0.7/llvm/lib/Analysis/
H A DPHITransAddr.cpp214 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in PHITranslateSubExpr() local
217 for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i) { in PHITranslateSubExpr()
221 AnyChanged |= GEPOp != GEP->getOperand(i); in PHITranslateSubExpr()
226 return GEP; in PHITranslateSubExpr()
229 if (Value *V = simplifyGEPInst(GEP->getSourceElementType(), GEPOps[0], in PHITranslateSubExpr()
242 if (GEPI->getType() == GEP->getType() && in PHITranslateSubExpr()
398 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in InsertPHITranslatedSubExpr() local
400 BasicBlock *CurBB = GEP->getParent(); in InsertPHITranslatedSubExpr()
401 for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i) { in InsertPHITranslatedSubExpr()
402 Value *OpVal = InsertPHITranslatedSubExpr(GEP->getOperand(i), in InsertPHITranslatedSubExpr()
[all …]
/llvm-project-15.0.7/llvm/lib/Target/RISCV/
H A DRISCVGatherScatterLowering.cpp331 auto I = StridedAddrs.find(GEP); in determineBaseAndStride()
335 SmallVector<Value *, 2> Ops(GEP->operands()); in determineBaseAndStride()
342 Loop *L = LI->getLoopFor(GEP->getParent()); in determineBaseAndStride()
350 gep_type_iterator GTI = gep_type_begin(GEP); in determineBaseAndStride()
391 Builder.SetInsertPoint(GEP); in determineBaseAndStride()
395 Type *SourceTy = GEP->getSourceElementType(); in determineBaseAndStride()
412 StridedAddrs[GEP] = P; in determineBaseAndStride()
425 auto *GEP = dyn_cast<GetElementPtrInst>(Ptr); in tryCreateStridedLoadStore() local
426 if (!GEP) in tryCreateStridedLoadStore()
429 IRBuilder<> Builder(GEP); in tryCreateStridedLoadStore()
[all …]
/llvm-project-15.0.7/llvm/test/Transforms/IndVarSimplify/
H A D2011-11-01-lftrptr.ll26 ; PTR64-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
27 ; PTR64-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[GEP]], [[SCEVGEP]]
48 ; PTR32-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
49 ; PTR32-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[GEP]], [[SCEVGEP]]
95 ; PTR64-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
96 ; PTR64-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[GEP]], [[SCEVGEP]]
119 ; PTR32-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
170 ; PTR64-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
194 ; PTR32-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
246 ; PTR64-NEXT: [[SNEXT:%.*]] = load i8, i8* [[GEP]], align 1
[all …]
/llvm-project-15.0.7/llvm/lib/Target/ARM/
H A DMVEGatherScatterLowering.cpp258 if (!GEP) { in decomposeGEP()
266 Offsets = GEP->getOperand(1); in decomposeGEP()
276 Offsets = GEP->getOperand(1); in decomposeGEP()
762 if (GEP->hasOneUse()) { in tryCreateIncrementingGatScat()
1186 Offsets = GEP->getOperand(1); in foldGEP()
1211 if (!GEP) in optimiseAddress()
1214 if (GEP->hasOneUse() && isa<GetElementPtrInst>(GEP->getPointerOperand())) { in optimiseAddress()
1232 "gep.merged", GEP); in optimiseAddress()
1235 GEP->replaceAllUsesWith( in optimiseAddress()
1237 GEP = NewAddress; in optimiseAddress()
[all …]
/llvm-project-15.0.7/llvm/test/Transforms/InstCombine/
H A Dgep-vector.ll35 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr [7 x i32], [7 x i32]* [[ARR_PTR]], i64 [[Y:%.*]], i64 …
36 ; CHECK-NEXT: ret i32* [[GEP]]
49 ; CHECK-NEXT: ret i32* [[GEP]]
60 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr <4 x i32>, <4 x i32>* [[X:%.*]], i64 [[Y:%.*]], i64 [[…
61 ; CHECK-NEXT: ret i32* [[GEP]]
73 ; CHECK-NEXT: ret i32* [[GEP]]
87 ; CHECK-NEXT: ret i32 addrspace(3)* [[GEP]]
102 ; CHECK-NEXT: ret i32 addrspace(3)* [[GEP]]
114 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr <4 x i32>, <4 x i32>* [[X:%.*]], i64 [[Y:%.*]], i64 [[…
115 ; CHECK-NEXT: [[TMP1:%.*]] = addrspacecast i32* [[GEP]] to i32 addrspace(3)*
[all …]
H A Dgep-merge-constant-indices.ll4 ; Test merging GEP of GEP with constant indices.
47 ; Offsets of first and last GEP cancel out.
115 ; First GEP offset is not divisible by last GEP's source element size, but first
116 ; GEP points to an array such that the last GEP offset is divisible by the
117 ; array's element size, so the first GEP can be rewritten with an extra index.
129 ; Offset of either GEP is not divisible by the other's size, converted to i8*
143 ; Negative test. Two GEP should not be merged if not both offsets are constant
156 ; Negative test. Two GEP should not be merged if there is another use of the
157 ; first GEP by the second GEP.
171 ; Two GEP instructions can be merged if one is constant-indexed and the other
[all …]
H A Dgep-canonicalize-constant-indices.ll4 ; Constant-indexed GEP instructions in a chain of GEP instructions should be
11 ; The constant-indexed GEP instruction should be swapped to the end, even
27 ; GEP with the last index being a constant should also be swapped.
38 ; Negative test. GEP should not be swapped if the last index is not a constant.
49 ; Constant-indexed GEP are merged after swawpping.
64 ; Multiple constant-indexed GEP. Note that the first two cannot be merged at
87 ; It is valid to swap if the source operand of the first GEP has multiple uses.
101 ; It is valid to swap if the second GEP has multiple uses.
115 ; Negative test. It is not valid to swap if the first GEP has multiple uses.
H A Dgep-vector-indices.ll101 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, i32* [[A:%.*]], <vscale x 2 x i64> [[INDICES:%.*]]
102 ; CHECK-NEXT: [[RES:%.*]] = extractelement <vscale x 2 x i32*> [[GEP]], i64 3
112 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, i32* [[A:%.*]], <vscale x 2 x i64> [[INDICES:%.*]]
113 ; CHECK-NEXT: [[RES:%.*]] = extractelement <vscale x 2 x i32*> [[GEP]], i32 [[N:%.*]]
123 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, i32* [[A:%.*]], <vscale x 2 x i64> [[INDICES:%.*]]
124 ; CHECK-NEXT: [[LANE0:%.*]] = extractelement <vscale x 2 x i32*> [[GEP]], i64 0
125 ; CHECK-NEXT: [[LANE1:%.*]] = extractelement <vscale x 2 x i32*> [[GEP]], i64 1
140 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, <vscale x 4 x i32*> [[A:%.*]], <vscale x 4 x i64>…
141 ; CHECK-NEXT: [[RES:%.*]] = extractelement <vscale x 4 x i32*> [[GEP]], i64 0
/llvm-project-15.0.7/llvm/test/Transforms/CodeGenPrepare/X86/
H A Dsink-addrspacecast.ll1 ; RUN: opt -S -codegenprepare < %s | FileCheck %s -check-prefix=CHECK -check-prefix=GEP
8 ; GEP: [[CAST:%[0-9]+]] = addrspacecast i64* %base to i8 addrspace(1)*
9 ; GEP: getelementptr inbounds i8, i8 addrspace(1)* [[CAST]], i64 40
25 ; GEP: [[CAST:%[0-9]+]] = addrspacecast i64* %base to i8 addrspace(1)*
26 ; GEP: getelementptr inbounds i8, i8 addrspace(1)* [[CAST]], i64 20
/llvm-project-15.0.7/llvm/test/Transforms/InstSimplify/
H A Dgep.ll15 ; CHECK-NEXT: ret ptr [[GEP]]
31 ; CHECK-NEXT: ret ptr [[GEP]]
47 ; CHECK-NEXT: ret ptr [[GEP]]
66 ; CHECK-NEXT: ret ptr [[GEP]]
81 ; CHECK-NEXT: ret ptr [[GEP]]
94 ; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr [[B]], i64 [[SUB]]
95 ; CHECK-NEXT: ret ptr [[GEP]]
108 ; CHECK-NEXT: ret ptr [[GEP]]
122 ; CHECK-NEXT: ret ptr [[GEP]]
137 ; CHECK-NEXT: ret ptr [[GEP]]
[all …]
/llvm-project-15.0.7/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);
/llvm-project-15.0.7/llvm/lib/Target/AMDGPU/
H A DAMDGPULowerModuleLDSPass.cpp380 Map[GV] = GEP; in createLDSVariableReplacement()
416 Constant *GEP = LDSVarsToConstantGEP[GV]; in replaceLDSVariablesWithStruct() local
418 GV->replaceUsesWithIf(GEP, Predicate); in replaceLDSVariablesWithStruct()
423 APInt APOff(DL.getIndexTypeSizeInBits(GEP->getType()), 0); in replaceLDSVariablesWithStruct()
424 GEP->stripAndAccumulateInBoundsConstantOffsets(DL, APOff); in replaceLDSVariablesWithStruct()
436 refineUsesAlignmentAndAA(GEP, A, DL, AliasScope, NoAlias); in replaceLDSVariablesWithStruct()
481 if (auto *GEP = dyn_cast<GetElementPtrInst>(U)) { in refineUsesAlignmentAndAA() local
482 unsigned BitWidth = DL.getIndexTypeSizeInBits(GEP->getType()); in refineUsesAlignmentAndAA()
484 if (GEP->getPointerOperand() == Ptr) { in refineUsesAlignmentAndAA()
486 if (GEP->accumulateConstantOffset(DL, Off)) in refineUsesAlignmentAndAA()
[all …]
/llvm-project-15.0.7/flang/test/Fir/
H A Dfield-index.fir13 // CHECK: %[[GEP:.*]] = getelementptr %a, ptr %[[arg0]], i64 0, i32 1
15 // CHECK: load i32, ptr %[[GEP]]
25 // CHECK: %[[GEP:.*]] = getelementptr %c, ptr %[[arg0]], i64 0, i32 1, i32 1
27 // CHECK: load i32, ptr %[[GEP]]

12345678910>>...18