On Tue, Feb 03, 2015 at 11:14:49AM -0500, David Edelsohn wrote: > On Tue, Feb 3, 2015 at 8:57 AM, Alan Modra <amo...@gmail.com> wrote: > > PR target/64876 > > * config/rs6000/rs6000.c (chain_already_loaded): New function. > > (rs6000_call_aix): Use it. > > Okay with Jakub's suggested change.
No, Jakub's change doesn't work, even if I add the looping in chain_already_loaded that would need. We really do want to look at just (the last insn in) the previous sequence. The trouble is that the current sequence, ie. the one emitted for gen_call or gen_call_value, might be empty, *and* the previous sequence, the one emitted by calls.c:emit_call_1, might be empty at this point. (I found that fact out when my first implementation of chain_already_loaded lacked the "last != NULL" test.) In that case get_last_insn_anywhere() will give you rtl insns that aren't part of a call sequence, and r11 is a general register that might be used for anything. So a test for setting r11 is no longer a test for setting the static chain. -- Alan Modra Australia Development Lab, IBM