The description of the 'returned' attribute says that it is only used when optimizing the function itself, but not the callee. This is already not quite right (at least for the WebAssembly backend: lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp), and I'd like to make the optimizer smarter about looking through functions with returned arguments (generally, but motivated by my llvm.noalias work). As David pointed out in the review of D22202, this will require updating the LangRef.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
The referenced WebAssembly optimization is a caller-side optimization, not a callee-side optimization, so it itself isn't actually a motivation for this LangRef change.
Also, it's not clear what the optimization purpose of returned would be in the callee. If some IR producer or transformer knows that one of the argument values is returned, it should just set the return operand(s) to use the argument value, or a bitcast thereof, and let SSA form to describe the property naturally.
Comment Actions
Yep. I'm not sure what I was thinking. I think perhaps David meant to generalize the description of the caller-side optimizations. I'll post a different patch.