Commit b51ee78c by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/80072 (ICE in gimple_build_assign_1 with -O3…

re PR tree-optimization/80072 (ICE in gimple_build_assign_1 with -O3 -march=broadwell/skylake-avx512)

	PR tree-optimization/80072
	* tree-ssa-reassoc.c (struct operand_entry): Change id field type
	to unsigned int.
	(next_operand_entry_id): Change type to unsigned int.
	(sort_by_operand_rank): Make sure to return the right return value
	even if unsigned fields are bigger than INT_MAX.
	(struct oecount): Change cnt and id type to unsigned int.
	(oecount_hasher::equal): Formatting fix.
	(oecount_cmp): Make sure to return the right return value
	even if unsigned fields are bigger than INT_MAX.
	(undistribute_ops_list): Change next_oecount_id type to unsigned int.

From-SVN: r246408
parent 36c1cf71
2017-03-22 Jakub Jelinek <jakub@redhat.com> 2017-03-22 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/80072
* tree-ssa-reassoc.c (struct operand_entry): Change id field type
to unsigned int.
(next_operand_entry_id): Change type to unsigned int.
(sort_by_operand_rank): Make sure to return the right return value
even if unsigned fields are bigger than INT_MAX.
(struct oecount): Change cnt and id type to unsigned int.
(oecount_hasher::equal): Formatting fix.
(oecount_cmp): Make sure to return the right return value
even if unsigned fields are bigger than INT_MAX.
(undistribute_ops_list): Change next_oecount_id type to unsigned int.
PR c++/80129 PR c++/80129
* gimplify.c (gimplify_modify_expr_rhs) <case COND_EXPR>: Clear * gimplify.c (gimplify_modify_expr_rhs) <case COND_EXPR>: Clear
TREE_READONLY on result if writing it more than once. TREE_READONLY on result if writing it more than once.
......
...@@ -193,7 +193,7 @@ static struct ...@@ -193,7 +193,7 @@ static struct
struct operand_entry struct operand_entry
{ {
unsigned int rank; unsigned int rank;
int id; unsigned int id;
tree op; tree op;
unsigned int count; unsigned int count;
gimple *stmt_to_insert; gimple *stmt_to_insert;
...@@ -204,7 +204,7 @@ static object_allocator<operand_entry> operand_entry_pool ...@@ -204,7 +204,7 @@ static object_allocator<operand_entry> operand_entry_pool
/* This is used to assign a unique ID to each struct operand_entry /* This is used to assign a unique ID to each struct operand_entry
so that qsort results are identical on different hosts. */ so that qsort results are identical on different hosts. */
static int next_operand_entry_id; static unsigned int next_operand_entry_id;
/* Starting rank number for a given basic block, so that we can rank /* Starting rank number for a given basic block, so that we can rank
operations using unmovable instructions in that BB based on the bb operations using unmovable instructions in that BB based on the bb
...@@ -505,12 +505,12 @@ sort_by_operand_rank (const void *pa, const void *pb) ...@@ -505,12 +505,12 @@ sort_by_operand_rank (const void *pa, const void *pb)
else else
/* To make sorting result stable, we use unique IDs to determine /* To make sorting result stable, we use unique IDs to determine
order. */ order. */
return oeb->id - oea->id; return oeb->id > oea->id ? 1 : -1;
} }
/* Lastly, make sure the versions that are the same go next to each /* Lastly, make sure the versions that are the same go next to each
other. */ other. */
if ((oeb->rank - oea->rank == 0) if (oeb->rank == oea->rank
&& TREE_CODE (oea->op) == SSA_NAME && TREE_CODE (oea->op) == SSA_NAME
&& TREE_CODE (oeb->op) == SSA_NAME) && TREE_CODE (oeb->op) == SSA_NAME)
{ {
...@@ -543,15 +543,15 @@ sort_by_operand_rank (const void *pa, const void *pb) ...@@ -543,15 +543,15 @@ sort_by_operand_rank (const void *pa, const void *pb)
} }
if (SSA_NAME_VERSION (oeb->op) != SSA_NAME_VERSION (oea->op)) if (SSA_NAME_VERSION (oeb->op) != SSA_NAME_VERSION (oea->op))
return SSA_NAME_VERSION (oeb->op) - SSA_NAME_VERSION (oea->op); return SSA_NAME_VERSION (oeb->op) > SSA_NAME_VERSION (oea->op) ? 1 : -1;
else else
return oeb->id - oea->id; return oeb->id > oea->id ? 1 : -1;
} }
if (oeb->rank != oea->rank) if (oeb->rank != oea->rank)
return oeb->rank - oea->rank; return oeb->rank > oea->rank ? 1 : -1;
else else
return oeb->id - oea->id; return oeb->id > oea->id ? 1 : -1;
} }
/* Add an operand entry to *OPS for the tree operand OP. */ /* Add an operand entry to *OPS for the tree operand OP. */
...@@ -1055,8 +1055,8 @@ static void linearize_expr_tree (vec<operand_entry *> *, gimple *, ...@@ -1055,8 +1055,8 @@ static void linearize_expr_tree (vec<operand_entry *> *, gimple *,
/* Structure for tracking and counting operands. */ /* Structure for tracking and counting operands. */
struct oecount { struct oecount {
int cnt; unsigned int cnt;
int id; unsigned int id;
enum tree_code oecode; enum tree_code oecode;
tree op; tree op;
}; };
...@@ -1090,8 +1090,7 @@ oecount_hasher::equal (int p1, int p2) ...@@ -1090,8 +1090,7 @@ oecount_hasher::equal (int p1, int p2)
{ {
const oecount *c1 = &cvec[p1 - 42]; const oecount *c1 = &cvec[p1 - 42];
const oecount *c2 = &cvec[p2 - 42]; const oecount *c2 = &cvec[p2 - 42];
return (c1->oecode == c2->oecode return c1->oecode == c2->oecode && c1->op == c2->op;
&& c1->op == c2->op);
} }
/* Comparison function for qsort sorting oecount elements by count. */ /* Comparison function for qsort sorting oecount elements by count. */
...@@ -1102,10 +1101,10 @@ oecount_cmp (const void *p1, const void *p2) ...@@ -1102,10 +1101,10 @@ oecount_cmp (const void *p1, const void *p2)
const oecount *c1 = (const oecount *)p1; const oecount *c1 = (const oecount *)p1;
const oecount *c2 = (const oecount *)p2; const oecount *c2 = (const oecount *)p2;
if (c1->cnt != c2->cnt) if (c1->cnt != c2->cnt)
return c1->cnt - c2->cnt; return c1->cnt > c2->cnt ? 1 : -1;
else else
/* If counts are identical, use unique IDs to stabilize qsort. */ /* If counts are identical, use unique IDs to stabilize qsort. */
return c1->id - c2->id; return c1->id > c2->id ? 1 : -1;
} }
/* Return TRUE iff STMT represents a builtin call that raises OP /* Return TRUE iff STMT represents a builtin call that raises OP
...@@ -1559,7 +1558,7 @@ undistribute_ops_list (enum tree_code opcode, ...@@ -1559,7 +1558,7 @@ undistribute_ops_list (enum tree_code opcode,
sbitmap_iterator sbi0; sbitmap_iterator sbi0;
vec<operand_entry *> *subops; vec<operand_entry *> *subops;
bool changed = false; bool changed = false;
int next_oecount_id = 0; unsigned int next_oecount_id = 0;
if (length <= 1 if (length <= 1
|| opcode != PLUS_EXPR) || opcode != PLUS_EXPR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment