Home
last modified time | relevance | path

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

123

/external/llvm/include/llvm/Support/
DGetElementPtrTypeIterator.h85 inline gep_type_iterator gep_type_begin(const User *GEP) { in gep_type_begin() argument
86 return gep_type_iterator::begin(GEP->getOperand(0)->getType(), in gep_type_begin()
87 GEP->op_begin()+1); in gep_type_begin()
89 inline gep_type_iterator gep_type_end(const User *GEP) { in gep_type_end() argument
90 return gep_type_iterator::end(GEP->op_end()); in gep_type_end()
92 inline gep_type_iterator gep_type_begin(const User &GEP) { in gep_type_begin() argument
93 return gep_type_iterator::begin(GEP.getOperand(0)->getType(), in gep_type_begin()
94 GEP.op_begin()+1); in gep_type_begin()
96 inline gep_type_iterator gep_type_end(const User &GEP) { in gep_type_end() argument
97 return gep_type_iterator::end(GEP.op_end()); in gep_type_end()
/external/llvm/include/llvm/Transforms/Utils/
DLocal.h178 Value *EmitGEPOffset(IRBuilderTy *Builder, const TargetData &TD, User *GEP,
180 gep_type_iterator GTI = gep_type_begin(GEP);
181 Type *IntPtrTy = TD.getIntPtrType(GEP->getContext());
186 bool isInBounds = cast<GEPOperator>(GEP)->isInBounds() && !NoAssumptions;
192 for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); i != e;
205 GEP->getName()+".offs");
213 Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs");
222 GEP->getName()+".idx", isInBounds /*NUW*/);
226 Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs");
/external/llvm/docs/
DGetElementPtr.rst4 The Often Misunderstood GEP Instruction
14 `GetElementPtr <LangRef.html#i_getelementptr>`_ (GEP) instruction. Questions
15 about the wily GEP instruction are probably the most frequently occurring
17 sources of confusion and show that the GEP instruction is really quite simple.
22 When people are first confronted with the GEP instruction, they tend to relate
24 indexing and field selection. GEP closely resembles C array indexing and field
28 What is the first index of the GEP instruction?
47 provide the GEP instruction with two index operands. The first operand indexes
63 computation. The first operand to the GEP instruction must be a value of a
64 pointer type. The value of the pointer is provided directly to the GEP
[all …]
/external/llvm/lib/Transforms/InstCombine/
DInstructionCombining.cpp90 Value *InstCombiner::EmitGEPOffset(User *GEP) { in EmitGEPOffset() argument
91 return llvm::EmitGEPOffset(Builder, *getTargetData(), GEP); in EmitGEPOffset()
798 static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { in shouldMergeGEPs() argument
802 if (GEP.hasAllZeroIndices() && !Src.hasAllZeroIndices() && in shouldMergeGEPs()
808 Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { in visitGetElementPtrInst() argument
809 SmallVector<Value*, 8> Ops(GEP.op_begin(), GEP.op_end()); in visitGetElementPtrInst()
812 return ReplaceInstUsesWith(GEP, V); in visitGetElementPtrInst()
814 Value *PtrOp = GEP.getOperand(0); in visitGetElementPtrInst()
820 Type *IntPtrTy = TD->getIntPtrType(GEP.getContext()); in visitGetElementPtrInst()
822 gep_type_iterator GTI = gep_type_begin(GEP); in visitGetElementPtrInst()
[all …]
DInstCombinePHI.cpp148 GetElementPtrInst *GEP= dyn_cast<GetElementPtrInst>(PN.getIncomingValue(i)); in FoldPHIArgGEPIntoPHI() local
149 if (!GEP || !GEP->hasOneUse() || GEP->getType() != FirstInst->getType() || in FoldPHIArgGEPIntoPHI()
150 GEP->getNumOperands() != FirstInst->getNumOperands()) in FoldPHIArgGEPIntoPHI()
153 AllInBounds &= GEP->isInBounds(); in FoldPHIArgGEPIntoPHI()
157 (!isa<AllocaInst>(GEP->getOperand(0)) || in FoldPHIArgGEPIntoPHI()
158 !GEP->hasAllConstantIndices())) in FoldPHIArgGEPIntoPHI()
163 if (FirstInst->getOperand(op) == GEP->getOperand(op)) in FoldPHIArgGEPIntoPHI()
172 isa<ConstantInt>(GEP->getOperand(op))) in FoldPHIArgGEPIntoPHI()
175 if (FirstInst->getOperand(op)->getType() !=GEP->getOperand(op)->getType()) in FoldPHIArgGEPIntoPHI()
279 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(L->getOperand(0))) in isSafeAndProfitableToSinkLoad() local
[all …]
DInstCombineLoadStoreAlloca.cpp69 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) { in isOnlyCopiedFromConstantGlobal() local
72 if (!isOnlyCopiedFromConstantGlobal(GEP, TheCopy, ToDelete, in isOnlyCopiedFromConstantGlobal()
73 IsOffset || !GEP->hasAllZeroIndices())) in isOnlyCopiedFromConstantGlobal()
206 Instruction *GEP = in visitAllocaInst() local
208 InsertNewInstBefore(GEP, *It); in visitAllocaInst()
212 return ReplaceInstUsesWith(AI, GEP); in visitAllocaInst()
601 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr)) { in visitStoreInst() local
602 if (isa<AllocaInst>(GEP->getOperand(0))) { in visitStoreInst()
603 if (GEP->getOperand(0)->hasOneUse()) in visitStoreInst()
DInstCombineCompares.cpp202 FoldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP, GlobalVariable *GV, in FoldCmpLoadFromIndexedGlobal() argument
205 if (!GEP->isInBounds() && TD == 0) return 0; in FoldCmpLoadFromIndexedGlobal()
218 if (GEP->getNumOperands() < 3 || in FoldCmpLoadFromIndexedGlobal()
219 !isa<ConstantInt>(GEP->getOperand(1)) || in FoldCmpLoadFromIndexedGlobal()
220 !cast<ConstantInt>(GEP->getOperand(1))->isZero() || in FoldCmpLoadFromIndexedGlobal()
221 isa<Constant>(GEP->getOperand(2))) in FoldCmpLoadFromIndexedGlobal()
230 for (unsigned i = 3, e = GEP->getNumOperands(); i != e; ++i) { in FoldCmpLoadFromIndexedGlobal()
231 ConstantInt *Idx = dyn_cast<ConstantInt>(GEP->getOperand(i)); in FoldCmpLoadFromIndexedGlobal()
366 Value *Idx = GEP->getOperand(2); in FoldCmpLoadFromIndexedGlobal()
371 if (!GEP->isInBounds() && in FoldCmpLoadFromIndexedGlobal()
[all …]
DInstCombineCasts.cpp1321 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Src)) { in commonPointerCastTransforms() local
1324 if (GEP->hasAllZeroIndices()) { in commonPointerCastTransforms()
1328 Worklist.Add(GEP); in commonPointerCastTransforms()
1329 CI.setOperand(0, GEP->getOperand(0)); in commonPointerCastTransforms()
1337 if (TD && GEP->hasOneUse() && isa<BitCastInst>(GEP->getOperand(0)) && in commonPointerCastTransforms()
1338 GEP->hasAllConstantIndices()) { in commonPointerCastTransforms()
1339 SmallVector<Value*, 8> Ops(GEP->idx_begin(), GEP->idx_end()); in commonPointerCastTransforms()
1340 int64_t Offset = TD->getIndexedOffset(GEP->getPointerOperandType(), Ops); in commonPointerCastTransforms()
1343 Value *OrigBase = cast<BitCastInst>(GEP->getOperand(0))->getOperand(0); in commonPointerCastTransforms()
1351 Value *NGEP = cast<GEPOperator>(GEP)->isInBounds() ? in commonPointerCastTransforms()
[all …]
/external/llvm/lib/Transforms/IPO/
DArgumentPromotion.cpp349 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(V)) { in isSafeToPromoteArgument() local
350 V = GEP->getPointerOperand(); in isSafeToPromoteArgument()
353 Indices.reserve(GEP->getNumIndices()); in isSafeToPromoteArgument()
354 for (User::op_iterator II = GEP->idx_begin(), IE = GEP->idx_end(); in isSafeToPromoteArgument()
387 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) { in isSafeToPromoteArgument() local
388 if (GEP->use_empty()) { in isSafeToPromoteArgument()
391 getAnalysis<AliasAnalysis>().deleteValue(GEP); in isSafeToPromoteArgument()
392 GEP->eraseFromParent(); in isSafeToPromoteArgument()
400 for (User::op_iterator i = GEP->idx_begin(), e = GEP->idx_end(); in isSafeToPromoteArgument()
408 for (Value::use_iterator UI = GEP->use_begin(), E = GEP->use_end(); in isSafeToPromoteArgument()
[all …]
DGlobalOpt.cpp364 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) { in IsSafeComputationToRemove() local
365 if (!GEP->hasAllConstantIndices()) in IsSafeComputationToRemove()
499 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) { in CleanupConstantGlobalUsers() local
504 if (!isa<ConstantExpr>(GEP->getOperand(0))) { in CleanupConstantGlobalUsers()
506 dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP, TD, TLI)); in CleanupConstantGlobalUsers()
513 if (Init && isa<ConstantAggregateZero>(Init) && GEP->isInBounds()) in CleanupConstantGlobalUsers()
514 SubInit = Constant::getNullValue(GEP->getType()->getElementType()); in CleanupConstantGlobalUsers()
516 Changed |= CleanupConstantGlobalUsers(GEP, SubInit, TD, TLI); in CleanupConstantGlobalUsers()
518 if (GEP->use_empty()) { in CleanupConstantGlobalUsers()
519 GEP->eraseFromParent(); in CleanupConstantGlobalUsers()
[all …]
/external/llvm/lib/Analysis/
DPHITransAddr.cpp217 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in PHITranslateSubExpr() local
220 for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i) { in PHITranslateSubExpr()
221 Value *GEPOp = PHITranslateSubExpr(GEP->getOperand(i), CurBB, PredBB, DT); in PHITranslateSubExpr()
224 AnyChanged |= GEPOp != GEP->getOperand(i); in PHITranslateSubExpr()
229 return GEP; in PHITranslateSubExpr()
244 if (GEPI->getType() == GEP->getType() && in PHITranslateSubExpr()
400 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { in InsertPHITranslatedSubExpr() local
402 BasicBlock *CurBB = GEP->getParent(); in InsertPHITranslatedSubExpr()
403 for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i) { in InsertPHITranslatedSubExpr()
404 Value *OpVal = InsertPHITranslatedSubExpr(GEP->getOperand(i), in InsertPHITranslatedSubExpr()
[all …]
DLoads.cpp62 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in getUnderlyingObjectWithOffset() local
63 if (!GEP->hasAllConstantIndices()) in getUnderlyingObjectWithOffset()
65 SmallVector<Value*, 8> Indices(GEP->op_begin() + 1, GEP->op_end()); in getUnderlyingObjectWithOffset()
66 ByteOffset += TD->getIndexedOffset(GEP->getPointerOperandType(), in getUnderlyingObjectWithOffset()
68 V = GEP->getPointerOperand(); in getUnderlyingObjectWithOffset()
DMemoryBuiltins.cpp394 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) in compute() local
395 return visitGEPOperator(*GEP); in compute()
511 SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) { in visitGEPOperator() argument
512 SizeOffsetType PtrData = compute(GEP.getPointerOperand()); in visitGEPOperator()
513 if (!bothKnown(PtrData) || !GEP.hasAllConstantIndices()) in visitGEPOperator()
516 SmallVector<Value*, 8> Ops(GEP.idx_begin(), GEP.idx_end()); in visitGEPOperator()
517 APInt Offset(IntTyBits,TD->getIndexedOffset(GEP.getPointerOperandType(),Ops)); in visitGEPOperator()
615 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in compute_() local
616 Result = visitGEPOperator(*GEP); in compute_()
694 ObjectSizeOffsetEvaluator::visitGEPOperator(GEPOperator &GEP) { in visitGEPOperator() argument
[all …]
DInlineCost.cpp93 bool isGEPOffsetConstant(GetElementPtrInst &GEP);
94 bool accumulateGEPOffset(GEPOperator &GEP, APInt &Offset);
225 bool CallAnalyzer::isGEPOffsetConstant(GetElementPtrInst &GEP) { in isGEPOffsetConstant() argument
226 for (User::op_iterator I = GEP.idx_begin(), E = GEP.idx_end(); I != E; ++I) in isGEPOffsetConstant()
237 bool CallAnalyzer::accumulateGEPOffset(GEPOperator &GEP, APInt &Offset) { in accumulateGEPOffset() argument
244 for (gep_type_iterator GTI = gep_type_begin(GEP), GTE = gep_type_end(GEP); in accumulateGEPOffset()
752 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in stripAndComputeInBoundsConstantOffsets() local
753 if (!GEP->isInBounds() || !accumulateGEPOffset(*GEP, Offset)) in stripAndComputeInBoundsConstantOffsets()
755 V = GEP->getPointerOperand(); in stripAndComputeInBoundsConstantOffsets()
DCodeMetrics.cpp63 if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) in isInstructionFree() local
64 return GEP->hasAllConstantIndices(); in isInstructionFree()
DValueTracking.cpp1595 GEPOperator *GEP = dyn_cast<GEPOperator>(PtrOp); in GetPointerBaseWithConstantOffset() local
1596 if (GEP == 0 || !GEP->hasAllConstantIndices()) return Ptr; in GetPointerBaseWithConstantOffset()
1598 gep_type_iterator GTI = gep_type_begin(GEP); in GetPointerBaseWithConstantOffset()
1599 for (User::op_iterator I = GEP->idx_begin(), E = GEP->idx_end(); I != E; in GetPointerBaseWithConstantOffset()
1619 return GetPointerBaseWithConstantOffset(GEP->getPointerOperand(), Offset, TD); in GetPointerBaseWithConstantOffset()
1635 if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in getConstantStringInfo() local
1637 if (GEP->getNumOperands() != 3) in getConstantStringInfo()
1641 PointerType *PT = cast<PointerType>(GEP->getOperand(0)->getType()); in getConstantStringInfo()
1648 const ConstantInt *FirstIdx = dyn_cast<ConstantInt>(GEP->getOperand(1)); in getConstantStringInfo()
1656 if (const ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(2))) in getConstantStringInfo()
[all …]
/external/llvm/lib/VMCore/
DValue.cpp344 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in stripPointerCastsAndOffsets() local
347 if (!GEP->hasAllZeroIndices()) in stripPointerCastsAndOffsets()
351 if (!GEP->hasAllConstantIndices()) in stripPointerCastsAndOffsets()
355 if (!GEP->isInBounds()) in stripPointerCastsAndOffsets()
359 V = GEP->getPointerOperand(); in stripPointerCastsAndOffsets()
411 if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in isDereferenceablePointer() local
413 if (!Visited.insert(GEP->getOperand(0))) in isDereferenceablePointer()
415 if (!isDereferenceablePointer(GEP->getOperand(0), Visited)) in isDereferenceablePointer()
418 gep_type_iterator GTI = gep_type_begin(GEP); in isDereferenceablePointer()
419 for (User::const_op_iterator I = GEP->op_begin()+1, in isDereferenceablePointer()
[all …]
DVerifier.cpp272 void visitGetElementPtrInst(GetElementPtrInst &GEP);
1327 void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) { in visitGetElementPtrInst() argument
1328 Type *TargetTy = GEP.getPointerOperandType()->getScalarType(); in visitGetElementPtrInst()
1331 "GEP base pointer is not a vector or a vector of pointers", &GEP); in visitGetElementPtrInst()
1333 "GEP into unsized type!", &GEP); in visitGetElementPtrInst()
1335 SmallVector<Value*, 16> Idxs(GEP.idx_begin(), GEP.idx_end()); in visitGetElementPtrInst()
1337 GetElementPtrInst::getIndexedType(GEP.getPointerOperandType(), Idxs); in visitGetElementPtrInst()
1338 Assert1(ElTy, "Invalid indices for GEP pointer type!", &GEP); in visitGetElementPtrInst()
1340 if (GEP.getPointerOperandType()->isPointerTy()) { in visitGetElementPtrInst()
1342 Assert2(GEP.getType()->isPointerTy() && in visitGetElementPtrInst()
[all …]
/external/llvm/unittests/Transforms/Utils/
DCloning.cpp129 GetElementPtrInst *GEP = GetElementPtrInst::Create(V, ops); in TEST_F() local
130 EXPECT_FALSE(this->clone(GEP)->isInBounds()); in TEST_F()
132 GEP->setIsInBounds(); in TEST_F()
133 EXPECT_TRUE(this->clone(GEP)->isInBounds()); in TEST_F()
/external/llvm/test/Analysis/BasicAA/
D2009-10-13-GEP-BaseNoAlias.ll2 ; If GEP base doesn't alias Z, then GEP doesn't alias Z.
/external/llvm/lib/Transforms/Utils/
DCodeExtractor.cpp365 GetElementPtrInst *GEP = in constructFunction() local
367 RewriteVal = new LoadInst(GEP, "loadgep_" + inputs[i]->getName(), TI); in constructFunction()
467 GetElementPtrInst *GEP = in emitCallAndSwitchStatement() local
470 codeReplacer->getInstList().push_back(GEP); in emitCallAndSwitchStatement()
471 StoreInst *SI = new StoreInst(StructValues[i], GEP); in emitCallAndSwitchStatement()
493 GetElementPtrInst *GEP in emitCallAndSwitchStatement() local
496 codeReplacer->getInstList().push_back(GEP); in emitCallAndSwitchStatement()
497 Output = GEP; in emitCallAndSwitchStatement()
608 GetElementPtrInst *GEP = in emitCallAndSwitchStatement() local
612 new StoreInst(outputs[out], GEP, NTRet); in emitCallAndSwitchStatement()
/external/llvm/test/Transforms/InstCombine/
Dextractvalue.ll43 ; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}* %pair, i32 0, i32 1
44 ; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32* [[GEP]]
71 ; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}* %arg, i32 0, i32 1, i32 1
72 ; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32* [[GEP]]
/external/llvm/test/Transforms/ScalarRepl/
Dnonzero-first-index.ll8 ; Check that a GEP with a non-zero first index does not prevent SROA as long
32 ; Try it with a bitcast and single GEP....
/external/llvm/lib/Transforms/Scalar/
DGlobalMerge.cpp159 Constant *GEP = ConstantExpr::getInBoundsGetElementPtr(MergedGV, Idx); in doMerge() local
160 Globals[k]->replaceAllUsesWith(GEP); in doMerge()
/external/llvm/test/Transforms/GlobalOpt/
Ddeadglobal-2.ll3 ; This is a harder case to delete as the GEP has a variable index.

123