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 rtl-optimization/103860] [9/10/11/12 Regression] wrong code at -O3 with -fPIC on x86_64-linux-gnu
Date: Wed, 29 Dec 2021 18:10:46 +0000	[thread overview]
Message-ID: <bug-103860-4-BCdss9tsFX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103860-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In the:
  while (!vec.is_empty () && pro != entry)
    {
      while (pro != entry && !can_get_prologue (pro, prologue_clobbered))
        {
          pro = get_immediate_dominator (CDI_DOMINATORS, pro);

          if (bitmap_set_bit (bb_with, pro->index))
            vec.quick_push (pro);
        }

      basic_block bb = vec.pop ();
      if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size))
        while (!dominated_by_p (CDI_DOMINATORS, bb, pro))
          {
            gcc_assert (pro != entry);

            pro = get_immediate_dominator (CDI_DOMINATORS, pro);

            if (bitmap_set_bit (bb_with, pro->index))
              vec.quick_push (pro);
          }

      FOR_EACH_EDGE (e, ei, bb->succs)
        if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)
            && bitmap_set_bit (bb_with, e->dest->index))
          vec.quick_push (e->dest);
    }
loop, initially we try as pro bb 7 for which can_get_prologue (pro,
prologue_clobbered) is true.
We iterate for a while, until bb_with is 3, 4, 5, 6, 7, 8, pro still 7,
and we pop bb 6, for which can_dup_for_shrink_wrapping is false.
vec at this point is empty.  As bb 6 isn't dominated by pro 7, we change
pro to the immediate dominator of bb 7 which is bb 5, and as it already is in
bb_with bitmap, we don't push anything.  bb 6 also has no successors (it traps
at the end), so we don't push there anything either.  And because vec.is_empty
() is true, the outer loop doesn't iterate any longer and so nothing checks if
can_get_prologue (pro, prologue_clobbered) (which is false for bb 5).

  parent reply	other threads:[~2021-12-29 18:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 16:08 [Bug tree-optimization/103860] New: " zhendong.su at inf dot ethz.ch
2021-12-29 17:17 ` [Bug rtl-optimization/103860] [9/10/11/12 Regression] " jakub at gcc dot gnu.org
2021-12-29 17:32 ` jakub at gcc dot gnu.org
2021-12-29 18:10 ` jakub at gcc dot gnu.org [this message]
2021-12-29 18:23 ` jakub at gcc dot gnu.org
2021-12-29 19:43 ` segher at gcc dot gnu.org
2021-12-29 19:58 ` jakub at gcc dot gnu.org
2021-12-29 20:30 ` segher at gcc dot gnu.org
2021-12-30 13:24 ` cvs-commit at gcc dot gnu.org
2021-12-30 13:39 ` [Bug rtl-optimization/103860] [9/10/11 " jakub at gcc dot gnu.org
2022-01-04  9:13 ` cvs-commit at gcc dot gnu.org
2022-01-04 13:59 ` rguenth at gcc dot gnu.org
2022-01-24  9:20 ` cvs-commit at gcc dot gnu.org
2022-01-24  9:30 ` [Bug rtl-optimization/103860] [9/10 " jakub at gcc dot gnu.org
2022-05-10  8:22 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:23 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` 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-103860-4-BCdss9tsFX@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).