[llvm-dev] SRET consistency between declaration and call site
Joerg Sonnenberger via llvm-dev
llvm-dev at lists.llvm.org
Tue Oct 6 14:02:04 PDT 2015
On Tue, Oct 06, 2015 at 01:33:17PM -0700, Reid Kleckner wrote:
> On Tue, Oct 6, 2015 at 1:21 PM, Joerg Sonnenberger via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> > Can you give an example of where it would trigger in LTO and when should
> > not?
> You could imagine that __muldc3 might be implemented in C, and it might be
> implemented without using _Complex so that it can be compiled by a compiler
> without _Complex support. Instead of using a _Complex double return type,
> it would use a pointer outparam as the first parameter, and it would return
> that pointer as usual in RAX. Yes, this is a prototype mismatch and
> probably UB according to C, but this might be part of an implementation
> which knows something about the platform lowering.
This argument is really not convincing to me. If you have LLVM IR, you
are starting from a frontend that should be supporting complex already.
This really sounds like a case that should be flagged to fix up legacy
code and not something to silently hide. Does code like this (manually
turning structure returns into explicit pointers) actually exist? Note
that the normal way for doing the complex thing is to define a two
element structure, which would still give the sret.
More information about the llvm-dev