Commit 642d55de by Eric Botcazou

re PR rtl-optimization/42461 (missed optimization for pure functions)

	PR rtl-optimization/42461
	* dce.c (deletable_insn_p): Return true for const or pure calls again.
	* except.c (insn_could_throw_p): Return false if !flag_exceptions.

From-SVN: r160507
parent 70987f62
2010-06-09 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/42461
* dce.c (deletable_insn_p): Return true for const or pure calls again.
* except.c (insn_could_throw_p): Return false if !flag_exceptions.
2010-06-09 Jan Hubicka <jh@suse.cz> 2010-06-09 Jan Hubicka <jh@suse.cz>
* bitmap.c (bitmap_and): Walk array forward. * bitmap.c (bitmap_and): Walk array forward.
......
...@@ -94,14 +94,6 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores) ...@@ -94,14 +94,6 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
rtx body, x; rtx body, x;
int i; int i;
/* Don't delete jumps, notes and the like. */
if (!NONJUMP_INSN_P (insn))
return false;
/* Don't delete insns that can throw. */
if (!insn_nothrow_p (insn))
return false;
if (CALL_P (insn) if (CALL_P (insn)
/* We cannot delete calls inside of the recursive dce because /* We cannot delete calls inside of the recursive dce because
this may cause basic blocks to be deleted and this messes up this may cause basic blocks to be deleted and this messes up
...@@ -116,6 +108,14 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores) ...@@ -116,6 +108,14 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
&& !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))) && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
return find_call_stack_args (insn, false, fast, arg_stores); return find_call_stack_args (insn, false, fast, arg_stores);
/* Don't delete jumps, notes and the like. */
if (!NONJUMP_INSN_P (insn))
return false;
/* Don't delete insns that can throw. */
if (!insn_nothrow_p (insn))
return false;
body = PATTERN (insn); body = PATTERN (insn);
switch (GET_CODE (body)) switch (GET_CODE (body))
{ {
......
...@@ -1617,6 +1617,8 @@ make_reg_eh_region_note_nothrow_nononlocal (rtx insn) ...@@ -1617,6 +1617,8 @@ make_reg_eh_region_note_nothrow_nononlocal (rtx insn)
bool bool
insn_could_throw_p (const_rtx insn) insn_could_throw_p (const_rtx insn)
{ {
if (!flag_exceptions)
return false;
if (CALL_P (insn)) if (CALL_P (insn))
return true; return true;
if (INSN_P (insn) && cfun->can_throw_non_call_exceptions) if (INSN_P (insn) && cfun->can_throw_non_call_exceptions)
......
2010-06-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/pr42461.c: New test.
2010-06-09 Daniel Franke <franke.daniel@gmail.com> 2010-06-09 Daniel Franke <franke.daniel@gmail.com>
PR fortran/44347 PR fortran/44347
* gfortran.dg/selected_real_kind_1.f90: New. * gfortran.dg/selected_real_kind_1.f90: New.
2010-06-09 Daniel Franke <franke.daniel@gmail.com> 2010-06-09 Daniel Franke <franke.daniel@gmail.com>
......
/* PR rtl-optimization/42461 */
/* Reported by Patrick Pelissier <patrick.pelissier@gmail.com> */
/* { dg-do link } */
/* { dg-options "-O" } */
extern int link_failure (int) __attribute__ ((pure));
int main (void)
{
if (link_failure (0) < 1)
__builtin_unreachable ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment