This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, PR 42157] Stabilize SRA access sort
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Guenther <rguenther at suse dot de>, ebotcazou at gcc dot gnu dot org
- Date: Tue, 5 Jan 2010 19:41:28 +0100
- Subject: [PATCH, PR 42157] Stabilize SRA access sort
Hi,
the patch below stabilizes the qsort hook used to sort accesses, which
is required on some (non-linux) platforms.
This patch is slightly simpler than the one in bugzilla but should
work just as fine. Eric, can you please confirm that nevertheless?
I have bootstrapped and regression tested this on x86_64-linux. OK
for trunk?
Thanks,
Martin
2010-01-05 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42157
* tree-sra.c (compare_access_positions): Stabilize sort if both
accesses have integer types.
Index: mine/gcc/tree-sra.c
===================================================================
--- mine.orig/gcc/tree-sra.c
+++ mine/gcc/tree-sra.c
@@ -1131,7 +1131,7 @@ compare_access_positions (const void *a,
/* Put the integral type with the bigger precision first. */
else if (INTEGRAL_TYPE_P (f1->type)
&& INTEGRAL_TYPE_P (f2->type))
- return TYPE_PRECISION (f1->type) > TYPE_PRECISION (f2->type) ? -1 : 1;
+ return TYPE_PRECISION (f2->type) - TYPE_PRECISION (f1->type);
/* Put any integral type with non-full precision last. */
else if (INTEGRAL_TYPE_P (f1->type)
&& (TREE_INT_CST_LOW (TYPE_SIZE (f1->type))