public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/5] New Identical Code Folding IPA pass
@ 2014-06-16 10:07 mliska
  2014-06-16 10:07 ` [PATCH 4/5] Existing tests fix mliska
                   ` (6 more replies)
  0 siblings, 7 replies; 70+ messages in thread
From: mliska @ 2014-06-16 10:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka

Hello,
  I am sorry for wrong reply address in previously sent thread. After working for quite a long time, I would like to introduce new IPA pass. Goal of the pass is to merge semantically equivalent functions and read-only variables.
  If we prove that a function A is an equivalent to a function B, depending on circumstances, an alias, thunk or a function redirection is created.

  The optimization is inspired by Microsoft /OPT:ICF optimization (http://msdn.microsoft.com/en-us/library/bxwfs976.aspx) that merges COMDAT sections with each function reside in a separate section.
  Apart from that, GOLD linker implemented equivalent implementation for GNU toolchain: SAFE ICF (http://research.google.com/pubs/pub36912.html). Both implementations suffer from a collection of functions where an address was taken for comparison purpose. GOLD linker adds more conservative --icf=safe option.

  You may ask, why the GNU GCC does need such a new optimization. The compiler, having simply better knowledge of a compiled source file, is capable of reaching better results, especially if Link-Time optimization is enabled. Apart from that, GCC implementation adds support for read-only variables like construction vtables (mentioned in: http://hubicka.blogspot.cz/2014/02/devirtualization-in-c-part-3-building.html).

  The pass is capable of building GIMP, Inkscape and Firefox with enabled LTO. Majority of issues connected to testsuite has been fixed, there is a few of IPA tests I need to consult with Jan, how to fix it correctly.

  Statistics about the pass:
  Inkscape: 11.95 MB -> 11.44 MB (-4.27%)
  Firefox: 70.12 MB -> 70.12 MB (-3.07%)

  SPEC 2K6 statistics show how many equivalent functions (and variables) are proved by GOLD and GCC ICF:
  +----------------+----------+---------+------------+------------------+--------------+--------------+-------------+
  | SPEC           | GOLD ICF | IPA ICF | difference | difference perc. | intersection | Just in GOLD | Just in ICF |
  +----------------+----------+---------+------------+------------------+--------------+--------------+-------------+
  | 400.perlbench  |       26 |      53 |         27 |          203.85% |           26 |            0 |          27 |
  | 401.bzip2      |        0 |       1 |          1 |            0.00% |            0 |            0 |           1 |
  | 403.gcc        |       88 |     223 |        135 |          253.41% |           81 |            7 |         142 |
  | 410.bwaves     |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 416.gamess     |        9 |      23 |         14 |          255.56% |            9 |            0 |          14 |
  | 429.mcf        |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 433.milc       |        0 |       8 |          8 |            0.00% |            0 |            0 |           8 |
  | 434.zeusmp     |        0 |       1 |          1 |            0.00% |            0 |            0 |           1 |
  | 436.cactusADM  |       19 |      55 |         36 |          289.47% |           14 |            5 |          41 |
  | 437.leslie3d   |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 444.namd       |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 445.gobmk      |        0 |     332 |        332 |            0.00% |            0 |            0 |         332 |
  | 453.povray     |       73 |      93 |         20 |          127.40% |           60 |           13 |          33 |
  | 454.calculix   |        3 |       6 |          3 |          200.00% |            3 |            0 |           3 |
  | 456.hmmer      |        0 |       1 |          1 |            0.00% |            0 |            0 |           1 |
  | 458.sjeng      |        0 |       1 |          1 |            0.00% |            0 |            0 |           1 |
  | 459.GemsFDTD   |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 462.libquantum |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 464.h264ref    |        0 |       4 |          4 |            0.00% |            0 |            0 |           4 |
  | 470.lbm        |        0 |       0 |          0 |            0.00% |            0 |            0 |           0 |
  | 471.omnetpp    |      134 |     179 |         45 |          133.58% |          127 |            7 |          52 |
  | 473.astar      |        0 |       1 |          1 |            0.00% |            0 |            0 |           1 |
  | 481.wrf        |       51 |      75 |         24 |          147.06% |           50 |            1 |          25 |
  | 482.sphinx3    |        0 |       1 |          1 |            0.00% |            0 |            0 |           1 |
  +----------------+----------+---------+------------+------------------+--------------+--------------+-------------+
  | TOTAL          |      403 |    1057 |        654 |          262.28% |          370 |           33 |         687 |
  +----------------+----------+---------+------------+------------------+--------------+--------------+-------------+

  I've been testing the pass on a QEMU Gentoo virtual machine and I will bring stats as soon as possible.

  There are still unresolved issues connected to correct debugging. I am not familiar with DWARF extensions, but it looks
  there is a solution that can be applied to the pass: http://wiki.dwarfstd.org/index.php?title=ICF ?

  I tried to create equivalent functions foo and bar, merged by ICF GOLD. Function bar is removed from .text section, but gdb
  can put a breakpoint to the function, where content of function foo is displayed. I think this is acceptable behavior.

  I expect many comments related to pass, but I hope effort invested by me a Honza will be transformed to acceptation to trunk.

  Martin

(please ignore this diff)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3ddd98c..4f9418e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,4 @@
+
 2014-06-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
 	PR tree-optimization/61375
-- 
1.8.4.5


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

end of thread, other threads:[~2015-01-20 20:47 UTC | newest]

Thread overview: 70+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 10:07 [PATCH 1/5] New Identical Code Folding IPA pass mliska
2014-06-16 10:07 ` [PATCH 4/5] Existing tests fix mliska
2014-06-17 19:52   ` Jeff Law
2014-06-17 20:50     ` Rainer Orth
2014-06-18  9:02       ` Martin Liška
2014-06-30 12:12     ` Martin Liška
2014-09-26 12:21       ` Martin Liška
2014-06-16 10:07 ` [PATCH 5/5] New tests introduction mliska
2014-06-17 19:53   ` Jeff Law
2014-06-30 12:14     ` Martin Liška
2014-10-19  8:19       ` Andreas Schwab
2014-10-23 12:34         ` Martin Liška
2014-06-16 10:07 ` [PATCH 2/5] Existing call graph infrastructure enhancement mliska
2014-06-17 20:00   ` Jeff Law
2014-06-30 11:49     ` Martin Liška
2014-06-30 18:54       ` Jeff Law
2014-07-17 14:54         ` Martin Liška
2014-08-25  9:56           ` Martin Liška
2014-08-25 16:12             ` Jan Hubicka
2014-08-27 21:12             ` Jeff Law
2014-09-24 14:23   ` Martin Liška
2014-09-24 15:01     ` Jan Hubicka
2014-09-26 10:19       ` Martin Liška
2014-06-16 10:07 ` [PATCH 3/5] IPA ICF pass mliska
2014-06-20  7:32   ` Trevor Saunders
2014-06-26 11:18     ` Martin Liška
2014-07-05 21:44     ` Gerald Pfeifer
2014-07-05 22:53       ` Jan Hubicka
2014-07-17 15:23         ` Martin Liška
2014-09-26 12:20           ` Martin Liška
2014-09-26 14:44             ` Markus Trippelsdorf
2014-09-26 23:27               ` Jan Hubicka
2014-09-27  5:59                 ` Markus Trippelsdorf
2014-09-27  7:47                   ` Markus Trippelsdorf
2014-09-27 10:46                     ` Martin Liška
2014-09-27 10:37                   ` Martin Liška
2014-09-28  2:21                     ` Jan Hubicka
2014-10-10 23:54                       ` Fakturace
2014-10-11  0:02                       ` Martin Liška
2014-10-11  8:23                         ` Jan Hubicka
2014-10-13 13:20                           ` Martin Liška
2014-10-13 13:29                             ` Jan Hubicka
2014-09-27 10:32                 ` Martin Liška
2014-09-26 20:47             ` Jan Hubicka
2014-10-11  0:08               ` Martin Liška
2014-10-11  8:26                 ` Jan Hubicka
2014-10-13 15:17                 ` Martin Liška
2014-10-14 16:12                   ` Jan Hubicka
2014-10-15 17:06                     ` Martin Liška
2014-10-22 21:20                       ` Jiong Wang
2014-11-06  3:01                         ` Joey Ye
2014-11-06  9:03                           ` Jan Hubicka
2014-11-13 22:26                       ` H.J. Lu
2015-01-20 21:29                         ` H.J. Lu
2014-09-26 22:27             ` Jan Hubicka
2014-10-11  0:23               ` Martin Liška
2014-10-11  9:05                 ` Jan Hubicka
2014-06-24 20:31   ` Jeff Law
2014-06-26 16:02     ` Martin Liška
2014-06-26 18:46     ` Jan Hubicka
2014-06-30 12:05       ` Martin Liška
2014-07-01 23:45         ` Trevor Saunders
2014-06-30 19:06       ` Jeff Law
2014-06-17 19:49 ` [PATCH 1/5] New Identical Code Folding IPA pass Jeff Law
2014-06-18 19:05   ` Jan Hubicka
2014-06-17 20:09 ` Paolo Carlini
2014-06-18  8:46   ` Martin Liška
2014-06-18  8:49     ` Paolo Carlini
2014-06-17 20:17 ` David Malcolm
2014-06-18  8:10   ` Martin Liška

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).