public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/105715] [13 Regression] missed RTL if-conversion with COND_EXPR change
Date: Tue, 24 May 2022 10:38:42 +0000	[thread overview]
Message-ID: <bug-105715-4-VbbumTETzx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105715-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So I guess the trick might be to notice that ...

;; _2 = a_1(D) < b_10(D);

(insn 12 11 13 (set (reg:CCGC 17 flags)
        (compare:CCGC (reg/v:DI 86 [ a ])
            (reg/v:DI 87 [ b ]))) -1
     (nil))

(insn 13 12 14 (set (reg:QI 92)
        (lt:QI (reg:CCGC 17 flags)
            (const_int 0 [0]))) -1
     (nil))

(insn 14 13 0 (set (reg:QI 82 [ _2 ])
        (reg:QI 92)) -1
     (nil))

... we expand to CCGCmode here ...

_3 replace with --> _3 = _2 ? c_4(D) : d_5(D);
 ;; *p_9(D) = _3;

(insn 15 14 16 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:QI 82 [ _2 ])
            (const_int 0 [0]))) "t2.c":12:7 -1
     (nil))

(insn 16 15 17 (set (reg:DI 93)
        (if_then_else:DI (ne (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (reg/v:DI 88 [ c ])
            (reg/v:DI 89 [ d ]))) "t2.c":12:7 -1
     (nil))

... and thus want to use a CCGCmode based compare here as well?  We can
of course force-forward ("un-CSE") the condition during RTL expansion.
But the question would be what's the best approach to deal with the
situation so that followup RTL passes have a chance to optimize the
redundant compares?

  parent reply	other threads:[~2022-05-24 10:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  9:26 [Bug rtl-optimization/105715] New: " rguenth at gcc dot gnu.org
2022-05-24 10:29 ` [Bug rtl-optimization/105715] " rguenth at gcc dot gnu.org
2022-05-24 10:33 ` rguenth at gcc dot gnu.org
2022-05-24 10:38 ` rguenth at gcc dot gnu.org [this message]
2023-04-08 14:44 ` law at gcc dot gnu.org
2023-04-26  6:56 ` [Bug rtl-optimization/105715] [13/14 " rguenth at gcc dot gnu.org
2023-07-18  8:12 ` rguenth at gcc dot gnu.org
2023-07-18 13:43 ` cvs-commit at gcc dot gnu.org
2023-07-18 13:43 ` [Bug rtl-optimization/105715] [13 " rguenth at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2024-05-21  9:11 ` 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-105715-4-VbbumTETzx@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).