This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]