This is the mail archive of the
mailing list for the GCC project.
PR 13469: reload_cse_regs & non-call exceptions
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ro at techfak dot uni-bielefeld dot de
- Date: Sat, 10 Jan 2004 12:33:15 +0000
- Subject: PR 13469: reload_cse_regs & non-call exceptions
This patch fixes PR optimization/13469, a verify_local_live_at_start
failure while building the o32 libjava multilib on mips-sgi-irix6.5.
To paraphrase from the PR notes:
It only seems to happen for sjlj exceptions (i.e., only when using
the SGI assembler). expand_builtin_setjmp_receiver() creates:
which forces the function to save and restore $fp. but isn't enough to
make it to set up a local frame pointer (frame_pointer_needed is 0).
In the end, nothing outside the prologue really uses $fp, so it is
only live on paths from function entry to the USE above. In other
words, after the prologue, $fp is only live at insn X if there is path
from X to an insn that may throw an exception.
In the test case, we reach the end of reload with two loads from the
same, potentially trapping, MEM. postreload manages to get rid of the
second MEM, converting the load to a register-to-register move.
Unfortunately, it keeps the REG_EH_REGION note and associated EH edge.
We almost get away with this. But the cprop pass manages to delete
the register-to-register move, along with its EH edge. Since nothing
after that can throw an exception, $fp is no longer live at this point,
but the flow information still says that it is.
The proposed fix is to run purge_all_dead_edges() after reload_cse_regs.
I think this should only be necessary for -fnon-call-exceptions.
I'm still having problems with libjava build process (probably due
to not having the right tools). But Rainer has bootstrapped this on
mips-sgi-irix6.5 (thanks!) and confirms there are no regressions.
OK to install?
* toplev.c (rest_of_compilation): Call purge_all_dead_edges after
reload_cse_regs (-fnon-call-exceptions only).
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.860
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.860 toplev.c
*** toplev.c 6 Jan 2004 16:51:20 -0000 1.860
--- toplev.c 10 Jan 2004 12:15:02 -0000
*************** rest_of_compilation (tree decl)
*** 3383,3388 ****
--- 3383,3392 ----
+ /* reload_cse_regs can eliminate potentially-trapping MEMs.
+ Remove any EH edges associated with them. */
+ if (flag_non_call_exceptions)
+ purge_all_dead_edges (0);