[llvm-dev] SRET consistency between declaration and call site

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 6 13:33:17 PDT 2015


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.

Generally we try to make these sorts of things "work". For example, if you
pass parameters to a function pointer call and we later discover the
function takes no parameters, instcombine will discard the arguments rather
than making the call unreachable. IMO the same logic applies to ABI
attributes like sret.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151006/849a78c6/attachment.html>


More information about the llvm-dev mailing list