On 1/25/19 7:39 PM, Jan Hubicka wrote:
>> Hi.
>>
>> This is one very similar patch.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
>> Thanks,
>> Martin
> 
>> From adf577edd5a1d2b6ed78c1cc18feaff23fbfdd1c Mon Sep 17 00:00:00 2001
>> From: marxin <mli...@suse.cz>
>> Date: Thu, 24 Jan 2019 16:07:29 +0100
>> Subject: [PATCH] Revert yet another ::get_create for IPA summary (PR
>>  ipa/88958).
>>
>> gcc/ChangeLog:
>>
>> 2019-01-24  Martin Liska  <mli...@suse.cz>
>>
>>      PR ipa/88958
>>      * ipa-fnsummary.c (estimate_edge_devirt_benefit): Use
>>      ::get_create as the symbol can be not seen yet.
> 
> Using get_create will create empty fnsummary which is invalid and we do
> not want to use it anyway, so turning get into get_creates is not right
> fix in general.  Here you just want to return false if isummary is NULL.

Sure, makes sense. I'm attaching tested patch that I'm going to install.

Thanks,
Martin

> 
> Honza
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2019-01-24  Martin Liska  <mli...@suse.cz>
>>
>>      PR ipa/88958
>>      * gcc.dg/ipa/pr88985.c: New test.
>> ---
>>  gcc/ipa-fnsummary.c                |  2 +-
>>  gcc/testsuite/gcc.dg/ipa/pr88985.c | 13 +++++++++++++
>>  2 files changed, 14 insertions(+), 1 deletion(-)
>>  create mode 100644 gcc/testsuite/gcc.dg/ipa/pr88985.c
>>
>> diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
>> index 535b3f22d49..af741f04eb2 100644
>> --- a/gcc/ipa-fnsummary.c
>> +++ b/gcc/ipa-fnsummary.c
>> @@ -2581,7 +2581,7 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie,
>>    callee = callee->function_symbol (&avail);
>>    if (avail < AVAIL_AVAILABLE)
>>      return false;
>> -  isummary = ipa_fn_summaries->get (callee);
>> +  isummary = ipa_fn_summaries->get_create (callee);
>>    return isummary->inlinable;
>>  }
>>  
>> diff --git a/gcc/testsuite/gcc.dg/ipa/pr88985.c 
>> b/gcc/testsuite/gcc.dg/ipa/pr88985.c
>> new file mode 100644
>> index 00000000000..8253a893cf6
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.dg/ipa/pr88985.c
>> @@ -0,0 +1,13 @@
>> +void f (void)
>> +{
>> +}
>> +__attribute__((__optimize__("O2")))
>> +void g (void f())
>> +{
>> +  f();
>> +}
>> +__attribute__((__optimize__("O2")))
>> +void h (void)
>> +{
>> +  g(f);
>> +}
>> -- 
>> 2.20.1
>>
> 

>From cbe1dd5d72d5181b128c47b29e3de1c5e28c8a3c Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Thu, 24 Jan 2019 16:07:29 +0100
Subject: [PATCH] Bail out when ipa_fn_summaries does not contain entry for
 callee (PR ipa/88958).

gcc/ChangeLog:

2019-01-24  Martin Liska  <mli...@suse.cz>

	PR ipa/88958
	* ipa-fnsummary.c (estimate_edge_devirt_benefit): Bail
	out when ipa_fn_summaries does not contain entry for callee.

gcc/testsuite/ChangeLog:

2019-01-24  Martin Liska  <mli...@suse.cz>

	PR ipa/88958
	* gcc.dg/ipa/pr88985.c: New test.
---
 gcc/ipa-fnsummary.c                |  3 +++
 gcc/testsuite/gcc.dg/ipa/pr88985.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/pr88985.c

diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 535b3f22d49..057b364b379 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -2582,6 +2582,9 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie,
   if (avail < AVAIL_AVAILABLE)
     return false;
   isummary = ipa_fn_summaries->get (callee);
+  if (isummary == NULL)
+    return false;
+
   return isummary->inlinable;
 }
 
diff --git a/gcc/testsuite/gcc.dg/ipa/pr88985.c b/gcc/testsuite/gcc.dg/ipa/pr88985.c
new file mode 100644
index 00000000000..8253a893cf6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr88985.c
@@ -0,0 +1,13 @@
+void f (void)
+{
+}
+__attribute__((__optimize__("O2")))
+void g (void f())
+{
+  f();
+}
+__attribute__((__optimize__("O2")))
+void h (void)
+{
+  g(f);
+}
-- 
2.20.1

Reply via email to