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]

[4.0 PATCH] Enable Tree-SRA at -O3 only for Ada


Hi,

As the first prerelease is scheduled for the end of the week, the problems 
caused by the bad interaction between Ada and Tree-SSA will very likely not 
be fixed in time for 4.0.0.  They are responsible for the remaining ACATS 
failures on x86-64/Linux (1 wrong code), x86/Linux (1 wrong code, 6 ICEs) and 
SPARC/Solaris (6 ICEs).  According to a preliminary analysis, the ICEs are 
related to Ada's DECL_ORIGINAL_FIELD/update_pointer_to and fat pointers.

So I propose to enable Tree-SRA only at -O3 for Ada on the 4.0 branch, as an 
unsafe optimization pass for the Ada compiler.

Bootstrapped/regtested on i586-suse-linux.


2005-04-05  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/18659
	PR ada/18819
	* misc.c (tree_sra_requested): New global.
	(gnat_init_options): Detect -ftree-sra.
	(gnat_post_options): Enable Tree-SRA at -O3 and above only
	or if specifically requested.


-- 
Eric Botcazou
Index: misc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/misc.c,v
retrieving revision 1.96.6.1
diff -u -p -r1.96.6.1 misc.c
--- misc.c	17 Mar 2005 15:06:47 -0000	1.96.6.1
+++ misc.c	5 Apr 2005 07:58:36 -0000
@@ -322,11 +322,15 @@ gnat_handle_option (size_t scode, const 
   return 1;
 }
 
+static bool tree_sra_requested = false;
+
 /* Initialize for option processing.  */
 
 static unsigned int
 gnat_init_options (unsigned int argc, const char **argv)
 {
+  int i;
+
   /* Initialize gnat_argv with save_argv size.  */
   gnat_argv = (char **) xmalloc ((argc + 1) * sizeof (argv[0]));
   gnat_argv[0] = xstrdup (argv[0]);     /* name of the command */
@@ -338,6 +342,15 @@ gnat_init_options (unsigned int argc, co
   /* Uninitialized really means uninitialized in Ada.  */
   flag_zero_initialized_in_bss = 0;
 
+  for (i = argc - 1; i > 0; i--)
+    if (strcmp(argv[i], "-ftree-sra") == 0)
+      {
+	tree_sra_requested = true;
+	break;
+      }
+    else if (strcmp(argv[i], "-fno-tree-sra") == 0)
+      break;
+
   return CL_Ada;
 }
 
@@ -353,6 +366,11 @@ gnat_post_options (const char **pfilenam
   if (flag_inline_functions)
     flag_inline_trees = 2;
 
+  /* Do not enable Tree-SRA at -O2 unless specifically requested as
+     it is known to generate wrong code on some Ada constructs.  */
+  if (optimize < 3 && !tree_sra_requested)
+    flag_tree_sra = 0;
+
   return false;
 }
 

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