summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-09 21:49:44 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-09 21:49:44 +0000
commit827c9a9ee6cd1366ee336eb9f48a6b0fa70e7e16 (patch)
tree94bae21be77c1e10d071c24ca7c48b99738ab87d /gcc
parent0d290c9d17fe55e9c70da316068fd3fb2d0ab72d (diff)
downloadppe42-gcc-827c9a9ee6cd1366ee336eb9f48a6b0fa70e7e16.tar.gz
ppe42-gcc-827c9a9ee6cd1366ee336eb9f48a6b0fa70e7e16.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160507 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/dce.c16
-rw-r--r--gcc/except.c2
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/pr42461.c14
5 files changed, 36 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8c322d00a3e..409e3ca62e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/dce.c b/gcc/dce.c
index 38a5b307e7b..ee18b58c4ab 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -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))
{
diff --git a/gcc/except.c b/gcc/except.c
index cb4d8058ba5..16a02473a12 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d0154a9fe27..1f4d5527d17 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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>
diff --git a/gcc/testsuite/gcc.dg/pr42461.c b/gcc/testsuite/gcc.dg/pr42461.c
new file mode 100644
index 00000000000..9d23ad97292
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr42461.c
@@ -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;
+}
OpenPOWER on IntegriCloud