[LLVMdev] Functions: sret and readnone
baldrick at free.fr
Mon Oct 5 10:23:55 CDT 2009
> You might already have spotted that "readnone" attribute, which is
> causing some problems: The GVN optimization pass seems to treat the
> sret pointer just like any other pointer to memory and eliminates all
> calls to the function, since it sees it as returning void without
> touching any memory.
as explained in the language reference,
readonly functions must not write to any byval arguments.
The reason for this is that it allows the inliner to avoid introducing
a temporary variable and copy when inlining readonly functions with
a byval argument.
Is there a way to make sure that the GVN pass
> interpretes the sret argument as the actual return value of the
> function? Or are there other approaches I could try?
Not for the moment, sorry.
More information about the LLVMdev