/external/llvm/include/llvm/Support/ |
D | GetElementPtrTypeIterator.h | 85 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/ |
D | Local.h | 178 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/ |
D | GetElementPtr.rst | 4 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/ |
D | InstructionCombining.cpp | 90 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 …]
|
D | InstCombinePHI.cpp | 148 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 …]
|
D | InstCombineLoadStoreAlloca.cpp | 69 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()
|
D | InstCombineCompares.cpp | 202 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 …]
|
D | InstCombineCasts.cpp | 1321 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/ |
D | ArgumentPromotion.cpp | 349 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 …]
|
D | GlobalOpt.cpp | 364 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/ |
D | PHITransAddr.cpp | 217 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 …]
|
D | Loads.cpp | 62 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()
|
D | MemoryBuiltins.cpp | 394 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 …]
|
D | InlineCost.cpp | 93 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()
|
D | CodeMetrics.cpp | 63 if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) in isInstructionFree() local 64 return GEP->hasAllConstantIndices(); in isInstructionFree()
|
D | ValueTracking.cpp | 1595 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/ |
D | Value.cpp | 344 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 …]
|
D | Verifier.cpp | 272 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/ |
D | Cloning.cpp | 129 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/ |
D | 2009-10-13-GEP-BaseNoAlias.ll | 2 ; If GEP base doesn't alias Z, then GEP doesn't alias Z.
|
/external/llvm/lib/Transforms/Utils/ |
D | CodeExtractor.cpp | 365 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/ |
D | extractvalue.ll | 43 ; 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/ |
D | nonzero-first-index.ll | 8 ; 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/ |
D | GlobalMerge.cpp | 159 Constant *GEP = ConstantExpr::getInBoundsGetElementPtr(MergedGV, Idx); in doMerge() local 160 Globals[k]->replaceAllUsesWith(GEP); in doMerge()
|
/external/llvm/test/Transforms/GlobalOpt/ |
D | deadglobal-2.ll | 3 ; This is a harder case to delete as the GEP has a variable index.
|