This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make CSE path following use the CFG
On 12/12/06, Eric Botcazou <ebotcazou@libertysurf.fr> wrote:
Confirmed, testcase attached, compile p.adb at -O -mtune=pentium.
Yup, got it.
and the latter doesn't trap because of the new REG_EQUAL note.
I didn't even realize that this could happen.
What do you think of the attached patch?
Gr.
Steven
* cse.c (cse_insn): When adding a REG_EQUAL note to an insn
that may trap, check if the note makes the insn non-trapping,
and remove redundante CFG edges if it does.
Index: cse.c
===================================================================
--- cse.c (revision 119741)
+++ cse.c (working copy)
@@ -4974,12 +4969,26 @@ cse_insn (rtx insn, rtx libcall_insn)
/* We only want a REG_EQUAL note if src_const != src. */
if (! rtx_equal_p (src, src_const))
{
+ rtx note;
+
/* Make sure that the rtx is not shared. */
src_const = copy_rtx (src_const);
/* Record the actual constant value in a REG_EQUAL note,
- making a new one if one does not already exist. */
- set_unique_reg_note (insn, REG_EQUAL, src_const);
+ making a new one if one does not already exist. This
+ must always succeed. */
+ note = set_unique_reg_note (insn, REG_EQUAL, src_const);
+ gcc_assert (note);
+
+ /* With non-call exceptions, if this was an insn that could
+ trap, we may have made it non-throwing now. For example
+ we may made a float extend non-trapping thanks to a new
+ REG_EQUAL note. */
+ if (flag_non_call_exceptions
+ && insn == BB_END (BLOCK_FOR_INSN (insn))
+ && may_trap_p (PATTERN (insn))
+ && !may_trap_p (XEXP (note, 0)))
+ purge_dead_edges (BLOCK_FOR_INSN (insn));
}
}