On 03/02/2018 12:45 PM, Peter Bergner wrote: > While debugging the PR84264 ICE caused by the following test case: > > void _setjmp (); > void a (unsigned long *); > void > b () > { > for (;;) > { > _setjmp (); > unsigned long args[9]{}; > a (args); > } > } > > I noticed that IRA is spilling all pseudos that are live across the call > to setjmp. Why is that? Trying to look through the history of this, I see > Jim committed a patch to reload that removed it spilling everything across > all setjmps: > > https://gcc.gnu.org/ml/gcc-patches/2003-11/msg01667.html > > But currently ira-lives.c:process_bb_node_lives() has: > > /* Don't allocate allocnos that cross setjmps or any > call, if this function receives a nonlocal > goto. */ > if (cfun->has_nonlocal_label > || find_reg_note (insn, REG_SETJMP, > NULL_RTX) != NULL_RTX) > { > SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj)); > SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)); > } > > ...which forces us to spill everything live across the setjmp by forcing > the pseudos to interfere all hardregs. That can't be good for performance. > What am I missing? You might want to hold off a bit. I've got changes for 21161 which can help this significantly. Basically the live-across-setjmp set is way too conservative -- it includes everything live at the setjmp, but it really just needs what's live on the longjump path.
As for why, I believe it's related to trying to make sure everything has the right values if we perform a longjmp. I'll can include testing 84264 to see if my work helps there. jeff