Home
last modified time | relevance | path

Searched refs:GEP (Results 1 – 25 of 73) 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
87 (GEP->getOperand(0)->getType()->getScalarType(), 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
94 (GEP.getOperand(0)->getType()->getScalarType(), 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.h180 Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &TD, User *GEP,
182 gep_type_iterator GTI = gep_type_begin(GEP);
183 Type *IntPtrTy = TD.getIntPtrType(GEP->getContext());
188 bool isInBounds = cast<GEPOperator>(GEP)->isInBounds() && !NoAssumptions;
194 for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); i != e;
207 GEP->getName()+".offs");
215 Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs");
224 GEP->getName()+".idx", isInBounds /*NUW*/);
228 Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs");
/external/llvm/docs/
DGetElementPtr.rst2 The Often Misunderstood GEP Instruction
12 `GetElementPtr <LangRef.html#i_getelementptr>`_ (GEP) instruction. Questions
13 about the wily GEP instruction are probably the most frequently occurring
15 sources of confusion and show that the GEP instruction is really quite simple.
20 When people are first confronted with the GEP instruction, they tend to relate
22 indexing and field selection. GEP closely resembles C array indexing and field
26 What is the first index of the GEP instruction?
45 provide the GEP instruction with two index operands. The first operand indexes
61 computation. The first operand to the GEP instruction must be a value of a
62 pointer type. The value of the pointer is provided directly to the GEP
[all …]
/external/llvm/lib/Transforms/InstCombine/
DInstructionCombining.cpp96 Value *InstCombiner::EmitGEPOffset(User *GEP) { in EmitGEPOffset() argument
97 return llvm::EmitGEPOffset(Builder, *getDataLayout(), GEP); in EmitGEPOffset()
819 static bool shouldMergeGEPs(GEPOperator &GEP, GEPOperator &Src) { in shouldMergeGEPs() argument
823 if (GEP.hasAllZeroIndices() && !Src.hasAllZeroIndices() && in shouldMergeGEPs()
1067 Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { in visitGetElementPtrInst() argument
1068 SmallVector<Value*, 8> Ops(GEP.op_begin(), GEP.op_end()); in visitGetElementPtrInst()
1071 return ReplaceInstUsesWith(GEP, V); in visitGetElementPtrInst()
1073 Value *PtrOp = GEP.getOperand(0); in visitGetElementPtrInst()
1079 Type *IntPtrTy = TD->getIntPtrType(GEP.getPointerOperandType()); in visitGetElementPtrInst()
1081 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()
187 Instruction *GEP = in visitAllocaInst() local
189 InsertNewInstBefore(GEP, *It); in visitAllocaInst()
193 return ReplaceInstUsesWith(AI, GEP); in visitAllocaInst()
590 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr)) { in visitStoreInst() local
591 if (isa<AllocaInst>(GEP->getOperand(0))) { in visitStoreInst()
592 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 …]
/external/llvm/lib/Transforms/IPO/
DArgumentPromotion.cpp350 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(V)) { in isSafeToPromoteArgument() local
351 V = GEP->getPointerOperand(); in isSafeToPromoteArgument()
354 Indices.reserve(GEP->getNumIndices()); in isSafeToPromoteArgument()
355 for (User::op_iterator II = GEP->idx_begin(), IE = GEP->idx_end(); in isSafeToPromoteArgument()
388 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) { in isSafeToPromoteArgument() local
389 if (GEP->use_empty()) { in isSafeToPromoteArgument()
392 getAnalysis<AliasAnalysis>().deleteValue(GEP); in isSafeToPromoteArgument()
393 GEP->eraseFromParent(); in isSafeToPromoteArgument()
401 for (User::op_iterator i = GEP->idx_begin(), e = GEP->idx_end(); in isSafeToPromoteArgument()
409 for (Value::use_iterator UI = GEP->use_begin(), E = GEP->use_end(); in isSafeToPromoteArgument()
[all …]
DGlobalOpt.cpp368 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) { in IsSafeComputationToRemove() local
369 if (!GEP->hasAllConstantIndices()) in IsSafeComputationToRemove()
503 } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) { in CleanupConstantGlobalUsers() local
508 if (!isa<ConstantExpr>(GEP->getOperand(0))) { in CleanupConstantGlobalUsers()
510 dyn_cast_or_null<ConstantExpr>(ConstantFoldInstruction(GEP, TD, TLI)); in CleanupConstantGlobalUsers()
517 if (Init && isa<ConstantAggregateZero>(Init) && GEP->isInBounds()) in CleanupConstantGlobalUsers()
518 SubInit = Constant::getNullValue(GEP->getType()->getElementType()); in CleanupConstantGlobalUsers()
520 Changed |= CleanupConstantGlobalUsers(GEP, SubInit, TD, TLI); in CleanupConstantGlobalUsers()
522 if (GEP->use_empty()) { in CleanupConstantGlobalUsers()
523 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 …]
DMemoryBuiltins.cpp422 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) in compute() local
423 Result = visitGEPOperator(*GEP); in compute()
542 SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) { in visitGEPOperator() argument
543 SizeOffsetType PtrData = compute(GEP.getPointerOperand()); in visitGEPOperator()
545 if (!bothKnown(PtrData) || !GEP.accumulateConstantOffset(*TD, Offset)) in visitGEPOperator()
663 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in compute_() local
664 Result = visitGEPOperator(*GEP); in compute_()
743 ObjectSizeOffsetEvaluator::visitGEPOperator(GEPOperator &GEP) { in visitGEPOperator() argument
744 SizeOffsetEvalType PtrData = compute_(GEP.getPointerOperand()); in visitGEPOperator()
748 Value *Offset = EmitGEPOffset(&Builder, *TD, &GEP, /*NoAssumptions=*/true); in visitGEPOperator()
DValueTracking.cpp875 static bool isGEPKnownNonNull(GEPOperator *GEP, const DataLayout *DL, in isGEPKnownNonNull() argument
877 if (!GEP->isInBounds() || GEP->getPointerAddressSpace() != 0) in isGEPKnownNonNull()
881 assert(GEP->getType()->isPointerTy() && "We only support plain pointer GEP"); in isGEPKnownNonNull()
885 if (isKnownNonZero(GEP->getPointerOperand(), DL, Depth)) in isGEPKnownNonNull()
895 for (gep_type_iterator GTI = gep_type_begin(GEP), GTE = gep_type_end(GEP); in isGEPKnownNonNull()
958 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) in isKnownNonZero() local
959 if (isGEPKnownNonNull(GEP, TD, Depth)) in isKnownNonZero()
1685 if (GEPOperator *GEP = dyn_cast<GEPOperator>(Ptr)) { in GetPointerBaseWithConstantOffset() local
1687 if (TD && !GEP->accumulateConstantOffset(*TD, GEPOffset)) in GetPointerBaseWithConstantOffset()
1690 Ptr = GEP->getPointerOperand(); in GetPointerBaseWithConstantOffset()
[all …]
/external/llvm/lib/IR/
DValue.cpp351 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in stripPointerCastsAndOffsets() local
354 if (!GEP->hasAllZeroIndices()) in stripPointerCastsAndOffsets()
358 if (!GEP->hasAllConstantIndices()) in stripPointerCastsAndOffsets()
362 if (!GEP->isInBounds()) in stripPointerCastsAndOffsets()
366 V = GEP->getPointerOperand(); in stripPointerCastsAndOffsets()
418 if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in isDereferenceablePointer() local
420 if (!Visited.insert(GEP->getOperand(0))) in isDereferenceablePointer()
422 if (!isDereferenceablePointer(GEP->getOperand(0), Visited)) in isDereferenceablePointer()
425 gep_type_iterator GTI = gep_type_begin(GEP); in isDereferenceablePointer()
426 for (User::const_op_iterator I = GEP->op_begin()+1, in isDereferenceablePointer()
[all …]
DVerifier.cpp276 void visitGetElementPtrInst(GetElementPtrInst &GEP);
1520 void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) { in visitGetElementPtrInst() argument
1521 Type *TargetTy = GEP.getPointerOperandType()->getScalarType(); in visitGetElementPtrInst()
1524 "GEP base pointer is not a vector or a vector of pointers", &GEP); in visitGetElementPtrInst()
1526 "GEP into unsized type!", &GEP); in visitGetElementPtrInst()
1527 Assert1(GEP.getPointerOperandType()->isVectorTy() == in visitGetElementPtrInst()
1528 GEP.getType()->isVectorTy(), "Vector GEP must return a vector value", in visitGetElementPtrInst()
1529 &GEP); in visitGetElementPtrInst()
1531 SmallVector<Value*, 16> Idxs(GEP.idx_begin(), GEP.idx_end()); in visitGetElementPtrInst()
1533 GetElementPtrInst::getIndexedType(GEP.getPointerOperandType(), Idxs); in visitGetElementPtrInst()
[all …]
/external/llvm/unittests/Transforms/Utils/
DCloning.cpp132 GetElementPtrInst *GEP = GetElementPtrInst::Create(V, ops); in TEST_F() local
133 EXPECT_FALSE(this->clone(GEP)->isInBounds()); in TEST_F()
135 GEP->setIsInBounds(); in TEST_F()
136 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.cpp366 GetElementPtrInst *GEP = in constructFunction() local
368 RewriteVal = new LoadInst(GEP, "loadgep_" + inputs[i]->getName(), TI); in constructFunction()
468 GetElementPtrInst *GEP = in emitCallAndSwitchStatement() local
471 codeReplacer->getInstList().push_back(GEP); in emitCallAndSwitchStatement()
472 StoreInst *SI = new StoreInst(StructValues[i], GEP); in emitCallAndSwitchStatement()
494 GetElementPtrInst *GEP in emitCallAndSwitchStatement() local
497 codeReplacer->getInstList().push_back(GEP); in emitCallAndSwitchStatement()
498 Output = GEP; in emitCallAndSwitchStatement()
609 GetElementPtrInst *GEP = in emitCallAndSwitchStatement() local
613 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/lib/Analysis/IPA/
DInlineCost.cpp101 bool isGEPOffsetConstant(GetElementPtrInst &GEP);
102 bool accumulateGEPOffset(GEPOperator &GEP, APInt &Offset);
237 bool CallAnalyzer::isGEPOffsetConstant(GetElementPtrInst &GEP) { in isGEPOffsetConstant() argument
238 for (User::op_iterator I = GEP.idx_begin(), E = GEP.idx_end(); I != E; ++I) in isGEPOffsetConstant()
249 bool CallAnalyzer::accumulateGEPOffset(GEPOperator &GEP, APInt &Offset) { in accumulateGEPOffset() argument
256 for (gep_type_iterator GTI = gep_type_begin(GEP), GTE = gep_type_end(GEP); in accumulateGEPOffset()
868 if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in stripAndComputeInBoundsConstantOffsets() local
869 if (!GEP->isInBounds() || !accumulateGEPOffset(*GEP, Offset)) in stripAndComputeInBoundsConstantOffsets()
871 V = GEP->getPointerOperand(); in stripAndComputeInBoundsConstantOffsets()
/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/test/Assembler/
Dgetelementptr.ll27 ; Verify that struct GEP works with a vector of pointers.
33 ; Verify that array GEP works with a vector of pointers.
/external/llvm/test/Transforms/GlobalOpt/
Ddeadglobal-2.ll3 ; This is a harder case to delete as the GEP has a variable index.
/external/llvm/include/llvm/Analysis/
DMemoryBuiltins.h205 SizeOffsetType visitGEPOperator(GEPOperator &GEP);
268 SizeOffsetEvalType visitGEPOperator(GEPOperator &GEP);
/external/llvm/lib/Target/NVPTX/
DNVPTXUtilities.cpp350 if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in skipPointerTransfer() local
351 V = GEP->getPointerOperand()->stripPointerCasts(); in skipPointerTransfer()
382 } else if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { in skipPointerTransfer() local
383 V = GEP->getPointerOperand()->stripPointerCasts(); in skipPointerTransfer()
/external/llvm/lib/CodeGen/
DStackProtector.cpp179 } else if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(U)) { in HasAddressTaken() local
180 if (HasAddressTaken(GEP)) in HasAddressTaken()

123