[LLVMdev] Functions: sret and readnone

Duncan Sands baldrick at free.fr
Mon Oct 5 08:23:55 PDT 2009


Hi Stephan,

> 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,
  http://llvm.org/docs/LangRef.html,
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.

Ciao,

Duncan.



More information about the llvm-dev mailing list