From cdc20ff6a7f12464aed70d9b6e67ea07da9f0399 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 9 Jan 2024 21:00:28 +0100 Subject: Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde. PR: 276104 MFC after: 1 month (cherry picked from commit 1db9f3b21e39176dd5b67cf8ac378633b172463e) --- contrib/llvm-project/llvm/lib/IR/Operator.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/IR/Operator.cpp') diff --git a/contrib/llvm-project/llvm/lib/IR/Operator.cpp b/contrib/llvm-project/llvm/lib/IR/Operator.cpp index cd982c7da102..16a89534b4b3 100644 --- a/contrib/llvm-project/llvm/lib/IR/Operator.cpp +++ b/contrib/llvm-project/llvm/lib/IR/Operator.cpp @@ -87,7 +87,7 @@ Align GEPOperator::getMaxPreservedAlignment(const DataLayout &DL) const { /// If the index isn't known, we take 1 because it is the index that will /// give the worse alignment of the offset. const uint64_t ElemCount = OpC ? OpC->getZExtValue() : 1; - Offset = DL.getTypeAllocSize(GTI.getIndexedType()) * ElemCount; + Offset = GTI.getSequentialElementStride(DL) * ElemCount; } Result = Align(MinAlign(Offset, Result.value())); } @@ -157,7 +157,7 @@ bool GEPOperator::accumulateConstantOffset( continue; } if (!AccumulateOffset(ConstOffset->getValue(), - DL.getTypeAllocSize(GTI.getIndexedType()))) + GTI.getSequentialElementStride(DL))) return false; continue; } @@ -170,8 +170,7 @@ bool GEPOperator::accumulateConstantOffset( if (!ExternalAnalysis(*V, AnalysisIndex)) return false; UsedExternalAnalysis = true; - if (!AccumulateOffset(AnalysisIndex, - DL.getTypeAllocSize(GTI.getIndexedType()))) + if (!AccumulateOffset(AnalysisIndex, GTI.getSequentialElementStride(DL))) return false; } return true; @@ -218,14 +217,13 @@ bool GEPOperator::collectOffset( continue; } CollectConstantOffset(ConstOffset->getValue(), - DL.getTypeAllocSize(GTI.getIndexedType())); + GTI.getSequentialElementStride(DL)); continue; } if (STy || ScalableType) return false; - APInt IndexedSize = - APInt(BitWidth, DL.getTypeAllocSize(GTI.getIndexedType())); + APInt IndexedSize = APInt(BitWidth, GTI.getSequentialElementStride(DL)); // Insert an initial offset of 0 for V iff none exists already, then // increment the offset by IndexedSize. if (!IndexedSize.isZero()) { -- cgit v1.2.3