diff options
author | Bernd Schmidt <bernds@redhat.com> | 2017-01-14 09:52:18 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-01-14 09:52:18 -0700 |
commit | 90aead2189d5af665c4d7616ea39b8aa7c2d98ce (patch) | |
tree | eaeedf40a4f149f49411c00916e82e192d0f2dcd | |
parent | afaecc23b57e1d6827f071a4d560ca57770b2e25 (diff) | |
download | gcc-90aead2189d5af665c4d7616ea39b8aa7c2d98ce.zip gcc-90aead2189d5af665c4d7616ea39b8aa7c2d98ce.tar.gz gcc-90aead2189d5af665c4d7616ea39b8aa7c2d98ce.tar.bz2 |
re PR rtl-optimization/78626 (ICE in rtl_verify_bb_insns, at cfgrtl.c:2656 (error: flow control insn inside a basic block))
PR rtl-optimization/78626
PR rtl-optimization/78727
* cprop.c (one_cprop_pass): Collect unconditional traps in the middle
of a block, and split such blocks after everything else is finished.
PR rtl-optimization/78626
PR rtl-optimization/78727
* gcc.dg/torture/pr78626.c: New test.
* gcc.dg/torture/pr78727.c: New test.
From-SVN: r244467
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cprop.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr78626.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr78727.c | 21 |
5 files changed, 86 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9106053..746f6af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-01-14 Bernd Schmidt <bschmidt@redhat.com> + + PR rtl-optimization/78626 + PR rtl-optimization/78727 + * cprop.c (one_cprop_pass): Collect unconditional traps in the middle + of a block, and split such blocks after everything else is finished. + 2017-01-14 Alan Modra <amodra@gmail.com> PR target/72749 diff --git a/gcc/cprop.c b/gcc/cprop.c index b210e94..b6c2bc4 100644 --- a/gcc/cprop.c +++ b/gcc/cprop.c @@ -1794,7 +1794,7 @@ one_cprop_pass (void) if (set_hash_table.n_elems > 0) { basic_block bb; - rtx_insn *insn; + auto_vec<rtx_insn *> uncond_traps; alloc_cprop_mem (last_basic_block_for_fn (cfun), set_hash_table.n_elems); @@ -1810,6 +1810,9 @@ one_cprop_pass (void) EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb) { + bool seen_uncond_trap = false; + rtx_insn *insn; + /* Reset tables used to keep track of what's still valid [since the start of the block]. */ reset_opr_set_tables (); @@ -1817,6 +1820,10 @@ one_cprop_pass (void) FOR_BB_INSNS (bb, insn) if (INSN_P (insn)) { + bool was_uncond_trap + = (GET_CODE (PATTERN (insn)) == TRAP_IF + && XEXP (PATTERN (insn), 0) == const1_rtx); + changed |= cprop_insn (insn); /* Keep track of everything modified by this insn. */ @@ -1825,11 +1832,27 @@ one_cprop_pass (void) insn into a NOTE, or deleted the insn. */ if (! NOTE_P (insn) && ! insn->deleted ()) mark_oprs_set (insn); + + if (!was_uncond_trap && !seen_uncond_trap + && GET_CODE (PATTERN (insn)) == TRAP_IF + && XEXP (PATTERN (insn), 0) == const1_rtx) + { + seen_uncond_trap = true; + uncond_traps.safe_push (insn); + } } } changed |= bypass_conditional_jumps (); + 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); + } + FREE_REG_SET (reg_set_bitmap); free_cprop_mem (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70ccd17..625c99a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-01-14 Bernd Schmidt <bschmidt@redhat.com> + + PR rtl-optimization/78626 + PR rtl-optimization/78727 + * gcc.dg/torture/pr78626.c: New test. + * gcc.dg/torture/pr78727.c: New test. + 2017-01-14 Alan Modra <amodra@gmail.com> * gcc.c-torture/compile/pr72749.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr78626.c b/gcc/testsuite/gcc.dg/torture/pr78626.c new file mode 100644 index 0000000..ed4775a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78626.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +int qs; + +void +ms (int g1) +{ + int cy; + int *fr = &cy; + + for (;;) + { + *fr = 1; + fr = &g1; + + while (qs != 0) + { + if (qs | cy) + qs = g1 / 0; /* { dg-warning "division" } */ + ++qs; + } + + cy = 1; + while (cy != 0) + cy = 2; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr78727.c b/gcc/testsuite/gcc.dg/torture/pr78727.c new file mode 100644 index 0000000..93cc3d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78727.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +int +dd (int gj, unsigned int o7) +{ + long long int e8 = gj; + + e8 |= gj + 1u; + if (e8 != 0) + { + short int *mn = (short int *)&e8; + int pv; + + e8 &= e8 > gj; + gj = o7 > e8; + pv = ((gj != 0) ? gj : *mn) && e8; + gj |= *mn / pv; + } + + return gj; +} |