summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-02 12:04:22 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-02 12:04:22 +0000
commit31bf99ef38ca957b98936c73a265ef99532091d2 (patch)
tree28215a4a9220adc682a7d9f82588dce4b996c5dd /gcc/simplify-rtx.c
parent3f9ee09bb6be862877da4abe16f8dc234cd932e1 (diff)
downloadgcc-31bf99ef38ca957b98936c73a265ef99532091d2.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103771 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 8a2faae30a6..13e90e99bfd 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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. */