diff options
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Analysis/VectorUtils.cpp | 3 |
4 files changed, 10 insertions, 13 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 6beaee093a2..b3737923ef1 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -381,7 +381,7 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL, } // Don't attempt to analyze GEPs over unsized objects. - if (!GEPOp->getOperand(0)->getType()->getPointerElementType()->isSized()) + if (!GEPOp->getSourceElementType()->isSized()) return V; unsigned AS = GEPOp->getPointerAddressSpace(); diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 34074efd1ce..57603d9a7e2 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -4087,16 +4087,16 @@ const SCEV *ScalarEvolution::createNodeForSelectOrPHI(Instruction *I, /// operations. This allows them to be analyzed by regular SCEV code. /// const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) { - Value *Base = GEP->getOperand(0); // Don't attempt to analyze GEPs over unsized objects. - if (!Base->getType()->getPointerElementType()->isSized()) + if (!GEP->getSourceElementType()->isSized()) return getUnknown(GEP); SmallVector<const SCEV *, 4> IndexExprs; for (auto Index = GEP->idx_begin(); Index != GEP->idx_end(); ++Index) IndexExprs.push_back(getSCEV(*Index)); - return getGEPExpr(GEP->getSourceElementType(), getSCEV(Base), IndexExprs, - GEP->isInBounds()); + return getGEPExpr(GEP->getSourceElementType(), + getSCEV(GEP->getPointerOperand()), + IndexExprs, GEP->isInBounds()); } /// GetMinTrailingZeros - Determine the minimum number of zero bits that S is diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 00c0e187c34..c7c86bcb88f 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2886,8 +2886,7 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str, return false; // Make sure the index-ee is a pointer to array of i8. - PointerType *PT = cast<PointerType>(GEP->getOperand(0)->getType()); - ArrayType *AT = dyn_cast<ArrayType>(PT->getElementType()); + ArrayType *AT = dyn_cast<ArrayType>(GEP->getSourceElementType()); if (!AT || !AT->getElementType()->isIntegerTy(8)) return false; @@ -3253,8 +3252,7 @@ static bool isDereferenceableAndAlignedPointer( // For GEPs, determine if the indexing lands within the allocated object. if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) { - Type *VTy = GEP->getType(); - Type *Ty = VTy->getPointerElementType(); + Type *Ty = GEP->getResultElementType(); const Value *Base = GEP->getPointerOperand(); // Conservatively require that the base pointer be fully dereferenceable @@ -3265,14 +3263,14 @@ static bool isDereferenceableAndAlignedPointer( Visited)) return false; - APInt Offset(DL.getPointerTypeSizeInBits(VTy), 0); + APInt Offset(DL.getPointerTypeSizeInBits(GEP->getType()), 0); if (!GEP->accumulateConstantOffset(DL, Offset)) return false; // Check if the load is within the bounds of the underlying object // and offset is aligned. uint64_t LoadSize = DL.getTypeStoreSize(Ty); - Type *BaseType = Base->getType()->getPointerElementType(); + Type *BaseType = GEP->getSourceElementType(); assert(isPowerOf2_32(Align) && "must be a power of 2!"); return (Offset + LoadSize).ule(DL.getTypeAllocSize(BaseType)) && !(Offset & APInt(Offset.getBitWidth(), Align-1)); diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index ee347692b99..d9b1354daf7 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -231,8 +231,7 @@ Intrinsic::ID llvm::getIntrinsicIDForCall(CallInst *CI, unsigned llvm::getGEPInductionOperand(const GetElementPtrInst *Gep) { const DataLayout &DL = Gep->getModule()->getDataLayout(); unsigned LastOperand = Gep->getNumOperands() - 1; - unsigned GEPAllocSize = DL.getTypeAllocSize( - cast<PointerType>(Gep->getType()->getScalarType())->getElementType()); + unsigned GEPAllocSize = DL.getTypeAllocSize(Gep->getResultElementType()); // Walk backwards and try to peel off zeros. while (LastOperand > 1 && match(Gep->getOperand(LastOperand), m_Zero())) { |