Bail out when ipa_fn_summaries does not contain entry for callee (PR ipa/88958).
authorMartin Liska <mliska@suse.cz>
Mon, 4 Feb 2019 12:19:48 +0000 (13:19 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 4 Feb 2019 12:19:48 +0000 (12:19 +0000)
2019-02-04  Martin Liska  <mliska@suse.cz>

PR ipa/88958
* ipa-fnsummary.c (estimate_edge_devirt_benefit): Bail
out when ipa_fn_summaries does not contain entry for callee.
2019-02-04  Martin Liska  <mliska@suse.cz>

PR ipa/88958
* gcc.dg/ipa/pr88958.c: New test.

From-SVN: r268516

gcc/ChangeLog
gcc/ipa-fnsummary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/pr88958.c [new file with mode: 0644]

index 1c9b1c7792957e7513eb2c5e809339b814bf1525..f55dfcd39fb49a640d0610c5c7728ed0a6c54d2c 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-04  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/88958
+       * ipa-fnsummary.c (estimate_edge_devirt_benefit): Bail
+       out when ipa_fn_summaries does not contain entry for callee.
+
 2019-02-04  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.h: Remove superfluous blank lines.
index 535b3f22d495ebbca718f7945929c52c5b02fa12..057b364b3794d6403c41cefb3f0c9f79c131743a 100644 (file)
@@ -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;
 }
 
index 8df6a0546d132c09318eaf9aee9abade34d00b42..231cd55ca30b9e70c943d0a9c27f6039d1e06cfa 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-04  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/88958
+       * gcc.dg/ipa/pr88958.c: New test.
+
 2019-02-04  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/debug/dwarf2/inline5.c: Handle also @, ; or | comment
diff --git a/gcc/testsuite/gcc.dg/ipa/pr88958.c b/gcc/testsuite/gcc.dg/ipa/pr88958.c
new file mode 100644 (file)
index 0000000..8253a89
--- /dev/null
@@ -0,0 +1,13 @@
+void f (void)
+{
+}
+__attribute__((__optimize__("O2")))
+void g (void f())
+{
+  f();
+}
+__attribute__((__optimize__("O2")))
+void h (void)
+{
+  g(f);
+}