diff options
author | Icohedron <cheung.deric@gmail.com> | 2025-07-08 18:20:37 +0000 |
---|---|---|
committer | Icohedron <cheung.deric@gmail.com> | 2025-07-08 18:20:37 +0000 |
commit | bc5b053fb4be41ff2696219867df4362fdc30923 (patch) | |
tree | 8128e2a2a12309a077ec02941e746ccf1e4c88be | |
parent | 56ea5b8d94ea45d4678694c45b75c325fbc14f2b (diff) | |
download | llvm-users/Icohedron/pr-146173.zip llvm-users/Icohedron/pr-146173.tar.gz llvm-users/Icohedron/pr-146173.tar.bz2 |
Use DL.getTypeAllocSize to get BytesPerElemusers/Icohedron/pr-146173
-rw-r--r-- | llvm/lib/Target/DirectX/DXILFlattenArrays.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/Target/DirectX/DXILFlattenArrays.cpp b/llvm/lib/Target/DirectX/DXILFlattenArrays.cpp index 88400b7..db9fd31 100644 --- a/llvm/lib/Target/DirectX/DXILFlattenArrays.cpp +++ b/llvm/lib/Target/DirectX/DXILFlattenArrays.cpp @@ -300,11 +300,8 @@ bool DXILFlattenArraysVisitor::visitGetElementPtrInst(GetElementPtrInst &GEP) { ReplaceThisGEP = true; if (ReplaceThisGEP) { - // GEP.collectOffset returns the offset in bytes. So we need to divide its - // offsets by the size in bytes of the element type - unsigned BytesPerElem = Info.RootFlattenedArrayType->getArrayElementType() - ->getPrimitiveSizeInBits() / - 8; + unsigned BytesPerElem = + DL.getTypeAllocSize(Info.RootFlattenedArrayType->getArrayElementType()); assert(isPowerOf2_32(BytesPerElem) && "Bytes per element should be a power of 2"); |