diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-02-07 17:45:57 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-02-07 17:45:57 +0000 |
commit | 7458afd6b35c4851d146f058435ba3dd6215db44 (patch) | |
tree | 2e97b42f4bcb11e9680fb7d5113f0f25d40832bc | |
parent | af18e61aad2f926a5942ab5fa1a1e6ede13786de (diff) | |
download | gcc-7458afd6b35c4851d146f058435ba3dd6215db44.tar.gz |
PR rtl-optimization/79386
* cprop.c (bypass_conditional_jumps): Initialize
bypass_last_basic_block already before splitting bbs after
unconditional traps...
(bypass_conditional_jumps): ... rather than here.
* gcc.c-torture/compile/pr79386.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245251 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cprop.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr79386.c | 46 |
4 files changed, 62 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18c20836ed8..c5f5f13d5c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2017-02-07 Jakub Jelinek <jakub@redhat.com> + PR rtl-optimization/79386 + * cprop.c (bypass_conditional_jumps): Initialize + bypass_last_basic_block already before splitting bbs after + unconditional traps... + (bypass_conditional_jumps): ... rather than here. + PR target/79299 * config/i386/sse.md (xtg_mode, gatherq_mode): New mode attrs. (*avx512f_gathersi<mode>, *avx512f_gathersi<mode>_2, diff --git a/gcc/cprop.c b/gcc/cprop.c index f704a0d1f5e..e315e53b695 100644 --- a/gcc/cprop.c +++ b/gcc/cprop.c @@ -1697,7 +1697,6 @@ bypass_conditional_jumps (void) if (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) return 0; - bypass_last_basic_block = last_basic_block_for_fn (cfun); mark_dfs_back_edges (); changed = 0; @@ -1863,6 +1862,11 @@ one_cprop_pass (void) } } + /* Make sure bypass_conditional_jumps will ignore not just its new + basic blocks, but also the ones after unconditional traps (those are + unreachable and will be eventually removed as such). */ + bypass_last_basic_block = last_basic_block_for_fn (cfun); + while (!uncond_traps.is_empty ()) { rtx_insn *insn = uncond_traps.pop (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2741631a4f2..7d793de238f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-07 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/79386 + * gcc.c-torture/compile/pr79386.c: New test. + 2017-02-07 Dominik Vogt <vogt@linux.vnet.ibm.com> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> diff --git a/gcc/testsuite/gcc.c-torture/compile/pr79386.c b/gcc/testsuite/gcc.c-torture/compile/pr79386.c new file mode 100644 index 00000000000..21b77597247 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr79386.c @@ -0,0 +1,46 @@ +/* PR rtl-optimization/79386 */ + +int a, b; + +int +foo (int x) +{ + int c; + int *d, *e; + + if (b == 0) + { + c = 0; + e = &b; + d = &b; + } + else + { + int f; + + c = 1; + for (f = 0; f < 9; ++f) + c *= 3; + e = (int *) (__UINTPTR_TYPE__) c; + d = &x; + } + *e = c < 3; + if (*e != 0) + { + int g; + + b += (a != 0) ? a : 1; + if (g != 0 || x != 0) + *d = 0; + if (b >= 0) + { + if (g != 0) + g = x; + if (*d / g != 0) + for (;;) + ; + } + } + + return b * (a != 0 && *d != 0); +} |