[PATCH, rs6000] Fix alias set of link reg save MEM

Pat Haugen pthaugen@linux.ibm.com
Wed Jun 2 15:01:50 GMT 2021

On 6/2/21 9:19 AM, Segher Boessenkool wrote:
> 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).

Right, I realized after I sent the reply I was being a little too specific to __builtin_return_address(0). For non-zero args __builtin_return_address generates code to walk the appropriate number of stack frames back before loading the LR from the designated save area. All those mem references are using either frame-alias-set or 0 as their alias set, so we still should be fine. So regardless of the argument to the builtin, there is no connection between the current function's prologue LR save code and the code __builtin_return_address() would generate in the function.


More information about the Gcc-patches mailing list