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]

Fix 20090126-1_0 ICE (ICE in WHOPR combining -O0 to -O2 object)


Hi,
20090126-1_0 testcase now ICEs after my change to enable -fipa-pure-const with whopr.
This testcase always crashed with -flto, but for some reason it is being tested only with
whopr.  The problem is that it combines -O0 compiled object and LTOizes at -O2.  Result
is that optimization passes are missing their summaries.

I think we could just output warning like this:
lto1: warning: Function summaries missing in file 20090126-1_0.o. Implying -fno-ipa-pure-const
and disable given pass when this happens.  Same problem exist for ipa-reference
and indirect inlining, so if this is sane, I will implement it there too and I
think it should also go into 4.5.1?

Plus I am not quite sure how to modify the testcase to make testing happy about the new
warning.

Honza

	* ipa-pure-const.c: Include toplev.h.
	(pure_const_read_summary): When summary is missing, complain.
Index: ipa-pure-const.c
===================================================================
--- ipa-pure-const.c	(revision 158616)
+++ ipa-pure-const.c	(working copy)
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.  
 #include "lto-streamer.h"
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
+#include "toplev.h"
 
 static struct pointer_set_t *visited_nodes;
 
@@ -796,6 +797,20 @@ pure_const_read_summary (void)
 					  LTO_section_ipa_pure_const,
 					  ib, data, len);
 	}
+      else
+	{
+	  /* We did not find the summary in given file.  Disable the
+	     option and inform users.  
+	     We can be more sane here: with -flto we can compute missing
+	     information.  In WPA stage we can either assume conservative
+	     values or simply read in the functions missing summaries and
+	     analyze.  But it is probably better to instruct users to not
+	     combine -O0 and -O2 compilations and expect sane results.  */
+	  warning (0,
+		   "Function summaries missing in file %s. Implying -fno-ipa-pure-const",
+		   file_data->file_name);
+	  flag_ipa_pure_const = false;
+	}
     }
 }
 


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