[llvm-dev] Over-alignment of globals?

Johannes Doerfert via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 24 14:36:33 PDT 2020


On 6/24/20 3:49 PM, Eli Friedman via llvm-dev wrote:
> LLVM IR doesn't try to distinguish whether the alignment was specified explicitly or implicitly at the source level.  We could change that, I guess, but I'm not sure what the goal would be; programs don't really have control over the layout of their .data section anyway.

I would prefer not to add more complexity to the alignment of globals if 
we don't have a particular benefit.

We'll introduce new exciting bugs otherwise, eventually ...


> -Eli
>
>> -----Original Message-----
>> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Luís Marques
>> via llvm-dev
>> Sent: Wednesday, June 24, 2020 1:04 PM
>> To: llvm-dev <llvm-dev at lists.llvm.org>
>> Subject: [EXT] [llvm-dev] Over-alignment of globals?
>>
>> Hi,
>>
>> If we specify an explicit alignment attribute for globals (either at
>> the Clang or LLVM IR level) we get asm alignment directives with
>> values that seem to be `max(natural_alignment, specified_alignment)`.
>> This seems to happen for multiple archs. GCC instead just emits the
>> asked-for alignment. Is there a good reason for this LLVM behavior?
>>
>> Example:
>> https://godbolt.org/z/B5ZcN_ (Clang)
>> https://godbolt.org/z/qpV7PV (GCC)
>>
>> Thanks,
>> Luís
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list