public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR ipa/68035
@ 2015-11-06  9:10 Martin Liška
  2015-11-06 13:13 ` Richard Biener
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Martin Liška @ 2015-11-06  9:10 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

Hello.

Following patch triggers hash calculation of items (functions and variables)
in situations where LTO mode is not utilized.

Patch survives regression tests and bootstraps on x86_64-linux-pc.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-PR-ipa-68035.patch --]
[-- Type: text/x-patch, Size: 13832 bytes --]

From 62266e21a89777c6dbd680f7c87f15abe603c024 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 5 Nov 2015 18:31:31 +0100
Subject: [PATCH] Fix PR ipa/68035

gcc/testsuite/ChangeLog:

2015-11-05  Martin Liska  <mliska@suse.cz>

	* gcc.dg/ipa/pr68035.c: New test.

gcc/ChangeLog:

2015-11-05  Martin Liska  <mliska@suse.cz>

	PR ipa/68035
	* ipa-icf.c (sem_item_optimizer::build_graph): Force building
	of a hash value for an item if we are not running in LTO mode.
---
 gcc/ipa-icf.c                      |   4 ++
 gcc/testsuite/gcc.dg/ipa/pr68035.c | 108 +++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/pr68035.c

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 7bb3af5..09c42a1 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -2744,6 +2744,10 @@ sem_item_optimizer::build_graph (void)
     {
       sem_item *item = m_items[i];
       m_symtab_node_map.put (item->node, item);
+
+      /* Initialize hash values if we are not in LTO mode.  */
+      if (!in_lto_p)
+	item->get_hash ();
     }
 
   for (unsigned i = 0; i < m_items.length (); i++)
diff --git a/gcc/testsuite/gcc.dg/ipa/pr68035.c b/gcc/testsuite/gcc.dg/ipa/pr68035.c
new file mode 100644
index 0000000..a8cb779
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr68035.c
@@ -0,0 +1,108 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-icf"  } */
+
+static const unsigned short list_0[] = { 777, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_1[] = { 0, 777, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_2[] = { 0, 1, 777, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_3[] = { 0, 1, 2, 777, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_4[] = { 0, 1, 2, 3, 777, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_5[] = { 0, 1, 2, 3, 4, 777, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_6[] = { 0, 1, 2, 3, 4, 5, 777, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_7[] = { 0, 1, 2, 3, 4, 5, 6, 777, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 777, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 777, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 777, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_11[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 777, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_12[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 777, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_13[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 777, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_14[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 777, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_15[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 777, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_16[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 777, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_17[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 777, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_18[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 777, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_19[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 777, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_20[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 777, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_21[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 777, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_22[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 777, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_23[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 777, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_24[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 777, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_25[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 777, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_26[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 777, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_27[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 777, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_28[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 777, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_29[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 777, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_30[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 777, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_31[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 777, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_32[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 777, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_33[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 777, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_34[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 777, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_35[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 777, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_36[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 777, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_37[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 777, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_38[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 777, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_39[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 777, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_40[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 777, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_41[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 777, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_42[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 777, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_43[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 777, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_44[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 777, 45, 46, 47, 48, 49 };
+static const unsigned short list_45[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 777, 46, 47, 48, 49 };
+static const unsigned short list_46[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 777, 47, 48, 49 };
+static const unsigned short list_47[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 777, 48, 49 };
+static const unsigned short list_48[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 777, 49 };
+static const unsigned short list_49[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 777 };
+const unsigned short * const table[] = {
+list_0,
+list_1,
+list_2,
+list_3,
+list_4,
+list_5,
+list_6,
+list_7,
+list_8,
+list_9,
+list_10,
+list_11,
+list_12,
+list_13,
+list_14,
+list_15,
+list_16,
+list_17,
+list_18,
+list_19,
+list_20,
+list_21,
+list_22,
+list_23,
+list_24,
+list_25,
+list_26,
+list_27,
+list_28,
+list_29,
+list_30,
+list_31,
+list_32,
+list_33,
+list_34,
+list_35,
+list_36,
+list_37,
+list_38,
+list_39,
+list_40,
+list_41,
+list_42,
+list_43,
+list_44,
+list_45,
+list_46,
+list_47,
+list_48,
+list_49,
+};
+
+
+/* { dg-final { scan-ipa-dump "unique hash values: 51" "icf"  } } */
-- 
2.6.2


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

* Re: [PATCH] Fix PR ipa/68035
  2015-11-06  9:10 [PATCH] Fix PR ipa/68035 Martin Liška
@ 2015-11-06 13:13 ` Richard Biener
  2015-11-06 16:44 ` Jan Hubicka
  2015-11-12  9:48 ` [PATCH] Fix PR ipa/68035 (v2) Martin Liška
  2 siblings, 0 replies; 8+ messages in thread
From: Richard Biener @ 2015-11-06 13:13 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jan Hubicka

On Fri, Nov 6, 2015 at 10:10 AM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> Following patch triggers hash calculation of items (functions and variables)
> in situations where LTO mode is not utilized.
>
> Patch survives regression tests and bootstraps on x86_64-linux-pc.

Why does that make a difference?  Do we have direct ->hash users
that should have used get_hash ()?

> Ready for trunk?
> Thanks,
> Martin

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

* Re: [PATCH] Fix PR ipa/68035
  2015-11-06  9:10 [PATCH] Fix PR ipa/68035 Martin Liška
  2015-11-06 13:13 ` Richard Biener
@ 2015-11-06 16:44 ` Jan Hubicka
  2015-11-12  9:50   ` Martin Liška
  2015-11-12  9:48 ` [PATCH] Fix PR ipa/68035 (v2) Martin Liška
  2 siblings, 1 reply; 8+ messages in thread
From: Jan Hubicka @ 2015-11-06 16:44 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jan Hubicka

> Hello.
> 
> Following patch triggers hash calculation of items (functions and variables)
> in situations where LTO mode is not utilized.
> 
> Patch survives regression tests and bootstraps on x86_64-linux-pc.
> 
> Ready for trunk?
> Thanks,
> Martin

> >From 62266e21a89777c6dbd680f7c87f15abe603c024 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Thu, 5 Nov 2015 18:31:31 +0100
> Subject: [PATCH] Fix PR ipa/68035
> 
> gcc/testsuite/ChangeLog:
> 
> 2015-11-05  Martin Liska  <mliska@suse.cz>
> 
> 	* gcc.dg/ipa/pr68035.c: New test.
> 
> gcc/ChangeLog:
> 
> 2015-11-05  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/68035
> 	* ipa-icf.c (sem_item_optimizer::build_graph): Force building
> 	of a hash value for an item if we are not running in LTO mode.
> ---
>  gcc/ipa-icf.c                      |   4 ++
>  gcc/testsuite/gcc.dg/ipa/pr68035.c | 108 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 112 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.dg/ipa/pr68035.c
> 
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index 7bb3af5..09c42a1 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -2744,6 +2744,10 @@ sem_item_optimizer::build_graph (void)
>      {
>        sem_item *item = m_items[i];
>        m_symtab_node_map.put (item->node, item);
> +
> +      /* Initialize hash values if we are not in LTO mode.  */
> +      if (!in_lto_p)
> +	item->get_hash ();
>      }

Hmm, what is the difference to the LTO mode here. I would have expected that all the items
was analyzed in both paths?

Honza

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

* Re: [PATCH] Fix PR ipa/68035 (v2)
  2015-11-06  9:10 [PATCH] Fix PR ipa/68035 Martin Liška
  2015-11-06 13:13 ` Richard Biener
  2015-11-06 16:44 ` Jan Hubicka
@ 2015-11-12  9:48 ` Martin Liška
  2015-11-12 11:23   ` Richard Biener
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Liška @ 2015-11-12  9:48 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

Hello.

I'm sending reworked version of the patch, where I renamed 'sem_item::hash' to 'm_hash'
and wrapped all usages with 'get_hash'. Apart from that, a new member function 'set_hash'
is utilized for changing the hash value. Hope it's easier for understanding.

Patch can survive regression tests and bootstraps on x86_64-linux-pc.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-PR-ipa-68035.patch --]
[-- Type: text/x-patch, Size: 20450 bytes --]

From 29be4ad798d73245715f53fe971a17664b69eeb8 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 5 Nov 2015 18:31:31 +0100
Subject: [PATCH] Fix PR ipa/68035

gcc/ChangeLog:

2015-11-12  Martin Liska  <mliska@suse.cz>

	PR ipa/68035
	* ipa-icf.c (void sem_item::set_hash): New function.
	(sem_function::get_hash): Use renamed m_hash member variable.
	(sem_item::update_hash_by_addr_refs): Utilize get_hash.
	(sem_item::update_hash_by_local_refs): Likewise.
	(sem_variable::get_hash): Use renamed m_hash member variable.
	(sem_item_optimizer::update_hash_by_addr_refs): Utilize get_hash.
	(sem_item_optimizer::build_hash_based_classes): Utilize set_hash.
	(sem_item_optimizer::build_graph): As the hash value of an item
	is lazy initialized, force the calculation.
	* ipa-icf.h (set_hash): Declare new function and rename hash member
	variable to m_hash.

gcc/testsuite/ChangeLog:

2015-11-12  Martin Liska  <mliska@suse.cz>

	* gcc.dg/ipa/pr68035.c: New test.
---
 gcc/ipa-icf.c                      |  46 +++++++++-------
 gcc/ipa-icf.h                      |   9 ++--
 gcc/testsuite/gcc.dg/ipa/pr68035.c | 108 +++++++++++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+), 22 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/pr68035.c

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 7bb3af5..b6a97c3 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -140,7 +140,7 @@ sem_usage_pair::sem_usage_pair (sem_item *_item, unsigned int _index):
    for bitmap memory allocation.  */
 
 sem_item::sem_item (sem_item_type _type,
-		    bitmap_obstack *stack): type(_type), hash(0)
+		    bitmap_obstack *stack): type (_type), m_hash (0)
 {
   setup (stack);
 }
@@ -151,7 +151,7 @@ sem_item::sem_item (sem_item_type _type,
 
 sem_item::sem_item (sem_item_type _type, symtab_node *_node,
 		    hashval_t _hash, bitmap_obstack *stack): type(_type),
-  node (_node), hash (_hash)
+  node (_node), m_hash (_hash)
 {
   decl = node->decl;
   setup (stack);
@@ -227,6 +227,11 @@ sem_item::target_supports_symbol_aliases_p (void)
 #endif
 }
 
+void sem_item::set_hash (hashval_t hash)
+{
+  m_hash = hash;
+}
+
 /* Semantic function constructor that uses STACK as bitmap memory stack.  */
 
 sem_function::sem_function (bitmap_obstack *stack): sem_item (FUNC, stack),
@@ -274,7 +279,7 @@ sem_function::get_bb_hash (const sem_bb *basic_block)
 hashval_t
 sem_function::get_hash (void)
 {
-  if(!hash)
+  if (!m_hash)
     {
       inchash::hash hstate;
       hstate.add_int (177454); /* Random number for function type.  */
@@ -289,7 +294,6 @@ sem_function::get_hash (void)
       for (unsigned i = 0; i < bb_sizes.length (); i++)
 	hstate.add_int (bb_sizes[i]);
 
-
       /* Add common features of declaration itself.  */
       if (DECL_FUNCTION_SPECIFIC_TARGET (decl))
         hstate.add_wide_int
@@ -301,10 +305,10 @@ sem_function::get_hash (void)
       hstate.add_flag (DECL_CXX_CONSTRUCTOR_P (decl));
       hstate.add_flag (DECL_CXX_DESTRUCTOR_P (decl));
 
-      hash = hstate.end ();
+      set_hash (hstate.end ());
     }
 
-  return hash;
+  return m_hash;
 }
 
 /* Return ture if A1 and A2 represent equivalent function attribute lists.
@@ -800,7 +804,7 @@ sem_item::update_hash_by_addr_refs (hash_map <symtab_node *,
 				    sem_item *> &m_symtab_node_map)
 {
   ipa_ref* ref;
-  inchash::hash hstate (hash);
+  inchash::hash hstate (get_hash ());
 
   for (unsigned i = 0; node->iterate_reference (i, ref); i++)
     {
@@ -823,7 +827,7 @@ sem_item::update_hash_by_addr_refs (hash_map <symtab_node *,
 	}
     }
 
-  hash = hstate.end ();
+  set_hash (hstate.end ());
 }
 
 /* Update hash by computed local hash values taken from different
@@ -835,13 +839,13 @@ sem_item::update_hash_by_local_refs (hash_map <symtab_node *,
 				     sem_item *> &m_symtab_node_map)
 {
   ipa_ref* ref;
-  inchash::hash state (hash);
+  inchash::hash state (get_hash ());
 
   for (unsigned j = 0; node->iterate_reference (j, ref); j++)
     {
       sem_item **result = m_symtab_node_map.get (ref->referring);
       if (result)
-	state.merge_hash ((*result)->hash);
+	state.merge_hash ((*result)->get_hash ());
     }
 
   if (type == FUNC)
@@ -851,7 +855,7 @@ sem_item::update_hash_by_local_refs (hash_map <symtab_node *,
 	{
 	  sem_item **result = m_symtab_node_map.get (e->caller);
 	  if (result)
-	    state.merge_hash ((*result)->hash);
+	    state.merge_hash ((*result)->get_hash ());
 	}
     }
 
@@ -2099,8 +2103,8 @@ sem_variable::parse (varpool_node *node, bitmap_obstack *stack)
 hashval_t
 sem_variable::get_hash (void)
 {
-  if (hash)
-    return hash;
+  if (m_hash)
+    return m_hash;
 
   /* All WPA streamed in symbols should have their hashes computed at compile
      time.  At this point, the constructor may not be in memory at all.
@@ -2113,9 +2117,9 @@ sem_variable::get_hash (void)
   if (DECL_SIZE (decl) && tree_fits_shwi_p (DECL_SIZE (decl)))
     hstate.add_wide_int (tree_to_shwi (DECL_SIZE (decl)));
   add_expr (ctor, hstate);
-  hash = hstate.end ();
+  set_hash (hstate.end ());
 
-  return hash;
+  return m_hash;
 }
 
 /* Merges instance with an ALIAS_ITEM, where alias, thunk or redirection can
@@ -2688,7 +2692,7 @@ sem_item_optimizer::update_hash_by_addr_refs ()
 	     {
 	        tree class_type
 		  = TYPE_METHOD_BASETYPE (TREE_TYPE (m_items[i]->decl));
-		inchash::hash hstate (m_items[i]->hash);
+		inchash::hash hstate (m_items[i]->get_hash ());
 
 		if (TYPE_NAME (class_type)
 		     && DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (class_type)))
@@ -2696,7 +2700,7 @@ sem_item_optimizer::update_hash_by_addr_refs ()
 		    (IDENTIFIER_HASH_VALUE
 		       (DECL_ASSEMBLER_NAME (TYPE_NAME (class_type))));
 
-		m_items[i]->hash = hstate.end ();
+		m_items[i]->set_hash (hstate.end ());
 	     }
 	}
     }
@@ -2710,7 +2714,7 @@ sem_item_optimizer::update_hash_by_addr_refs ()
 
   /* Global hash value replace current hash values.  */
   for (unsigned i = 0; i < m_items.length (); i++)
-    m_items[i]->hash = m_items[i]->global_hash;
+    m_items[i]->set_hash (m_items[i]->global_hash);
 }
 
 /* Congruence classes are built by hash value.  */
@@ -2722,7 +2726,7 @@ sem_item_optimizer::build_hash_based_classes (void)
     {
       sem_item *item = m_items[i];
 
-      congruence_class_group *group = get_group_by_hash (item->hash,
+      congruence_class_group *group = get_group_by_hash (item->get_hash (),
 				      item->type);
 
       if (!group->classes.length ())
@@ -2744,6 +2748,10 @@ sem_item_optimizer::build_graph (void)
     {
       sem_item *item = m_items[i];
       m_symtab_node_map.put (item->node, item);
+
+      /* Initialize hash values if we are not in LTO mode.  */
+      if (!in_lto_p)
+	item->get_hash ();
     }
 
   for (unsigned i = 0; i < m_items.length (); i++)
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index 365e86f..c48cb18 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -181,6 +181,9 @@ public:
   /* References independent hash function.  */
   virtual hashval_t get_hash (void) = 0;
 
+  /* Set new hash value of the item.  */
+  void set_hash (hashval_t hash);
+
   /* Merges instance with an ALIAS_ITEM, where alias, thunk or redirection can
      be applied.  */
   virtual bool merge (sem_item *alias_item) = 0;
@@ -234,9 +237,6 @@ public:
   /* A set with symbol table references.  */
   hash_set <symtab_node *> refs_set;
 
-  /* Hash of item.  */
-  hashval_t hash;
-
   /* Temporary hash used where hash values of references are added.  */
   hashval_t global_hash;
 protected:
@@ -270,6 +270,9 @@ protected:
 				  &ignored_nodes,
 				  symtab_node *n1, symtab_node *n2,
 				  bool address);
+protected:
+  /* Hash of item.  */
+  hashval_t m_hash;
 
 private:
   /* Initialize internal data structures. Bitmap STACK is used for
diff --git a/gcc/testsuite/gcc.dg/ipa/pr68035.c b/gcc/testsuite/gcc.dg/ipa/pr68035.c
new file mode 100644
index 0000000..a8cb779
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr68035.c
@@ -0,0 +1,108 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-icf"  } */
+
+static const unsigned short list_0[] = { 777, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_1[] = { 0, 777, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_2[] = { 0, 1, 777, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_3[] = { 0, 1, 2, 777, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_4[] = { 0, 1, 2, 3, 777, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_5[] = { 0, 1, 2, 3, 4, 777, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_6[] = { 0, 1, 2, 3, 4, 5, 777, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_7[] = { 0, 1, 2, 3, 4, 5, 6, 777, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 777, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_9[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 777, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_10[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 777, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_11[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 777, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_12[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 777, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_13[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 777, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_14[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 777, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_15[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 777, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_16[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 777, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_17[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 777, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_18[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 777, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_19[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 777, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_20[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 777, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_21[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 777, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_22[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 777, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_23[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 777, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_24[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 777, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_25[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 777, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_26[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 777, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_27[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 777, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_28[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 777, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_29[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 777, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_30[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 777, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_31[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 777, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_32[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 777, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_33[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 777, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_34[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 777, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_35[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 777, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_36[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 777, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_37[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 777, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_38[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 777, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_39[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 777, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_40[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 777, 41, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_41[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 777, 42, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_42[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 777, 43, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_43[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 777, 44, 45, 46, 47, 48, 49 };
+static const unsigned short list_44[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 777, 45, 46, 47, 48, 49 };
+static const unsigned short list_45[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 777, 46, 47, 48, 49 };
+static const unsigned short list_46[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 777, 47, 48, 49 };
+static const unsigned short list_47[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 777, 48, 49 };
+static const unsigned short list_48[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 777, 49 };
+static const unsigned short list_49[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 777 };
+const unsigned short * const table[] = {
+list_0,
+list_1,
+list_2,
+list_3,
+list_4,
+list_5,
+list_6,
+list_7,
+list_8,
+list_9,
+list_10,
+list_11,
+list_12,
+list_13,
+list_14,
+list_15,
+list_16,
+list_17,
+list_18,
+list_19,
+list_20,
+list_21,
+list_22,
+list_23,
+list_24,
+list_25,
+list_26,
+list_27,
+list_28,
+list_29,
+list_30,
+list_31,
+list_32,
+list_33,
+list_34,
+list_35,
+list_36,
+list_37,
+list_38,
+list_39,
+list_40,
+list_41,
+list_42,
+list_43,
+list_44,
+list_45,
+list_46,
+list_47,
+list_48,
+list_49,
+};
+
+
+/* { dg-final { scan-ipa-dump "unique hash values: 51" "icf"  } } */
-- 
2.6.2


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

* Re: [PATCH] Fix PR ipa/68035
  2015-11-06 16:44 ` Jan Hubicka
@ 2015-11-12  9:50   ` Martin Liška
  2015-11-12 18:40     ` Jan Hubicka
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Liška @ 2015-11-12  9:50 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: GCC Patches

On 11/06/2015 05:43 PM, Jan Hubicka wrote:
>> Hello.
>>
>> Following patch triggers hash calculation of items (functions and variables)
>> in situations where LTO mode is not utilized.
>>
>> Patch survives regression tests and bootstraps on x86_64-linux-pc.
>>
>> Ready for trunk?
>> Thanks,
>> Martin
> 
>> >From 62266e21a89777c6dbd680f7c87f15abe603c024 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Thu, 5 Nov 2015 18:31:31 +0100
>> Subject: [PATCH] Fix PR ipa/68035
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2015-11-05  Martin Liska  <mliska@suse.cz>
>>
>> 	* gcc.dg/ipa/pr68035.c: New test.
>>
>> gcc/ChangeLog:
>>
>> 2015-11-05  Martin Liska  <mliska@suse.cz>
>>
>> 	PR ipa/68035
>> 	* ipa-icf.c (sem_item_optimizer::build_graph): Force building
>> 	of a hash value for an item if we are not running in LTO mode.
>> ---
>>  gcc/ipa-icf.c                      |   4 ++
>>  gcc/testsuite/gcc.dg/ipa/pr68035.c | 108 +++++++++++++++++++++++++++++++++++++
>>  2 files changed, 112 insertions(+)
>>  create mode 100644 gcc/testsuite/gcc.dg/ipa/pr68035.c
>>
>> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
>> index 7bb3af5..09c42a1 100644
>> --- a/gcc/ipa-icf.c
>> +++ b/gcc/ipa-icf.c
>> @@ -2744,6 +2744,10 @@ sem_item_optimizer::build_graph (void)
>>      {
>>        sem_item *item = m_items[i];
>>        m_symtab_node_map.put (item->node, item);
>> +
>> +      /* Initialize hash values if we are not in LTO mode.  */
>> +      if (!in_lto_p)
>> +	item->get_hash ();
>>      }
> 
> Hmm, what is the difference to the LTO mode here. I would have expected that all the items
> was analyzed in both paths?

Difference is that in case of the LTO mode, the hash value is read from streamed LTO file.
On the other hand, in classic compilation mode we have to force the calculation as a hash value
is computed lazily.

Please take a look at just sent suggested patch.

Thanks,
Martin

> 
> Honza
> 

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

* Re: [PATCH] Fix PR ipa/68035 (v2)
  2015-11-12  9:48 ` [PATCH] Fix PR ipa/68035 (v2) Martin Liška
@ 2015-11-12 11:23   ` Richard Biener
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Biener @ 2015-11-12 11:23 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Thu, Nov 12, 2015 at 10:48 AM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> I'm sending reworked version of the patch, where I renamed 'sem_item::hash' to 'm_hash'
> and wrapped all usages with 'get_hash'. Apart from that, a new member function 'set_hash'
> is utilized for changing the hash value. Hope it's easier for understanding.
>
> Patch can survive regression tests and bootstraps on x86_64-linux-pc.
>
> Ready for trunk?

Ok.

Thanks,
Richard.

> Thanks,
> Martin

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

* Re: [PATCH] Fix PR ipa/68035
  2015-11-12  9:50   ` Martin Liška
@ 2015-11-12 18:40     ` Jan Hubicka
  2015-11-13 12:07       ` Martin Liška
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Hubicka @ 2015-11-12 18:40 UTC (permalink / raw)
  To: Martin Liška; +Cc: Jan Hubicka, GCC Patches

> >> +
> >> +      /* Initialize hash values if we are not in LTO mode.  */
> >> +      if (!in_lto_p)
> >> +	item->get_hash ();
> >>      }
> > 
> > Hmm, what is the difference to the LTO mode here. I would have expected that all the items
> > was analyzed in both paths?
> 
> Difference is that in case of the LTO mode, the hash value is read from streamed LTO file.
> On the other hand, in classic compilation mode we have to force the calculation as a hash value
> is computed lazily.

In this case we need to also handle cases where function/variable is born during WPA (i.e. produced
by earlier pass), so in_lto_p check looks wrong.
I will look at the updated patch.

Honza

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

* Re: [PATCH] Fix PR ipa/68035
  2015-11-12 18:40     ` Jan Hubicka
@ 2015-11-13 12:07       ` Martin Liška
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Liška @ 2015-11-13 12:07 UTC (permalink / raw)
  To: gcc-patches

On 11/12/2015 07:40 PM, Jan Hubicka wrote:
>>>> +
>>>> +      /* Initialize hash values if we are not in LTO mode.  */
>>>> +      if (!in_lto_p)
>>>> +	item->get_hash ();
>>>>      }
>>>
>>> Hmm, what is the difference to the LTO mode here. I would have expected that all the items
>>> was analyzed in both paths?
>>
>> Difference is that in case of the LTO mode, the hash value is read from streamed LTO file.
>> On the other hand, in classic compilation mode we have to force the calculation as a hash value
>> is computed lazily.
> 
> In this case we need to also handle cases where function/variable is born during WPA (i.e. produced
> by earlier pass), so in_lto_p check looks wrong.
> I will look at the updated patch.
> 
> Honza
> 

Hi Honza.

Currently we just register {cgraph,varpool}_removal_hooks in WPA.
Probably place for enhancement?

Thanks,
Martin

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

end of thread, other threads:[~2015-11-13 12:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-06  9:10 [PATCH] Fix PR ipa/68035 Martin Liška
2015-11-06 13:13 ` Richard Biener
2015-11-06 16:44 ` Jan Hubicka
2015-11-12  9:50   ` Martin Liška
2015-11-12 18:40     ` Jan Hubicka
2015-11-13 12:07       ` Martin Liška
2015-11-12  9:48 ` [PATCH] Fix PR ipa/68035 (v2) Martin Liška
2015-11-12 11:23   ` 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).