Fix PR15293: ARM codegen ice - expected larger existing stack allocation

Renato Golin renato.golin at linaro.org
Thu Mar 28 04:30:37 PDT 2013


Hi Stepan,

So, the attached C code translates as the attached IR wrt struct by-val
return/argument passing. You can see that Clang lowers it to an array ([3 x
i64] %f.coerce) when passing arguments on ARM, but uses sret (%struct.Foo*
noalias sret %agg.result) when returning. This is due to the unimplemented
features in the ARM back-end, AFAIK.

Compare that with Intel's IR:

ARM:
define void @printFoo([3 x i64] %f.coerce) #0 {

x86_64:
define void @printFoo(%struct.Foo* byval align 8 %f) #0 {


I don't want to discourage you to implementing them now, it'd actually be a
great improvement, but if you don't change (at least) Clang (and probably
dragonegg too) to use the new constructs, they will go untested and it'll
break when people try to use it.

This has happened before with struct byval and union support and the
decision was to remove the support completely until some good soul would
implement them entirely and move the relevant front-ends to use it, so we
can test it.

If you have that kind of time and are willing to go the full length,
please, by all means, implement struct byval in the ARM back-end. It'd be a
great addition! But if you're only trying to get your front-end to produce
beautiful IR on a small subset of the problem, I recommend that you follow
Clang's example and cast to an array.

cheers,
--renato

PS: This example is producing *very* bad code, even at O3... A byval change
would probably make it *much* more efficient!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130328/b396bab7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: struct-byval.zip
Type: application/zip
Size: 2225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130328/b396bab7/attachment.zip>


More information about the llvm-commits mailing list