[llvm-dev] How exactly is datatype alignment determined?

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Mon May 22 05:55:26 PDT 2017


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


More information about the llvm-dev mailing list