From: Jakub Jelinek Date: Sun, 9 Oct 2016 11:18:53 +0000 (+0200) Subject: re PR tree-optimization/77901 (ICE in tree-sse-reassoc,c:2881) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4dfb8a2a60a582b0a1cab65f34d706cf961c9d20;p=gcc.git re PR tree-optimization/77901 (ICE in tree-sse-reassoc,c:2881) PR tree-optimization/77901 * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Only optimize if ranges[i].exp is SSA_NAME when looking for >= and only when ranges[i].exp is NULL or SSA_NAME when looking for the other comparison. * gcc.c-torture/compile/pr77901.c: New test. From-SVN: r240899 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9659fbf7f5d..02a286806ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-10-09 Jakub Jelinek + + PR tree-optimization/77901 + * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Only optimize + if ranges[i].exp is SSA_NAME when looking for >= and only when + ranges[i].exp is NULL or SSA_NAME when looking for the other + comparison. + 2016-10-09 Prathamesh Kulkarni * ipa-cp.c (ipcp_alignment_lattice): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e69c4dddf5..ec2825978a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-09 Jakub Jelinek + + PR tree-optimization/77901 + * gcc.c-torture/compile/pr77901.c: New test. + 2016-10-09 Prathamesh Kulkarni * gcc.dg/ipa/propalign-1.c: Adjust scan-ipa-dump. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr77901.c b/gcc/testsuite/gcc.c-torture/compile/pr77901.c new file mode 100644 index 00000000000..5c3936af65a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr77901.c @@ -0,0 +1,10 @@ +/* PR tree-optimization/77901 */ + +void bar (void); + +void +foo (int *x, long *y) +{ + if (*y && *x != 10 && *x != 12 && *y >= 0) + bar (); +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index c5b36ef2ced..76663654815 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2846,7 +2846,9 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, for (i = first; i < length; i++) { - if (ranges[i].exp == NULL_TREE || !ranges[i].in_p) + if (ranges[i].exp == NULL_TREE + || TREE_CODE (ranges[i].exp) != SSA_NAME + || !ranges[i].in_p) continue; tree type = TREE_TYPE (ranges[i].exp); @@ -2878,6 +2880,8 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, tree rhs1, rhs2; if (ranges[i].exp) { + if (TREE_CODE (ranges[i].exp) != SSA_NAME) + continue; stmt = SSA_NAME_DEF_STMT (ranges[i].exp); if (!is_gimple_assign (stmt)) continue;