aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2003-10-06 09:18:01 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-10-06 09:18:01 +0000
commit9ebfd78bad3cde0cb92ae3261314546fce5e949e (patch)
treeaa7bff17dc2ec7053af2c62a9b55799585b49947
parent8c03ca00a652f280811502a22cde311ef72cb861 (diff)
downloadgcc-9ebfd78bad3cde0cb92ae3261314546fce5e949e.zip
gcc-9ebfd78bad3cde0cb92ae3261314546fce5e949e.tar.gz
gcc-9ebfd78bad3cde0cb92ae3261314546fce5e949e.tar.bz2
re PR rtl-optimization/12215 (ICE in make_label_edge with -fnon-call-exceptions -fno-gcse -O2)
PR optimization/12215 * cse.c (cse_set_around_loop): Emit the move at the beginning of the next basic block for trapping sets. From-SVN: r72141
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cse.c10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/opt/cfg2.C38
4 files changed, 57 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e56e27..a0112d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
+ PR optimization/12215
+ * cse.c (cse_set_around_loop): Emit the move at the beginning
+ of the next basic block for trapping sets.
+
+2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
+
PR optimization/11637
* combine.c (adjust_for_new_dest): New function to adjust the
notes and LOG_LINKS when the dest of an insn has changed.
diff --git a/gcc/cse.c b/gcc/cse.c
index a4847a8..30355df 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6666,7 +6666,15 @@ cse_set_around_loop (rtx x, rtx insn, rtx loop_start)
abort ();
}
else
- emit_insn_after (move, p);
+ {
+ if (control_flow_insn_p (p))
+ /* p can cause a control flow transfer so it
+ is the last insn of a basic block. We can't
+ therefore use emit_insn_after. */
+ emit_insn_before (move, next_nonnote_insn (p));
+ else
+ emit_insn_after (move, p);
+ }
}
break;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0264d7a..48761b7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-10-06 Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+ * g++.dg/opt/cfg2.C: New test.
+
2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/opt/float1.C: New test.
diff --git a/gcc/testsuite/g++.dg/opt/cfg2.C b/gcc/testsuite/g++.dg/opt/cfg2.C
new file mode 100644
index 0000000..229f4bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/cfg2.C
@@ -0,0 +1,38 @@
+// PR optimization/12215
+// Origin: <nick@ilm.com>
+// Reduced testcase by Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// This used to fail because the CSE pass destroyed the CFG in presence
+// of trapping loads, which led to the deletion of basic blocks.
+
+// { dg-do compile }
+// { dg-options "-O2 -fno-gcse -fnon-call-exceptions" }
+
+
+struct B {
+ ~B() throw() {}
+};
+
+struct X {
+ X(const char*, const B&);
+ ~X() {}
+};
+
+bool m();
+void f(int &i, float &arg0);
+
+void g (const char **argv) {
+ float val;
+ int i = 1;
+
+ try {
+ while ( i < 1 )
+ {
+ X arg(argv[i], B());
+ if (m())
+ throw(0);
+
+ f(i, val);
+ }
+ } catch (...) {}
+}