public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/siemens/heads/gcc-10-lto-fixes)] lto: Don't run ipa-comdats pass during LTO
@ 2021-12-06 23:10 Sandra Loosemore
  0 siblings, 0 replies; only message in thread
From: Sandra Loosemore @ 2021-12-06 23:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3d0c0ba4f49d9cfc5cb7b92b62014d16fcb6996d

commit 3d0c0ba4f49d9cfc5cb7b92b62014d16fcb6996d
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Sun Dec 5 17:59:19 2021 -0800

    lto: Don't run ipa-comdats pass during LTO
    
    When the ipa-visibility pass is invoked during LTO, it attempts to
    localize comdat symbols and destroy their comdat group.  The
    ipa-comdats pass subsequently attempts to do the opposite and move
    symbols into comdats, but without marking them as DECL_COMDAT or
    restoring appropriate visibility flags.  This confuses the
    lto-partition pass and leads to ICEs.  Running the ipa-comdats pass at
    link time seems counterproductive in terms of optimization, so the
    simplest fix is not to do that.
    
    2021-12-05  Sandra Loosemore  <sandra@codesourcery.com>
    
            gcc/
            * ipa-comdats.c (pass_ipa_comdats::gate): Skip this pass if it
            would un-do the comdat localization already performed at LTO
            time in ipa-visibility.c.

Diff:
---
 gcc/ipa-comdats.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c
index feea458ca3f..fe56a6f470b 100644
--- a/gcc/ipa-comdats.c
+++ b/gcc/ipa-comdats.c
@@ -428,6 +428,13 @@ public:
 bool
 pass_ipa_comdats::gate (function *)
 {
+  if ((in_lto_p || flag_whole_program) && !flag_incremental_link)
+    /* This is the combination of flags cgraph_externally_visible_p in
+       ipa-visibility.c uses to enable localization of comdat symbols.
+       Do not attempt to undo that by trying to re-insert symbols into
+       comdats without their original visibility information, as it
+       causes assertion failures in lto-partition. */
+    return false;
   return HAVE_COMDAT_GROUP;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-06 23:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 23:10 [gcc(refs/vendors/siemens/heads/gcc-10-lto-fixes)] lto: Don't run ipa-comdats pass during LTO Sandra Loosemore

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