public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ICE with -fopt-info-inline (PR ipa/87955)
@ 2018-11-11  1:33 David Malcolm
  2018-11-12 14:19 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: David Malcolm @ 2018-11-11  1:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

PR ipa/87955 reports a problem I introduced in r265920, where I converted
the guard in report_inline_failed_reason from using:
  if (dump_file)
to using
  if (dump_enabled_p ()).
without updating the calls to cl_target_option_print_diff and
cl_optimization_print_diff, which assume that dump_file is non-NULL.

The functions are auto-generated.  Rather than porting them to the dump
API, this patch applies the workaround of adding the missing checks on
dump_file before calling them.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

OK for trunk?

gcc/ChangeLog:
	PR ipa/87955
	* ipa-inline.c (report_inline_failed_reason): Guard calls to
	cl_target_option_print_diff and cl_optimization_print_diff with
	if (dump_file).

gcc/testsuite/ChangeLog:
	PR ipa/87955
	* gcc.target/i386/pr87955.c: New test.
---
 gcc/ipa-inline.c                        | 14 ++++++++------
 gcc/testsuite/gcc.target/i386/pr87955.c | 10 ++++++++++
 2 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr87955.c

diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index e04ede7..173808a 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -244,13 +244,15 @@ report_inline_failed_reason (struct cgraph_edge *e)
 			   e->callee->ultimate_alias_target ()->lto_file_data->file_name);
 	}
       if (e->inline_failed == CIF_TARGET_OPTION_MISMATCH)
-	cl_target_option_print_diff
-	 (dump_file, 2, target_opts_for_fn (e->caller->decl),
-          target_opts_for_fn (e->callee->ultimate_alias_target ()->decl));
+	if (dump_file)
+	  cl_target_option_print_diff
+	    (dump_file, 2, target_opts_for_fn (e->caller->decl),
+	     target_opts_for_fn (e->callee->ultimate_alias_target ()->decl));
       if (e->inline_failed == CIF_OPTIMIZATION_MISMATCH)
-	cl_optimization_print_diff
-	  (dump_file, 2, opts_for_fn (e->caller->decl),
-	   opts_for_fn (e->callee->ultimate_alias_target ()->decl));
+	if (dump_file)
+	  cl_optimization_print_diff
+	    (dump_file, 2, opts_for_fn (e->caller->decl),
+	     opts_for_fn (e->callee->ultimate_alias_target ()->decl));
     }
 }
 
diff --git a/gcc/testsuite/gcc.target/i386/pr87955.c b/gcc/testsuite/gcc.target/i386/pr87955.c
new file mode 100644
index 0000000..ed87da6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87955.c
@@ -0,0 +1,10 @@
+/* { dg-options "-O2 -fopt-info-inline-missed" } */
+
+float a;
+
+__attribute__((__target__("fpmath=387")))
+int b() {
+  return a;
+}
+
+int c() { return b(); } /* { dg-missed "not inlinable: c/\[0-9\]* -> b/\[0-9\]*, target specific option mismatch" } */
-- 
1.8.5.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ICE with -fopt-info-inline (PR ipa/87955)
  2018-11-11  1:33 [PATCH] Fix ICE with -fopt-info-inline (PR ipa/87955) David Malcolm
@ 2018-11-12 14:19 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-11-12 14:19 UTC (permalink / raw)
  To: David Malcolm; +Cc: GCC Patches

On Sun, Nov 11, 2018 at 2:33 AM David Malcolm <dmalcolm@redhat.com> wrote:
>
> PR ipa/87955 reports a problem I introduced in r265920, where I converted
> the guard in report_inline_failed_reason from using:
>   if (dump_file)
> to using
>   if (dump_enabled_p ()).
> without updating the calls to cl_target_option_print_diff and
> cl_optimization_print_diff, which assume that dump_file is non-NULL.
>
> The functions are auto-generated.  Rather than porting them to the dump
> API, this patch applies the workaround of adding the missing checks on
> dump_file before calling them.
>
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
>
> OK for trunk?

OK.

Richard.

> gcc/ChangeLog:
>         PR ipa/87955
>         * ipa-inline.c (report_inline_failed_reason): Guard calls to
>         cl_target_option_print_diff and cl_optimization_print_diff with
>         if (dump_file).
>
> gcc/testsuite/ChangeLog:
>         PR ipa/87955
>         * gcc.target/i386/pr87955.c: New test.
> ---
>  gcc/ipa-inline.c                        | 14 ++++++++------
>  gcc/testsuite/gcc.target/i386/pr87955.c | 10 ++++++++++
>  2 files changed, 18 insertions(+), 6 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr87955.c
>
> diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
> index e04ede7..173808a 100644
> --- a/gcc/ipa-inline.c
> +++ b/gcc/ipa-inline.c
> @@ -244,13 +244,15 @@ report_inline_failed_reason (struct cgraph_edge *e)
>                            e->callee->ultimate_alias_target ()->lto_file_data->file_name);
>         }
>        if (e->inline_failed == CIF_TARGET_OPTION_MISMATCH)
> -       cl_target_option_print_diff
> -        (dump_file, 2, target_opts_for_fn (e->caller->decl),
> -          target_opts_for_fn (e->callee->ultimate_alias_target ()->decl));
> +       if (dump_file)
> +         cl_target_option_print_diff
> +           (dump_file, 2, target_opts_for_fn (e->caller->decl),
> +            target_opts_for_fn (e->callee->ultimate_alias_target ()->decl));
>        if (e->inline_failed == CIF_OPTIMIZATION_MISMATCH)
> -       cl_optimization_print_diff
> -         (dump_file, 2, opts_for_fn (e->caller->decl),
> -          opts_for_fn (e->callee->ultimate_alias_target ()->decl));
> +       if (dump_file)
> +         cl_optimization_print_diff
> +           (dump_file, 2, opts_for_fn (e->caller->decl),
> +            opts_for_fn (e->callee->ultimate_alias_target ()->decl));
>      }
>  }
>
> diff --git a/gcc/testsuite/gcc.target/i386/pr87955.c b/gcc/testsuite/gcc.target/i386/pr87955.c
> new file mode 100644
> index 0000000..ed87da6
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr87955.c
> @@ -0,0 +1,10 @@
> +/* { dg-options "-O2 -fopt-info-inline-missed" } */
> +
> +float a;
> +
> +__attribute__((__target__("fpmath=387")))
> +int b() {
> +  return a;
> +}
> +
> +int c() { return b(); } /* { dg-missed "not inlinable: c/\[0-9\]* -> b/\[0-9\]*, target specific option mismatch" } */
> --
> 1.8.5.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-12 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-11  1:33 [PATCH] Fix ICE with -fopt-info-inline (PR ipa/87955) David Malcolm
2018-11-12 14:19 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).