Bad codegen for ARM (and maybe others) when optimizing
Kai Nacke via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Sat Feb 7 06:46:39 PST 2015
Hi Dan!
On Friday, 6 February 2015 at 15:03:11 UTC, Dan Olson wrote:
> I think an ARM specific abi class is the right solution. On a
> whim, I tried one small change in abi.cpp
>
> bool passByVal(Type* t)
> {
> // was
> // return t->toBasetype()->ty == Tstruct;
> return false;
> }
>
> This gets rid of LLVM byval attribute and fixes this codegen
> problem. The generated instructions are similar to clang. The
> parameter is not an array like clang, it is the IR struct type
> as a value, but it works.
>
> "%badopt.A" instead of "%badopt.A* byval"
>
> Another thing I noticed about clang is that structs that fit in
> 32-bits are returned directly in r0 instead of an sret
> parameter. There may be more, I need to study clang.
We can add an ARM specific abi class. Could you just provide your
change as a pull request?
(I tried similar things in the past with the PPC backend. But at
some point it was easier to fix LLVM. :-)
Regards,
Kai
More information about the digitalmars-d-ldc
mailing list