diff options
Diffstat (limited to 'llvm/lib/Target/DirectX/DXILFlattenArrays.cpp')
| -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 88400b7f0312..db9fd31bfbc3 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"); |
