[llvm-dev] Changing Alignment of global variables in LLVM

Charith Mendis via llvm-dev
Tue, 03 Oct 2017 22:39:18 -0000

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.

Thanks

On Tue, Oct 3, 2017 at 6:34 PM, Matthias Braun <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> 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
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>


--
Kind regards,
Charith Mendis

Graduate Student,
CSAIL,
Massachusetts Institute of Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20171003/e71f41e6/attachment.html>