aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.com>2017-01-21 00:23:47 -0700
committerJeff Law <law@gcc.gnu.org>2017-01-21 00:23:47 -0700
commitea9f867b7b5985b98e9f5c6ff9a2239f3a9e8496 (patch)
tree6c8e1db98a6dfd5fa2edebb68dae510fd895a9e5 /gcc
parent80b40b87845bf2293f2bfdd215bbf758db5ceff4 (diff)
downloadgcc-ea9f867b7b5985b98e9f5c6ff9a2239f3a9e8496.zip
gcc-ea9f867b7b5985b98e9f5c6ff9a2239f3a9e8496.tar.gz
gcc-ea9f867b7b5985b98e9f5c6ff9a2239f3a9e8496.tar.bz2
re PR rtl-optimization/79125 (ICE in rtl_verify_bb_insns, at cfgrtl.c:2661 (error: flow control insn inside a basic block))
2017-01-21 Bernd Schmidt <bschmidt@redhat.com> rtl-optimization/79125 * cprop.c (local_cprop_pass): Handle cases where we make an unconditional trap. PR rtl-optimization/79125 * gcc.dg/torture/pr79125.c: New test. From-SVN: r244741
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cprop.c20
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr79125.c32
4 files changed, 63 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 254e739..95c54e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-21 Bernd Schmidt <bschmidt@redhat.com>
+
+ rtl-optimization/79125
+ * cprop.c (local_cprop_pass): Handle cases where we make an
+ unconditional trap.
+
2017-01-20 Segher Boessenkool <segher@kernel.crashing.org>
PR target/61729
diff --git a/gcc/cprop.c b/gcc/cprop.c
index b6c2bc4..ae2f19d 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1248,6 +1248,8 @@ local_cprop_pass (void)
bool changed = false;
unsigned i;
+ auto_vec<rtx_insn *> uncond_traps;
+
cselib_init (0);
FOR_EACH_BB_FN (bb, cfun)
{
@@ -1255,6 +1257,9 @@ local_cprop_pass (void)
{
if (INSN_P (insn))
{
+ bool was_uncond_trap
+ = (GET_CODE (PATTERN (insn)) == TRAP_IF
+ && XEXP (PATTERN (insn), 0) == const1_rtx);
rtx note = find_reg_equal_equiv_note (insn);
do
{
@@ -1273,6 +1278,13 @@ local_cprop_pass (void)
break;
}
}
+ if (!was_uncond_trap
+ && GET_CODE (PATTERN (insn)) == TRAP_IF
+ && XEXP (PATTERN (insn), 0) == const1_rtx)
+ {
+ uncond_traps.safe_push (insn);
+ break;
+ }
if (insn->deleted ())
break;
}
@@ -1287,6 +1299,14 @@ local_cprop_pass (void)
cselib_finish ();
+ while (!uncond_traps.is_empty ())
+ {
+ rtx_insn *insn = uncond_traps.pop ();
+ basic_block to_split = BLOCK_FOR_INSN (insn);
+ remove_edge (split_block (to_split, insn));
+ emit_barrier_after_bb (to_split);
+ }
+
return changed;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 292731d..414eec5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-21 Bernd Schmidt <bschmidt@redhat.com>
+
+ PR rtl-optimization/79125
+ * gcc.dg/torture/pr79125.c: New test.
+
2017-01-20 Jiong Wang <jiong.wang@arm.com>
* testsuite/gcc.target/aarch64/return_address_sign_1.c: Enable on LP64
diff --git a/gcc/testsuite/gcc.dg/torture/pr79125.c b/gcc/testsuite/gcc.dg/torture/pr79125.c
new file mode 100644
index 0000000..b5a39f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr79125.c
@@ -0,0 +1,32 @@
+int za;
+
+void
+hl (void)
+{
+ short int o8 = 0;
+ short int m6 = 1;
+ short int *ni = &m6;
+
+ for (;;)
+ {
+ int af;
+ short int *fd = (short int *)&ni;
+
+ if (ni != 0)
+ {
+ if (m6 != 0)
+ *ni = 0;
+ else
+ za = 0;
+ af = (o8 * o8) || o8;
+ if (af == 0)
+ m6 /= 0; /* { dg-warning "division" } */
+ while (za != 0)
+ {
+ }
+ }
+ *fd = &o8; /* { dg-warning "without a cast" } */
+ for (af = 0; af < 2; ++af)
+ af = za;
+ }
+}