public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/103439] genemit emits dead code
Date: Fri, 26 Nov 2021 22:06:39 +0000	[thread overview]
Message-ID: <bug-103439-4-GMnsNrUIz3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103439-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> so quite hard if not impossible to "fix" in genemit

The most complex one I saw in action was mod<mode>3 in aarch64.md:
(define_expand "mod<mode>3"
  [(match_operand:GPI 0 "register_operand")
   (match_operand:GPI 1 "register_operand")
   (match_operand:GPI 2 "const_int_operand")]

Where the pattern in the expand is not going to be used at all (obviously) but
has a conditional FAIL and then an unconditional DONE.
    if (val <= 0
       || exact_log2 (val) <= 0
       || !aarch64_bitmask_imm (val - 1, <MODE>mode))
      FAIL;
....
    rtx masked_neg = gen_reg_rtx (<MODE>mode);
    emit_insn (gen_and<mode>3 (masked_neg, neg_op, mask));

    emit_insn (gen_csneg3<mode>_insn (operands[0], cond,
                                       masked_neg, masked_pos));
    DONE;


And even splits will have issues too. See "*compare_condjump<GPI:mode>" in
aarch64 where the pattern in the split will not be used but then there is an
unconditional DONE:
    emit_jump_insn (gen_condjump (cmp_rtx, cc_reg, operands[2]));
    DONE;


I think we should just close this as won't fix and add -Wno-unreachable-code
while compiling the generated C file.

  parent reply	other threads:[~2021-11-26 22:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 12:10 [Bug middle-end/103439] New: " rguenth at gcc dot gnu.org
2021-11-26 12:26 ` [Bug middle-end/103439] " ubizjak at gmail dot com
2021-11-26 12:28 ` rguenther at suse dot de
2021-11-26 13:11 ` ubizjak at gmail dot com
2021-11-26 13:38 ` rguenth at gcc dot gnu.org
2021-11-26 22:06 ` pinskia at gcc dot gnu.org [this message]
2021-11-29  7:21 ` 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-103439-4-GMnsNrUIz3@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).