Dr. ERDI Gergo via llvm-dev
2017-May-22 12:49 UTC
[llvm-dev] How exactly is datatype alignment determined?
Hi, I'm seeing a bug in the AVR backend that seems to be caused by LLVM thinking things will be aligned to 8 bytes whereas they are unaligned. Specifically, MF->getDataLayout().getPrefTypeAlignment(Ty) returns 8 for the following two types: %opt = type { i8, [0 x i8], [3 x i8] } %Machine = type { i16, [0 x i8], i16, [0 x i8], [16 x i8], [0 x i8] } The target datalayout specifies that pointers are aligned to 8 bits (i.e. unaligned), so I would expect getPrefTypeAlignment to return 1: target datalayout = "e-S8:p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8" So where does that datatype alignment result of 8 come from? Thanks, Gergo
Krzysztof Parzyszek via llvm-dev
2017-May-22 12:55 UTC
[llvm-dev] How exactly is datatype alignment determined?
Probably from LargeArrayMinWidth/LargeArrayAlign settings in Targets.cpp (in clang). -Krzysztof On 5/22/2017 7:49 AM, Dr. ERDI Gergo via llvm-dev wrote:> Hi, > > I'm seeing a bug in the AVR backend that seems to be caused by LLVM > thinking things will be aligned to 8 bytes whereas they are unaligned. > Specifically, MF->getDataLayout().getPrefTypeAlignment(Ty) returns 8 for > the following two types: > > %opt = type { i8, [0 x i8], [3 x i8] } > %Machine = type { i16, [0 x i8], i16, [0 x i8], [16 x i8], [0 x i8] } > > The target datalayout specifies that pointers are aligned to 8 bits > (i.e. unaligned), so I would expect getPrefTypeAlignment to return 1: > > target datalayout = "e-S8:p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8" > > So where does that datatype alignment result of 8 come from? > > Thanks, > Gergo > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Dr. ERDI Gergo via llvm-dev
2017-May-22 14:48 UTC
[llvm-dev] How exactly is datatype alignment determined?
On Mon, 22 May 2017, Krzysztof Parzyszek via llvm-dev wrote:> Probably from LargeArrayMinWidth/LargeArrayAlign settings in Targets.cpp (in > clang).Wait what? In clang? But my input is already LLVM IR. MF->getDataLayout().getPrefTypeAlignment(Ty) must be basing its answer on either something in the IR file, or in the target implementation, but clang is not really in the picture.
Reasonably Related Threads
- How exactly is datatype alignment determined?
- How exactly is datatype alignment determined?
- How exactly is datatype alignment determined?
- How to get CLang array alloca alignments to be smaller than 16 bytes?
- How to get CLang array alloca alignments to be smaller than 16 bytes?