This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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:

        (use $fp)

    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?


	PR optimization/13469
	* toplev.c (rest_of_compilation): Call purge_all_dead_edges after
	reload_cse_regs (-fnon-call-exceptions only).

Index: toplev.c
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 ----
        timevar_push (TV_RELOAD_CSE_REGS);
        reload_cse_regs (insns);
+       /* 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);
        timevar_pop (TV_RELOAD_CSE_REGS);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]