public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/109311] New: [13 Regression] bb_is_just_return miss to realize some bb from r13-6873-g776a5bb5894315
Date: Tue, 28 Mar 2023 05:33:55 +0000	[thread overview]
Message-ID: <bug-109311-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 109311
           Summary: [13 Regression] bb_is_just_return miss to realize some
                    bb from r13-6873-g776a5bb5894315
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linkw at gcc dot gnu.org
  Target Milestone: ---

Commit r13-6873-g776a5bb5894315 changed BB insns walking order under the
assumption that the handlings in the loop is order independent. But
unfortunately some failures shows it's not.

For a BB:

   15: L15:
   20: NOTE_INSN_BASIC_BLOCK 5
   19: use %3:SI
   32: NOTE_INSN_EPILOGUE_BEG
   33: simple_return
;;  succ:       EXIT

Previously function bb_is_just_return would return true while now it returns
false, since backward walking will meet return insn first, the USE insn isn't
considered as one use to be in *use but instead is taken as unexpected insn
then return false.

By adjusting it not to check !*ret for use can workaround it, 

         if (!*ret && ANY_RETURN_P (pat))
           *ret = insn;
-        else if (!*ret && !*use && GET_CODE (pat) == USE
+        else if (!*use && GET_CODE (pat) == USE
             && REG_P (XEXP (pat, 0))
             && REG_FUNCTION_VALUE_P (XEXP (pat, 0)))
           *use = insn;

but I'm not sure if there is some reason to check both !*ret && !*use, such as
to exclude something like:

    simple_return
    use %3:SI

             reply	other threads:[~2023-03-28  5:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  5:33 linkw at gcc dot gnu.org [this message]
2023-03-28  5:36 ` [Bug rtl-optimization/109311] " linkw at gcc dot gnu.org
2023-03-28  7:31 ` rguenth at gcc dot gnu.org
2023-03-28  7:33 ` cvs-commit at gcc dot gnu.org
2023-03-28  7:35 ` rguenth 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-109311-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).