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
This commit is contained in:
Jakub Jelinek 2016-10-09 13:18:53 +02:00 committed by Jakub Jelinek
parent 67b974787c
commit 4dfb8a2a60
4 changed files with 28 additions and 1 deletions

View file

@ -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.

View file

@ -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.

View file

@ -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 ();
}

View file

@ -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;