From: Kugan Vivekanandarajah Date: Fri, 13 Jul 2018 05:25:47 +0000 (+0000) Subject: re PR tree-optimization/86489 (ICE in gimple_phi_arg starting with r261682 when build... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=061d40da00952fe7eabd8faae60e3cc4ac8f734a;p=gcc.git re PR tree-optimization/86489 (ICE in gimple_phi_arg starting with r261682 when building 531.deepsjeng_r with FDO + LTO) gcc/ChangeLog: 2018-07-13 Kugan Vivekanandarajah Richard Biener PR middle-end/86489 * tree-ssa-loop-niter.c (number_of_iterations_popcount): Check that the loop latch destination where phi is defined. gcc/testsuite/ChangeLog: 2018-07-13 Kugan Vivekanandarajah PR middle-end/86489 * gcc.dg/pr86489.c: New test. Co-Authored-By: Richard Biener From-SVN: r262622 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c955669e17..0cfa2309c61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-07-13 Kugan Vivekanandarajah + Richard Biener + + PR middle-end/86489 + * tree-ssa-loop-niter.c (number_of_iterations_popcount): Check + that the loop latch destination where phi is defined. + 2018-07-12 Kito Cheng * config/riscv/riscv.c (enum riscv_privilege_levels): Add UNKNOWN_MODE. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a5ace640fd1..9d6c7cc7d99 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-07-13 Kugan Vivekanandarajah + + PR middle-end/86489 + * gcc.dg/pr86489.c: New test. + 2018-07-12 Martin Sebor PR testsuite/86510 diff --git a/gcc/testsuite/gcc.dg/pr86489.c b/gcc/testsuite/gcc.dg/pr86489.c new file mode 100644 index 00000000000..c7e5573ebc2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86489.c @@ -0,0 +1,12 @@ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int a = 0, b = 0; +void fn1() { + int c = 0; + for (; a; a--) + c += b; + while ((c - 1) & c) + ; +} diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index f6fa2f74744..fbdf838496b 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2555,6 +2555,7 @@ number_of_iterations_popcount (loop_p loop, edge exit, ... = PHI . */ gimple *phi = SSA_NAME_DEF_STMT (b_11); if (gimple_code (phi) != GIMPLE_PHI + || (gimple_bb (phi) != loop_latch_edge (loop)->dest) || (gimple_assign_lhs (and_stmt) != gimple_phi_arg_def (phi, loop_latch_edge (loop)->dest_idx))) return false;