public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/siemens/heads/gcc-10-lto-fixes)] lto: Don't run ipa-comdats pass during LTO
Date: Mon,  6 Dec 2021 23:10:13 +0000 (GMT)	[thread overview]
Message-ID: <20211206231013.114753858D28@sourceware.org> (raw)

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;
 }


                 reply	other threads:[~2021-12-06 23:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211206231013.114753858D28@sourceware.org \
    --to=sandra@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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).