diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-09 13:18:53 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-09 13:18:53 +0200 |
commit | 4dfb8a2a60a582b0a1cab65f34d706cf961c9d20 (patch) | |
tree | 575c2ff14712a649731088bf4d9e47de753bc32b /gcc | |
parent | 67b974787c1e77ebebb4f36cdf09ac11a5690f43 (diff) | |
download | gcc-4dfb8a2a60a582b0a1cab65f34d706cf961c9d20.zip gcc-4dfb8a2a60a582b0a1cab65f34d706cf961c9d20.tar.gz gcc-4dfb8a2a60a582b0a1cab65f34d706cf961c9d20.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr77901.c | 10 | ||||
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 6 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9659fbf..02a2868 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-10-09 Jakub Jelinek <jakub@redhat.com> + + 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 <prathamesh.kulkarni@linaro.org> * ipa-cp.c (ipcp_alignment_lattice): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e69c4d..ec28259 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-09 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/77901 + * gcc.c-torture/compile/pr77901.c: New test. + 2016-10-09 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * 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 0000000..5c3936a --- /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 c5b36ef..7666365 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; |