diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2024-01-09 20:00:28 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-19 21:14:10 +0000 |
| commit | cdc20ff6a7f12464aed70d9b6e67ea07da9f0399 (patch) | |
| tree | 0c2f259d41b6d1f146c344cb9cf2b15ea99d35bb /contrib/llvm-project/llvm/lib/IR/DataLayout.cpp | |
| parent | 7adf29b6244fe016ef869f287a66048195f9af29 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/IR/DataLayout.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/IR/DataLayout.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/DataLayout.cpp b/contrib/llvm-project/llvm/lib/IR/DataLayout.cpp index e28f043cf9e0..a2f5714c7068 100644 --- a/contrib/llvm-project/llvm/lib/IR/DataLayout.cpp +++ b/contrib/llvm-project/llvm/lib/IR/DataLayout.cpp @@ -936,9 +936,8 @@ int64_t DataLayout::getIndexedOffsetInType(Type *ElemTy, // Add in the offset, as calculated by the structure layout info... Result += Layout->getElementOffset(FieldNo); } else { - // Get the array index and the size of each array element. - if (int64_t arrayIdx = cast<ConstantInt>(Idx)->getSExtValue()) - Result += arrayIdx * getTypeAllocSize(GTI.getIndexedType()); + if (int64_t ArrayIdx = cast<ConstantInt>(Idx)->getSExtValue()) + Result += ArrayIdx * GTI.getSequentialElementStride(*this); } } |
