<div dir="ltr">If I know for sure I am accessing 32 byte chunks at a time, how can I go about changing the alignment of @u?<div><br></div><div>Should I use DataLayout's reset method? I couldn't find a method to change alignment of one global variable.</div><div><br></div><div>Thanks</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 3, 2017 at 6:34 PM, Matthias Braun <span dir="ltr"><<a href="mailto:mbraun@apple.com" target="_blank">mbraun@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
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.<br>
<br>
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.<br>
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.<br>
<br>
- Matthias<br>
<div><div class="h5"><br>
> On Oct 3, 2017, at 3:25 PM, Charith Mendis via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
><br>
> What is the best way to change the alignment of global variables and allocated structures in LLVM during one of its optimization passes?<br>
><br>
><br>
> For example, I want to change,<br>
><br>
> @u = internal unnamed_addr global [5 x [65 x [65 x [65 x double]]]] zeroinitializer, align 16<br>
><br>
> to align to 32 bytes.<br>
><br>
> How can this be accomplished so that all other references in the code accessing this structure are also updated.<br>
><br>
> Thank You<br>
><br>
> --<br>
> Kind regards,<br>
> Charith Mendis<br>
><br>
> Graduate Student,<br>
> CSAIL,<br>
> Massachusetts Institute of Technology<br>
</div></div>> ______________________________<wbr>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Kind regards,<br>Charith Mendis<br><br>Graduate Student,<div>CSAIL,<br><div>Massachusetts Institute of Technology</div></div></div></div></div>
</div>