On Wed, Jun 02, 2021 at 08:23:48AM -0500, Pat Haugen wrote: > On 6/2/21 7:01 AM, Richard Biener wrote: > > So did you check the RTL (and alias-sets) produced by > > __builtin_return_address? Test coverage might > > be low here and w/o scheduling opportunities to break things. > > __builtin_return_address creates it's own copy of the link reg to a pseudo > upon function entry. It doesn't appear to try and "reuse" any LR copy/save > location that might be generated via the prolog code. References to > __builtin_return_address will then refer to that pseudo. So I don't see any > connection between the prolog save code and __builtin_return_address.
That is for __builtin_return_address(0), the simple (and always working) one. It is harder for non-zero arguments (although I don't see why those would not work, even with inlining). Segher