[llvm-dev] sret vs noalias

Mikael Holmén via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 8 00:25:52 PDT 2016


Hi,

In ArgumentPromotion there is a piece of code that replaces the "sret" 
attribute with "noalias" and I'm puzzled about this:

// Replace sret attribute with noalias. This reduces register pressure by
// avoiding a register copy.

And the commit message when this was introduced says

"Because sret implies noalias, we also replace the former with the latter."

But if I read about "sret" at

  http://llvm.org/docs/LangRef.html#parameter-attributes

I don't see anything saying that "sret" must only be used when it 
doesn't alias with anything else?

Also, there are several backends that look for the "sret" attribute, how 
does that work if "sret" has already been removed by ArgumentPromotion 
when running opt?

And finally, if my own backend doesn't look at the "sret" attribute at 
all, is it then ok for my frontend to avoid emitting it, and just use 
noalias (when applicable) instead?

Thanks,
Mikael


More information about the llvm-dev mailing list