This is an archive of the discontinued LLVM Phabricator instance.

Update the LangRef description of the 'returned' attribute
AbandonedPublic

Authored by hfinkel on Jul 10 2016, 2:04 PM.

Details

Summary

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

Event Timeline

hfinkel updated this revision to Diff 63433.Jul 10 2016, 2:04 PM
hfinkel retitled this revision from to Update the LangRef description of the 'returned' attribute.
hfinkel updated this object.
hfinkel added a subscriber: llvm-commits.

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.

hfinkel abandoned this revision.Jul 10 2016, 2:32 PM

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.

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.