From: Bin Cheng Date: Wed, 20 Jul 2016 08:31:35 +0000 (+0000) Subject: re PR tree-optimization/71503 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=04ac4afa844abb88a4a3bddd9dbfe5572d38aea4;p=gcc.git re PR tree-optimization/71503 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in "gen_phi_arg_condition") PR tree-optimization/71503 PR tree-optimization/71683 * tree-if-conv.c (gen_phi_arg_condition): Record true predicate and break. gcc/testsuite PR tree-optimization/71503 PR tree-optimization/71683 * gcc.dg/tree-ssa/ifc-pr71503.c: New test. * gcc.dg/tree-ssa/ifc-pr71683.c: New test. From-SVN: r238512 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82a473794e5..0b2eac8bccf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-07-20 Bin Cheng + + PR tree-optimization/71503 + PR tree-optimization/71683 + * tree-if-conv.c (gen_phi_arg_condition): Record true predicate + and break. + 2016-07-20 Martin Liska * doc/invoke.texi (-fipa-ra): Document when the option is diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f42fad4064..e631db95057 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-07-20 Bin Cheng + + PR tree-optimization/71503 + PR tree-optimization/71683 + * gcc.dg/tree-ssa/ifc-pr71503.c: New test. + * gcc.dg/tree-ssa/ifc-pr71683.c: New test. + 2016-07-20 Martin Liska * gcc.dg/plugin/plugin.exp: Remove sreal test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71503.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71503.c new file mode 100644 index 00000000000..5a90abfd10e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71503.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" { target *-*-* } } */ + +int a, b; +unsigned long d; +void fn1() { + unsigned long *h = &d; +line1 : { + int i = 4; + for (; b; i++) { + d = ((d + 6 ?: *h) ? a : 7) && (i &= 0 >= b); + b += a; + } +} + h = 0; + for (; *h;) + goto line1; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71683.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71683.c new file mode 100644 index 00000000000..851be37e48c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-pr71683.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" { target *-*-* } } */ + +short unsigned int ve; + +void +u1 (void) +{ + int oq = 0; + + while (ve != 0) + { + int j4, w7 = oq; + + oq = 0 / oq; + ve %= oq; + j4 = ve ^ 1; + ve ^= oq; + if (j4 != 0 ? j4 : ve) + oq = ve; + else + if (w7 != 0) + oq = ve; + } +} diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index e5a3372cd4e..4253d194ed4 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1687,7 +1687,10 @@ gen_phi_arg_condition (gphi *phi, vec *occur, e = gimple_phi_arg_edge (phi, (*occur)[i]); c = bb_predicate (e->src); if (is_true_predicate (c)) - continue; + { + cond = c; + break; + } c = force_gimple_operand_gsi_1 (gsi, unshare_expr (c), is_gimple_condexpr, NULL_TREE, true, GSI_SAME_STMT);