mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-04 09:50:43 +08:00
re PR rtl-optimization/20365 (simplify_plus_minus results are erratic)
PR rtl-optimization/20365 * simplify-rtx.c (simplify_plus_minus_op_data): Change type of neg to short. New member ix. (simplify_plus_minus_op_data_cmp): Break ties using ix member. (simplify_plus_minus): Initialize ix members before calling qsort. From-SVN: r103771
This commit is contained in:
parent
b8c4f9a4ce
commit
f805670fc3
@ -1,3 +1,11 @@
|
||||
2005-09-02 J"orn Rennecke <joern.rennecke@st.com>
|
||||
|
||||
PR rtl-optimization/20365
|
||||
* simplify-rtx.c (simplify_plus_minus_op_data): Change type of neg
|
||||
to short. New member ix.
|
||||
(simplify_plus_minus_op_data_cmp): Break ties using ix member.
|
||||
(simplify_plus_minus): Initialize ix members before calling qsort.
|
||||
|
||||
2005-09-02 Zdenek Dvorak <dvorakz@suse.cz>
|
||||
|
||||
PR tree-optimization/23626
|
||||
|
@ -2574,7 +2574,8 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
|
||||
struct simplify_plus_minus_op_data
|
||||
{
|
||||
rtx op;
|
||||
int neg;
|
||||
short neg;
|
||||
short ix;
|
||||
};
|
||||
|
||||
static int
|
||||
@ -2582,9 +2583,13 @@ simplify_plus_minus_op_data_cmp (const void *p1, const void *p2)
|
||||
{
|
||||
const struct simplify_plus_minus_op_data *d1 = p1;
|
||||
const struct simplify_plus_minus_op_data *d2 = p2;
|
||||
int result;
|
||||
|
||||
return (commutative_operand_precedence (d2->op)
|
||||
- commutative_operand_precedence (d1->op));
|
||||
result = (commutative_operand_precedence (d2->op)
|
||||
- commutative_operand_precedence (d1->op));
|
||||
if (result)
|
||||
return result;
|
||||
return d1->ix - d2->ix;
|
||||
}
|
||||
|
||||
static rtx
|
||||
@ -2759,7 +2764,12 @@ simplify_plus_minus (enum rtx_code code, enum machine_mode mode, rtx op0,
|
||||
/* Pack all the operands to the lower-numbered entries. */
|
||||
for (i = 0, j = 0; j < n_ops; j++)
|
||||
if (ops[j].op)
|
||||
ops[i++] = ops[j];
|
||||
{
|
||||
ops[i] = ops[j];
|
||||
/* Stabilize sort. */
|
||||
ops[i].ix = i;
|
||||
i++;
|
||||
}
|
||||
n_ops = i;
|
||||
|
||||
/* Sort the operations based on swap_commutative_operands_p. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user