[llvm-dev] SRET consistency between declaration and call site
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Sat Oct 3 08:43:49 PDT 2015
Hi Joerg,
On 3 October 2015 at 02:29, Joerg Sonnenberger via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> while debugging assertions when building libm for 32bit Sparc, I hit the
> following IR:
>
> complex_mul_libcall:
> call void @__muldc3({ double, double }* sret %tmp, double %conv, double 0.000000e+00, double %a.real, double %a.imag) #2
>
> ...
>
> declare void @__muldc3({ double, double }*, double, double, double, double)
>
> The same IR is essentially generated for i386 too, so it is not Sparc
> specific. Unlike i386, Sparc has an assertion in its codegen that the
> function called must have the sret attribute on corresponding argument.
I think we should view this as a special case of bitcasting functions
to different types (not quite types because it turns out function
attributes aren't part of the type in IR, but morally the same thing).
LLVM allows those casts normally.
It's more difficult to justify for actually declared globals (rather
than random pointers), but I'm still reluctant to ban it outright.
Tim.
More information about the llvm-dev
mailing list