[llvm-dev] Changing Alignment of global variables in LLVM
John Criswell via llvm-dev
llvm-dev at lists.llvm.org
Tue Oct 3 17:26:28 PDT 2017
On 10/3/17 6:41 PM, Matthias Braun via llvm-dev wrote:
>
>> On Oct 3, 2017, at 3:39 PM, Charith Mendis <char.mendis1989 at gmail.com
>> <mailto:char.mendis1989 at gmail.com>> wrote:
>>
>> If I know for sure I am accessing 32 byte chunks at a time, how can I
>> go about changing the alignment of @u?
>>
>> Should I use DataLayout's reset method? I couldn't find a method to
>> change alignment of one global variable.
> GlobalObject::setAlignment()?
This is what we used in BBAC and PAMD (ISMM 2017); these systems
transform globals to align them on a power-of-two boundary.
Regards,
John Criswell
>
> - Matthias
>
>>
>> Thanks
>>
>> On Tue, Oct 3, 2017 at 6:34 PM, Matthias Braun<mbraun at apple.com
>> <mailto:mbraun at apple.com>>wrote:
>>
>> The effective alignment is part of the load and store operations.
>> Updating those would mean that you need to know which ones are
>> based on the @u address.
>>
>> You can come up with some heuristics that track values through
>> getelementptr and similar constructs in llvm IR and which will
>> work in most cases.
>>
>> However as you can have arbitrary computations to create the
>> address for a load/store tracking the source of such computations
>> is actually undecidable in general and you may have cases where
>> you cannot determine the origin when allowing arbitrary IR.
>> Because of this I'd recommend to rather adjust the frontends type
>> system so the loads and stores are created with the correct
>> alignment in the first place.
>>
>> - Matthias
>>
>> > On Oct 3, 2017, at 3:25 PM, Charith Mendis via llvm-dev
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>> >
>> >
>> > What is the best way to change the alignment of global
>> variables and allocated structures in LLVM during one of its
>> optimization passes?
>> >
>> >
>> > For example, I want to change,
>> >
>> > @u = internal unnamed_addr global [5 x [65 x [65 x [65 x
>> double]]]] zeroinitializer, align 16
>> >
>> > to align to 32 bytes.
>> >
>> > How can this be accomplished so that all other references in
>> the code accessing this structure are also updated.
>> >
>> > Thank You
>> >
>> > --
>> > Kind regards,
>> > Charith Mendis
>> >
>> > Graduate Student,
>> > CSAIL,
>> > Massachusetts Institute of Technology
>> > _______________________________________________
>> > LLVM Developers mailing list
>> >llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> >http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>> <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
>>
>>
>>
>>
>> --
>> Kind regards,
>> Charith Mendis
>>
>> Graduate Student,
>> CSAIL,
>> Massachusetts Institute of Technology
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171003/756ed645/attachment.html>
More information about the llvm-dev
mailing list