From: "Martin Liška" <mliska@suse.cz>
To: Segher Boessenkool <segher@kernel.crashing.org>,
Richard Biener <richard.guenther@gmail.com>,
Andrew Pinski <pinskia@gmail.com>
Cc: GCC Mailing List <gcc@gcc.gnu.org>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Try LTO partial linking. (Was: Speed of compiling gimple-match.c)
Date: Thu, 20 May 2021 14:34:25 +0200 [thread overview]
Message-ID: <5f13a740-5eff-886f-2b29-52a305fdf3b1@suse.cz> (raw)
In-Reply-To: <20210512121248.GU10366@gate.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 726 bytes --]
Hello.
I've got a patch candidate that leverages partial linking for a couple of selected object files.
I'm sending make all-host- jX results for my machine:
before: 3m18s (user 32m52s)
https://gist.githubusercontent.com/marxin/223890df4d8d8e490b6b2918b77dacad/raw/1dd5eae5001295ba0230a689f7edc67284c9b742/gcc-all-host.svg
after: 2m57m (user 35m)
https://gist.githubusercontent.com/marxin/223890df4d8d8e490b6b2918b77dacad/raw/d659b2187cf622167841efbbe6bc93cb33855fa9/gcc-all-host-partial-lto.svg
One can utilize it with:
make -j16 all-host PARTIAL_LTO=1
@Segher, Andrew: Can you please measure time improvement for your slow bootstrap?
One can also tweak --param=lto-partitions=16 param value.
Thoughts?
Thanks,
Martin
[-- Attachment #2: 0001-Try-LTO-partial-linking.patch --]
[-- Type: text/x-patch, Size: 2367 bytes --]
From 85228e612610c0e4b0324f6bebc84ef7c0211c4a Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 20 May 2021 14:29:35 +0200
Subject: [PATCH] Try LTO partial linking.
---
gcc/Makefile.in | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 1164554e6d6..f76bcea66f5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -220,7 +220,9 @@ libgcov-util.o-warn = -Wno-error
libgcov-driver-tool.o-warn = -Wno-error
libgcov-merge-tool.o-warn = -Wno-error
gimple-match.o-warn = -Wno-unused
+gimple-match-lto.o-warn = -Wno-unused
generic-match.o-warn = -Wno-unused
+generic-match-lto.o-warn = -Wno-unused
dfp.o-warn = -Wno-strict-aliasing
# All warnings have to be shut off in stage1 if the compiler used then
@@ -1282,12 +1284,10 @@ ANALYZER_OBJS = \
# will build them sooner, because they are large and otherwise tend to be
# the last objects to finish building.
OBJS = \
- gimple-match.o \
- generic-match.o \
+ common-base.a \
insn-attrtab.o \
insn-automata.o \
insn-dfatab.o \
- insn-emit.o \
insn-extract.o \
insn-latencytab.o \
insn-modes.o \
@@ -1295,7 +1295,6 @@ OBJS = \
insn-output.o \
insn-peep.o \
insn-preds.o \
- insn-recog.o \
insn-enums.o \
ggc-page.o \
adjust-alignment.o \
@@ -2627,6 +2626,29 @@ s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
generic-match.c
$(STAMP) s-match
+ifdef PARTIAL_LTO
+LTO_LINKER_FLAGS = -flto=auto --param=lto-partitions=16 -flinker-output=nolto-rel -r
+LTO_FLAGS = -flto
+
+gimple-match-lto.o: gimple-match.c $(TARGET_H)
+ $(COMPILE) $< $(LTO_FLAGS)
+generic-match-lto.o: generic-match.c $(TARGET_H)
+ $(COMPILE) $< $(LTO_FLAGS)
+insn-recog-lto.o: insn-recog.c
+ $(COMPILE) $< $(LTO_FLAGS)
+insn-emit-lto.o: insn-emit.c
+ $(COMPILE) $< $(LTO_FLAGS)
+
+common-base.a: gimple-match-lto.o generic-match-lto.o insn-recog-lto.o insn-emit-lto.o
+ -rm -rf $@
+ $(LINKER) $^ $(LTO_LINKER_FLAGS) -o common-base.o
+ $(AR) $(AR_FLAGS)T $@ common-base.o
+else
+common-base.a: gimple-match.o generic-match.o insn-recog.o insn-emit.o
+ -rm -rf $@
+ $(AR) $(AR_FLAGS)T $@ $^
+endif
+
GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(host_xm_file_list) \
$(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/bitmap.h \
--
2.31.1
next parent reply other threads:[~2021-05-20 12:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+=Sn1=+tuqG7qu5C6_atWzJp+af1P6oVPvABHxqNxiUmJb1dg@mail.gmail.com>
[not found] ` <CAFiYyc1DC1W==r37RhVX9epv1F5XSQhr1XeZEKCk1QOBObSKaQ@mail.gmail.com>
[not found] ` <20210511145904.GM10366@gate.crashing.org>
[not found] ` <CAFiYyc12G6qAeCevEH0-oE4kX7KN1gafBHN4UNYnQJWQVujffg@mail.gmail.com>
[not found] ` <20210512121248.GU10366@gate.crashing.org>
2021-05-20 12:34 ` Martin Liška [this message]
2021-05-20 12:54 ` Richard Biener
2021-05-20 13:06 ` Martin Liška
2021-05-20 13:16 ` Richard Biener
2021-05-20 13:22 ` Richard Biener
2021-05-20 15:55 ` Jan Hubicka
2021-05-21 8:29 ` Martin Liška
2021-06-01 7:31 ` Martin Liška
2021-06-23 13:53 ` Martin Liška
2021-08-16 13:58 ` Martin Liška
2021-08-20 14:54 ` Martin Liška
2021-08-22 13:09 ` Jan Hubicka
2021-06-12 15:55 ` Giuliano Belinassi
2021-05-21 8:43 ` Martin Liška
2021-05-21 12:35 ` David Edelsohn
2021-05-24 8:07 ` Martin Liška
2021-06-01 7:33 ` Martin Liška
2021-06-01 7:42 ` Richard Biener
2021-06-01 11:25 ` Martin Liška
2021-06-01 13:19 ` Richard Biener
2021-08-20 14:57 ` Martin Liška
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f13a740-5eff-886f-2b29-52a305fdf3b1@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=pinskia@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).