public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/98514] New: ICE in insert_operand_rank
Date: Mon, 04 Jan 2021 15:58:20 +0000	[thread overview]
Message-ID: <bug-98514-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98514

            Bug ID: 98514
           Summary: ICE in insert_operand_rank
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

When building gmic on i686-linux (or other 32-bit arches) with LTO, one gets:
gmic.cpp: In member function '_run.isra':
gmic.cpp:4981:7: internal compiler error: in insert_operand_rank, at
tree-ssa-reassoc.c:367
 4981 | gmic& gmic::_run(const CImgList<char>& commands_line, unsigned int&
position,
      |       ^
It is in 101th partition and the function is huge, so am not going to reduce,
but it seems a general reassoc issue on 32-bit hosts.

The function in question has 104549 SSA_NAMEs and 36954 basic blocks.
Now, the bb ranks are computed as:
  /* Give each default definition a distinct rank.  This includes
     parameters and the static chain.  Walk backwards over all
     SSA names so that we get proper rank ordering according
     to tree_swap_operands_p.  */
  for (i = num_ssa_names - 1; i > 0; --i)
    {
      tree name = ssa_name (i);
      if (name && SSA_NAME_IS_DEFAULT_DEF (name))
        insert_operand_rank (name, ++rank);
    }

  /* Set up rank for each BB  */
  for (i = 0; i < n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; i++)
    bb_rank[bbs[i]] = ++rank << 16;
and bb_rank as well as everything else that deals with ranks is long,
so obviously it can't work properly in any function which has more than
32767 (num_ssa_names + n_basic_blocks_for_fn (cfun)).
Either we should punt on trying to reassociate such functions, but that would
make 32-bit hosts behave differently from 64-bit hosts even when targeting the
same target, or my preferred way out of this is make the ranks just
HOST_WIDE_INTs, yes, it will need more memory on 32-bit hosts and will be
slightly slower, but it will be consistent with 64-bit hosts.  We have vectors
of ssa names and basic blocks and those have int length, so even on 64-bit
hosts we can't support more than 4 billion ssa names and more than 4 billion
basic blocks.

             reply	other threads:[~2021-01-04 15:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 15:58 jakub at gcc dot gnu.org [this message]
2021-01-04 16:12 ` [Bug tree-optimization/98514] " jakub at gcc dot gnu.org
2021-01-04 16:33 ` jakub at gcc dot gnu.org
2021-01-05 11:28 ` rguenth at gcc dot gnu.org
2021-01-05 15:38 ` cvs-commit at gcc dot gnu.org
2021-01-05 15:39 ` jakub at gcc dot gnu.org
2021-01-06  9:40 ` cvs-commit at gcc dot gnu.org
2021-01-29 10:39 ` jakub at gcc dot gnu.org

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=bug-98514-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).