diff options
-rw-r--r-- | llvm/include/llvm/IR/DataLayout.h | 2 | ||||
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Analysis/TypeMetadataUtils.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 10 |
4 files changed, 9 insertions, 9 deletions
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h index ed71ae7c223..173121b72ff 100644 --- a/llvm/include/llvm/IR/DataLayout.h +++ b/llvm/include/llvm/IR/DataLayout.h @@ -440,7 +440,7 @@ public: /// /// Note that this takes the element type, not the pointer type. /// This is used to implement getelementptr. - uint64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef<Value *> Indices) const; + int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef<Value *> Indices) const; /// \brief Returns a StructLayout object, indicating the alignment of the /// struct, its size, and the offsets of its fields. diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 0a9d725db58..c6dae24a63b 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -920,7 +920,7 @@ Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, Type *DestTy, if (Instruction::isCast(Opcode)) return ConstantFoldCastOperand(Opcode, Ops[0], DestTy, DL); - if(auto *GEP = dyn_cast<GEPOperator>(InstOrCE)) { + if (auto *GEP = dyn_cast<GEPOperator>(InstOrCE)) { if (Constant *C = SymbolicallyEvaluateGEP(GEP, Ops, DL, TLI)) return C; diff --git a/llvm/lib/Analysis/TypeMetadataUtils.cpp b/llvm/lib/Analysis/TypeMetadataUtils.cpp index 8d173d77fb6..31e2b42075d 100644 --- a/llvm/lib/Analysis/TypeMetadataUtils.cpp +++ b/llvm/lib/Analysis/TypeMetadataUtils.cpp @@ -41,7 +41,7 @@ findCallsAtConstantOffset(SmallVectorImpl<DevirtCallSite> &DevirtCalls, static void findLoadCallsAtConstantOffset(Module *M, SmallVectorImpl<DevirtCallSite> &DevirtCalls, - Value *VPtr, uint64_t Offset) { + Value *VPtr, int64_t Offset) { for (const Use &U : VPtr->uses()) { Value *User = U.getUser(); if (isa<BitCastInst>(User)) { @@ -52,7 +52,7 @@ findLoadCallsAtConstantOffset(Module *M, // Take into account the GEP offset. if (VPtr == GEP->getPointerOperand() && GEP->hasAllConstantIndices()) { SmallVector<Value *, 8> Indices(GEP->op_begin() + 1, GEP->op_end()); - uint64_t GEPOffset = M->getDataLayout().getIndexedOffsetInType( + int64_t GEPOffset = M->getDataLayout().getIndexedOffsetInType( GEP->getSourceElementType(), Indices); findLoadCallsAtConstantOffset(M, DevirtCalls, User, Offset + GEPOffset); } diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index dc4b8981be7..20a15fb8831 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -723,9 +723,9 @@ unsigned DataLayout::getLargestLegalIntTypeSizeInBits() const { return Max != LegalIntWidths.end() ? *Max : 0; } -uint64_t DataLayout::getIndexedOffsetInType(Type *ElemTy, - ArrayRef<Value *> Indices) const { - uint64_t Result = 0; +int64_t DataLayout::getIndexedOffsetInType(Type *ElemTy, + ArrayRef<Value *> Indices) const { + int64_t Result = 0; // We can use 0 as the address space as we don't need // to get pointer types back from gep_type_iterator. @@ -735,7 +735,7 @@ uint64_t DataLayout::getIndexedOffsetInType(Type *ElemTy, GTE = gep_type_end(ElemTy, AS, Indices); for (; GTI != GTE; ++GTI) { Value *Idx = GTI.getOperand(); - if (StructType *STy = dyn_cast<StructType>(*GTI)) { + if (auto *STy = dyn_cast<StructType>(*GTI)) { assert(Idx->getType()->isIntegerTy(32) && "Illegal struct idx"); unsigned FieldNo = cast<ConstantInt>(Idx)->getZExtValue(); @@ -747,7 +747,7 @@ uint64_t DataLayout::getIndexedOffsetInType(Type *ElemTy, } else { // Get the array index and the size of each array element. if (int64_t arrayIdx = cast<ConstantInt>(Idx)->getSExtValue()) - Result += (uint64_t)arrayIdx * getTypeAllocSize(GTI.getIndexedType()); + Result += arrayIdx * getTypeAllocSize(GTI.getIndexedType()); } } |