This is the mail archive of the 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] Allow fpmath differences in inlining when callee doesn't use FP math

This adjusts the x86 backend to allow -mfpmath differences when
deciding whether to allow inlining.  -mfpmath doesn't really
matter for functions not containing FP operations.

It appears that the can_inline_p target hook is called from the
C++ FE for multi-versioning, thus the ! ipa_fn_summaries check.

Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?

Incidentically this fixes the bootstrap issue I have when enabling
free-lang-data without LTO.

It doesn't fully solve the fpmath difference issue we have with
intrinsics but is an optimization.


2017-08-24  Richard Biener  <>

	* config/i386/i386.c: Include symbol-summary.h, ipa-prop.h
	and ipa-fnsummary.h.
	(ix86_can_inline_p): When ix86_fpmath flags do not match
	check whether the callee uses FP math at all.

Index: gcc/config/i386/i386.c
--- gcc/config/i386/i386.c	(revision 251307)
+++ gcc/config/i386/i386.c	(working copy)
@@ -85,6 +85,9 @@ along with GCC; see the file COPYING3.
 #include "print-rtl.h"
 #include "intl.h"
 #include "ifcvt.h"
+#include "symbol-summary.h"
+#include "ipa-prop.h"
+#include "ipa-fnsummary.h"
 /* This file should be included last.  */
 #include "target-def.h"
@@ -7544,7 +7547,14 @@ ix86_can_inline_p (tree caller, tree cal
       else if (caller_opts->tune != callee_opts->tune)
 	ret = false;
-      else if (caller_opts->x_ix86_fpmath != callee_opts->x_ix86_fpmath)
+      else if (caller_opts->x_ix86_fpmath != callee_opts->x_ix86_fpmath
+	       /* If the calle doesn't use FP expressions differences in
+		  ix86_fpmath can be ignored.  We are called from FEs
+		  for multi-versioning call optimization, so beware of
+		  ipa_fn_summaries not available.  */
+	       && (! ipa_fn_summaries
+		   || ipa_fn_summaries->get
+			(cgraph_node::get (callee))->fp_expressions))
 	ret = false;
       else if (caller_opts->branch_cost != callee_opts->branch_cost)

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