Re: [PATCH 3/5] ipa: Dump cgraph_node UID instead of order into ipa-clones dump file

2025-04-30 Thread Michal Jires
On Mon, 2025-04-28 at 16:10:58 +0200, Martin Jambor wrote: > Hi, > > starting with GCC 15 the order is not unique for any symtab_nodes but > m_uid is, I believe we ought to dump the latter in the ipa-clones dump, > if only so that people can reliably match entries about new clones to > those about

Re: [PATCH] doc: document incremental LTO flags

2025-03-28 Thread Michal Jires
On Thu, 2025-03-27 at 15:33:44 +, Sam James wrote: > > One thing I wasn't quite sure on yet: is -flto-partition=cache automatic > with -flto-incremental? Or is it just an optional flag I can pass for > more effective incremental LTO? > > If it's the latter, should we mention that in the -flto

Re: [COMMITTED,wwwdocs] Mention Incremental LTO in GCC15

2025-03-27 Thread Michal Jires
(already Ok-ed off-list, since I forgot to Cc: ) On Thu, 2025-03-27 at 14:40:57 +0100, Gerald Pfeifer wrote: > On Thu, 27 Mar 2025, Michal Jires wrote: > > + Introduced incremental Link-Time Optimizations to significantly > > reduce > > +average recompilation time wi

[PATCH,wwwdocs] Mention Incremental LTO in GCC15

2025-03-27 Thread Michal Jires
This patch adds mention of my new Incremental LTO in gcc-15/changes.html General Improvements. Ok? --- htdocs/gcc-15/changes.html | 6 ++ 1 file changed, 6 insertions(+) diff --git a/htdocs/gcc-15/changes.html b/htdocs/gcc-15/changes.html index dbc82be2..8a050aed 100644 --- a/htdocs/gcc-15/

[COMMITTED] doc: Regenerate common.opt.urls

2025-03-17 Thread Michal Jires
Regenerated common.opt.urls, which I missed until autobuilder noticed. Committed as obvious. gcc/ChangeLog: * common.opt.urls: Regenerate. --- gcc/common.opt.urls | 6 ++ 1 file changed, 6 insertions(+) diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls index 79c322bed2b..ac602

[PATCH] lto: Fix missing cleanup with incremental LTO.

2025-03-15 Thread Michal Jires
Incremental LTO disabled cleanup of output_files since they have to persist in ltrans cache. This unintetionally also kept temporary early debug "*.debug.temp.o" files. Bootstrapped/regtested on x86_64-linux. Ok for trunk? lto-plugin/ChangeLog: * lto-plugin.c (cleanup_handler): Keep only

[PATCH] doc: document incremental LTO flags

2025-03-13 Thread Michal Jires
This adds missing documentation for LTO flags. Ok? gcc/ChangeLog: * doc/invoke.texi: (Optimize Options): Add incremental LTO flags. --- gcc/doc/invoke.texi | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/d

[PATCH] Fix uniqueness of symtab_node::get_dump_name.

2025-01-16 Thread Michal Jires
symtab_node::get_dump_name uses node order to identify nodes. Order is no longer unique because of Incremental LTO patches. This patch moves uid from cgraph_node node to symtab_node, so get_dump_name can use uid instead and get back unique dump names. In inlining passes, uid is replaced with more

[PATCH] lto: Remove link() to fix build with MinGW [PR118238]

2025-01-13 Thread Michal Jires
I used link() to create cheap copies of Incremental LTO cache contents to prevent their deletion once linking is finished. This is unnecessary, since output_files are deleted in our lto-plugin and not in the linker itself. Bootstrapped/regtested on x86_64-linux. lto-wrapper now again builds on Min

[committed] lto: Pass cache checksum by reference [PR118181]

2025-01-12 Thread Michal Jires
Bootstrapped/regtested on x86_64-linux. Committed as obvious. PR lto/118181 gcc/ChangeLog: * lto-ltrans-cache.cc (ltrans_file_cache::create_item): Pass checksum by reference. * lto-ltrans-cache.h: Likewise. --- gcc/lto-ltrans-cache.cc | 2 +- gcc/lto-ltrans-cache

[committed] lto: Fix empty fnctl.h build error with MinGW.

2025-01-12 Thread Michal Jires
MSYS2+MinGW contains headers without defining expected contents. This fix checks that the fcntl function is actually defined. Bootstrapped/regtested on x86_64-linux. Committed as obvious. gcc/ChangeLog: * lockfile.cc (LOCKFILE_USE_FCNTL): New. (lockfile::lock_write): Use LOCKFILE

[PATCH 4/7 v4] lto: Implement ltrans cache

2024-12-13 Thread Michal Jires
On Thu, 2024-12-12 at 15:48:19 +, Jan Hubicka wrote: > fgetc has kind of non-trivial overhead. For non-MMAP systems (is > Windows such?), I think allocating some buffer, say 64K > and doing fread/memcmp is probably better. Ok, changed to fread/memcmp fallback. > Isn't std::string always 0 ter

[PATCH 3/3 v2] lto: Remap node order for stability.

2024-12-12 Thread Michal Jires
On Sun, 2024-11-17 at 19:15:04 +, Jan Hubicka wrote: > > I would suggest renaming produce_asm to produce_symbol_asm > and making produce_asm wrapper which passes fn=NULL and output_order=-1, > so we do not have odd parameters everywhere in streaming code. > > OK with this change. > Honza Ap

[PATCH 2/3 v2] dwarf: lto: Allow die_symbol outside of comp_unit.

2024-12-12 Thread Michal Jires
On Wed, 2024-11-27 at 15:18:39 +, Richard Biener wrote: > I'm not sure it will work this way together with the output_die hunk, > instead > assemblers likely expect all this to happen close to the actual label > emission, so I suggest to only split out the visibiltiy/globalizing fancy > and emi

[PATCH 4/7 v3] lto: Implement ltrans cache

2024-11-08 Thread Michal Jires
Changes from previous version: 1) As suggested, I replaced md5 with sha1. Though I have not been able to measure a difference. Checksum computation will be later moved to WPA before partitions are streamed to disk. 2) File comparison with mmap. Ltrans cache overhead when compiling cc1: whole LT

Re: [COMMITED] [lto] ipcp don't propagate where not needed

2024-11-06 Thread Michal Jires
On Wed, 2024-11-06 at 17:33:50 +, Jonathan Wakely wrote: > > If there's going to be a constructor then it should initialize the members. > > Otherwise, your original patch was better, because you could write > this to get an all-zeros object: > > lto_encoder_entry e{}; > > Now you can't s

[PATCH 1/3] dwarf: Delete dead code.

2024-11-06 Thread Michal Jires
This if branch checks for comdat_type_p (GTY union tag) and then uses incorrect union variant die_id.die_symbol. There is no way to create this combination of valid values even if we ignore the GTY. Running testsuite with abort() in branch confirms that it is never taken. gcc/ChangeLog:

[PATCH 0/3] dwarf: incremental lto: Stabilize external references.

2024-11-06 Thread Michal Jires
These patches allow adding additional die symbols, so that external references represented as 'die_symbol+offset' don't diverge contents of LTO partitions. Bootstrapped/regtested on x86_64-linux

[PATCH 3/3] incremental lto: Remap node order for stability.

2024-11-06 Thread Michal Jires
This patch adds remapping of node order for each lto partition. Resulting order conserves relative order inside partition, but is independent of outside symbols. So if lto partition contains identical set of symbols, their remapped order will be stable between compilations. gcc/ChangeLog:

[PATCH 3/3] dwarf: lto: Stabilize external die references.

2024-11-06 Thread Michal Jires
During Incremental LTO, contents of LTO partitions diverge because of external DIE references (DW_AT_abstract_origin). External references are in form 'die_symbol+offset'. Originally there is only single die_symbol for each compilation unit and its offsets are in 100'000s, which easily diverge. D

[COMMITED] [lto] ipcp don't propagate where not needed

2024-11-06 Thread Michal Jires
Commited with suggested changes. - This patch disables propagation of ipcp information into partitions where all instances of the node are marked to be inlined. Motivation: Incremental LTO needs stable values between compilation

[PATCH 1/3] ipa-strub: Replace cgraph_node order with uid.

2024-11-06 Thread Michal Jires
ipa_strub_set_mode_for_new_functions uses node order as unique ever increasing identifier. This is better satisfied with uid. Order loses uniqueness with following patches. gcc/ChangeLog: * ipa-strub.cc (ipa_strub_set_mode_for_new_functions): Replace order with uid. (pass

[PATCH 2/3] dwarf: lto: Allow die_symbol outside of comp_unit.

2024-11-06 Thread Michal Jires
Die symbols are used for external references. Typically during LTO, early debug emits 'die_symbol+offset' for each possibly referenced DIE in future. Partitions in LTRANS phase then use these references. Originally die symbols are handled only in root comp_unit and in attributes. This patch allow

[PATCH 0/3] incremental lto: Stabilizing node order.

2024-11-06 Thread Michal Jires
This set of patches replaces the original Incremental LTO patch for stabilizing node order in lto partitions. Main difference is earlier handling of node clone order, as suggested by Honza (https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651593.html). Previously I simply set clone's order to ze

[PATCH 2/3] Node clones share order.

2024-11-06 Thread Michal Jires
Symbol order corresponds to the order in source code. For clones their order is currently arbitrarily chosen as max order++ But it would be more consistent with original purpose to choose clones order to be shared with the original node order. This stabilizes clone order for Incremental LTO. Order

[PATCH] [lto] ipcp don't propagate where not needed

2024-10-25 Thread Michal Jires
This patch disables propagation of ipcp information into lto partitions where all instances of the node are marked to be inlined. Motivation: Incremental LTO needs stable values between compilations to be effective. This requirement fails with following example: void heavily_used_debug_function(i

[PATCH 4/7 v2] lto: Implement ltrans cache

2024-06-20 Thread Michal Jires
Outside of suggested changes, this version: - uses #define INCLUDE_* - is rebased onto current trunk - 'fprintf (mstream,' lines - --verbose 'recompiling++' count is moved into correct if branch ___ This patch implements Incremental LTO as ltrans cache. The cache is active when directory $GCC_LT

[PATCH 3/7 v2] Lockfile.

2024-06-20 Thread Michal Jires
This version differs by using INCLUDE_STRING instead of . (+whitespace and year) ___ This patch implements lockfile used for incremental LTO. Bootstrapped/regtested on x86_64-pc-linux-gnu gcc/ChangeLog: * Makefile.in: Add lockfile.o. * lockfile.cc: New file. * lockfile.

Re: [PATCH 3/7] Lockfile.

2024-01-09 Thread Michal Jires
Hi, > You do not implement GCOV_LINKED_WITH_LOCKING patch, does locking work > with mingw? Or we only build gcc with cygwin emulation layer these days? I tried to test _locking implementation with both mingw and msys2, in both cases fcntl was present and _locking was not. Admittedly I was unable t

[PATCH 2/7 v2] lto: Remove random_seed from section name.

2024-01-09 Thread Michal Jires
This patch removes suffixes from section names during LTO linking. These suffixes were originally added for ld -r to work (PR lto/44992). They were added to all LTO object files, but are only useful before WPA. After that they waste space, and if kept random, make LTO caching impossible. Bootstra

[PATCH 7/7] lto: partition specific lto_clone_numbers

2023-11-17 Thread Michal Jires
Replaces "lto_priv.$clone_number" by "lto_priv.$partition_hash.$partition_specific_clone_number". To reduce divergence for incremental LTO. Bootstrapped/regtested on x86_64-pc-linux-gnu gcc/lto/ChangeLog: * lto-partition.cc (set_clone_partition_name_checksum): New. (CHECKSUM_STRI

[PATCH 6/7] lto: squash order of symbols in partitions

2023-11-17 Thread Michal Jires
This patch squashes order of symbols in individual partitions, so that their relative order is conserved, but is not influenced by symbols in other partitions. Order of cloned symbols is set to 0. This should be fine because order specifies order of symbols in input files, which cloned symbols are

[PATCH 5/7] lto: Implement cache partitioning

2023-11-17 Thread Michal Jires
This patch implements new cache partitioning. It tries to keep symbols from single source file together to minimize propagation of divergence. It starts with symbols already grouped by source files. If reasonably possible it only either combines several files into one final partition, or, if a fil

[PATCH 3/7] Lockfile.

2023-11-17 Thread Michal Jires
This patch implements lockfile used for incremental LTO. Bootstrapped/regtested on x86_64-pc-linux-gnu gcc/ChangeLog: * Makefile.in: Add lockfile.o. * lockfile.cc: New file. * lockfile.h: New file. --- gcc/Makefile.in | 5 +- gcc/lockfile.cc | 136 +

[PATCH 4/7] lto: Implement ltrans cache

2023-11-17 Thread Michal Jires
This patch implements Incremental LTO as ltrans cache. The cache is active when directory $GCC_LTRANS_CACHE is specified and exists. Stored are pairs of ltrans input/output files and input file hash. File locking is used to allow multiple GCC instances to use to same cache. Bootstrapped/regtested

[PATCH 2/7] lto: Remove random_seed from section name.

2023-11-17 Thread Michal Jires
Bootstrapped/regtested on x86_64-pc-linux-gnu gcc/ChangeLog: * lto-streamer.cc (lto_get_section_name): Remove random_seed in WPA. --- gcc/lto-streamer.cc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/lto-streamer.cc b/gcc/lto-streamer.cc index 4968fd13413

[PATCH 1/7] lto: Skip flag OPT_fltrans_output_list_.

2023-11-17 Thread Michal Jires
Bootstrapped/regtested on x86_64-pc-linux-gnu gcc/ChangeLog: * lto-opts.cc (lto_write_options): Skip OPT_fltrans_output_list_. --- gcc/lto-opts.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/lto-opts.cc b/gcc/lto-opts.cc index c9bee9d4197..0451e290c75 100644 --- a/gcc/lto-opt

[PATCH 0/7] lto: Incremental LTO.

2023-11-17 Thread Michal Jires
Hi, these patches implement Incremental LTO, specifically by caching results of ltrans phase. Secondarily these patches contain changes to reduce divergence of ltrans partitions so that they can be cached. The aim is to reduce compile times for quick edit-compile cycles while using LTO. Even with

[COMMITTED] Add myself to write after approval

2023-11-16 Thread Michal Jires
Jangala Haochen Jiang Qian Jianhua +Michal Jires Janis Johnson Teresa Johnson Kean Johnston