diff options
author | dougkwan <dougkwan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-14 00:02:55 +0000 |
---|---|---|
committer | dougkwan <dougkwan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-14 00:02:55 +0000 |
commit | f7b092e42d9aa1bf3944b656472c7dca63f01cd7 (patch) | |
tree | 6288940af66bd97da71d011e0e4957820730fa0f /gcc/tree-ssa-sccvn.c | |
parent | bc56d052406a7f6fca7caea1e4c450f878009614 (diff) | |
download | gcc-f7b092e42d9aa1bf3944b656472c7dca63f01cd7.tar.gz |
2009-05-13 Doug Kwan <dougkwan@google.com>
* tree-ssa-sccvn.c (compare_ops): Stabilize qsort.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147508 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index b101aebd9e4..539afd2458a 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2421,7 +2421,7 @@ compare_ops (const void *pa, const void *pb) basic_block bbb; if (gimple_nop_p (opstmta) && gimple_nop_p (opstmtb)) - return 0; + return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (gimple_nop_p (opstmta)) return -1; else if (gimple_nop_p (opstmtb)) @@ -2431,7 +2431,7 @@ compare_ops (const void *pa, const void *pb) bbb = gimple_bb (opstmtb); if (!bba && !bbb) - return 0; + return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (!bba) return -1; else if (!bbb) @@ -2441,12 +2441,15 @@ compare_ops (const void *pa, const void *pb) { if (gimple_code (opstmta) == GIMPLE_PHI && gimple_code (opstmtb) == GIMPLE_PHI) - return 0; + return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (gimple_code (opstmta) == GIMPLE_PHI) return -1; else if (gimple_code (opstmtb) == GIMPLE_PHI) return 1; - return gimple_uid (opstmta) - gimple_uid (opstmtb); + else if (gimple_uid (opstmta) != gimple_uid (opstmtb)) + return gimple_uid (opstmta) - gimple_uid (opstmtb); + else + return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); } return rpo_numbers[bba->index] - rpo_numbers[bbb->index]; } |