[llvm-dev] How to change CLang struct alignment behaviour?
Joan Lluch via llvm-dev
llvm-dev at lists.llvm.org
Tue May 14 14:21:03 PDT 2019
Hi Tim,
I am not sure about what you mean by “upstream” the function. I attach a text file with my proposed changes in case you can do something with it. It seems to me that the programmer that coded this function was already considering this, or maybe somebody spoiled it later, because it turns out that the problem is just a missing sentence in the function, that I have now added. I have tested it the best that I could for several targets, but I have not applied any systematised testing procedure.
I also found that not only the MSP430 target is affected, but also the MIPS16 target too.
For the MIPS16 you also need to remove the “getOptimalMemOpType” or make it return MVT::Other, because the current implementation returning a concrete MVT prevents the proposed changes to take the desired effect. The changes benefit the MIPS16 (llc -march=mips -mips-os16) because it’s a subtarget that does not support unaligned accesses.
Thanks for your help. The function is attached, it just has an added statement
John Lluch
> On 14 May 2019, at 19:55, Tim Northover <t.p.northover at gmail.com> wrote:
>
> Hi John,
>
> On Tue, 14 May 2019 at 17:51, Joan Lluch <joan.lluch at icloud.com> wrote:
>> This problem is also shared by the MSP430 target, and it’s very easy to reproduce by just compiling the code that I posted before.
>
> That's some good detective work; it definitely explains what you're
> seeing. Since MSP430 is affected it would probably be pretty easy to
> upstream an alignment-aware version of the function and test it, if
> you're keen. I'd promise to do a review promptly!
>
> Cheers.
>
> Tim.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190514/8454ab16/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FindOptimalMemOpLowering.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190514/8454ab16/attachment.txt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190514/8454ab16/attachment-0001.html>
More information about the llvm-dev
mailing list