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
This commit is contained in:
Eric Botcazou 2010-06-09 21:49:44 +00:00
parent 70987f6299
commit 642d55de0e
5 changed files with 36 additions and 10 deletions

View File

@ -1,3 +1,9 @@
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>
* bitmap.c (bitmap_and): Walk array forward.

View File

@ -94,14 +94,6 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
rtx body, x;
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)
/* We cannot delete calls inside of the recursive dce because
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)
&& !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
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);
switch (GET_CODE (body))
{

View File

@ -1617,6 +1617,8 @@ make_reg_eh_region_note_nothrow_nononlocal (rtx insn)
bool
insn_could_throw_p (const_rtx insn)
{
if (!flag_exceptions)
return false;
if (CALL_P (insn))
return true;
if (INSN_P (insn) && cfun->can_throw_non_call_exceptions)

View File

@ -1,7 +1,11 @@
2010-06-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/pr42461.c: New test.
2010-06-09 Daniel Franke <franke.daniel@gmail.com>
PR fortran/44347
* gfortran.dg/selected_real_kind_1.f90: New.
PR fortran/44347
* gfortran.dg/selected_real_kind_1.f90: New.
2010-06-09 Daniel Franke <franke.daniel@gmail.com>

View File

@ -0,0 +1,14 @@
/* 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;
}