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 target/107257] [13 Regression] Wrong code at -O2 on x86_64-linux-gnu since r13-857-gf1652e3343b1ec47
Date: Mon, 17 Oct 2022 11:09:55 +0000	[thread overview]
Message-ID: <bug-107257-4-eqEiQqEBMe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107257-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
With -fno-tree-slp-vectorize the failure goes away.  diff in optimized:

 __attribute__((noipa, noinline, noclone, no_icf))
 void q ()
 {
-  <bb 2> [local count: 1073742492]:
-  MEM <unsigned long> [(int *)&d] = 18380021091030725580;
+  int b_lsm.15;
+  int f;
+  _Bool _5;
+
+  <bb 2> [local count: 1073741824]:
+  MEM <vector(2) int> [(int *)&d] = { -15535156, -15535156 };
   d[2] = -15535156;
+
+  <bb 3> [local count: 8687551919]:
+  # f_30 = PHI <f_25(5), 0(2)>
+  if (f_30 == 0)
+    goto <bb 5>; [1.43%]
+  else
+    goto <bb 4>; [98.57%]
+
+  <bb 4> [local count: 4698759900]:
+  if (f_30 != 2)
+    goto <bb 5>; [79.66%]
+  else
+    goto <bb 6>; [20.34%]
+
+  <bb 5> [local count: 7731921808]:
+  # f_25 = PHI <2(4), 1(3)>
+  goto <bb 3>; [100.00%]
+
+  <bb 6> [local count: 1073742492]:
   a = 2;
-  b = -1;
+  _5 = f_30 == 0;
+  b_lsm.15_33 = _5 ? 2 : -1;
+  b = b_lsm.15_33;
   return;

 }

both variants look OK so instead RTL expansion looks fishy(?)

;; b = b_lsm.15_33;

(insn 28 26 29 (parallel [
            (set (reg:CCC 17 flags)
                (ne:CCC (reg/v:SI 83 [ f ])
                    (const_int 0 [0])))
            (set (reg:SI 89)
                (neg:SI (reg/v:SI 83 [ f ])))
        ]) -1
     (nil))

(insn 29 28 30 (parallel [
            (set (reg:SI 90)
                (neg:SI (ltu:SI (reg:CCC 17 flags)
                        (const_int 0 [0]))))
            (clobber (reg:CC 17 flags))
        ]) -1
     (nil))

(insn 30 29 31 (parallel [
            (set (reg:SI 90)
                (ior:SI (reg:SI 90)
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) -1
     (nil))

(insn 31 30 32 (set (reg:SI 88 [ b_lsm.15 ])
        (reg:SI 90)) -1
     (nil))

(insn 32 31 0 (set (mem/c:SI (symbol_ref:DI ("b") [flags 0x2]  <var_decl
0x7ffff6526d80 b>) [1 b+0 S4 A32])
        (reg:SI 88 [ b_lsm.15 ])) -1
     (nil))

and we eventually optimize this to

q:
.LFB2:
        .cfi_startproc
        movq    .LC0(%rip), %rax
        movl    $-15535156, d+8(%rip)
        movl    $2, a(%rip)
        movq    %rax, d(%rip)
        movl    $2, b(%rip)
        ret

  parent reply	other threads:[~2022-10-17 11:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  8:32 [Bug c/107257] New: Wrong code at -O2 on x86_64-linux-gnu shaohua.li at inf dot ethz.ch
2022-10-14  9:27 ` [Bug c/107257] " rguenth at gcc dot gnu.org
2022-10-14 10:00 ` marxin at gcc dot gnu.org
2022-10-14 10:03 ` marxin at gcc dot gnu.org
2022-10-14 12:52 ` rguenth at gcc dot gnu.org
2022-10-17 10:27 ` shaohua.li at inf dot ethz.ch
2022-10-17 11:05 ` [Bug target/107257] [13 Regression] Wrong code at -O2 on x86_64-linux-gnu since r13-857-gf1652e3343b1ec47 marxin at gcc dot gnu.org
2022-10-17 11:09 ` rguenth at gcc dot gnu.org [this message]
2022-10-20 17:25 ` pinskia at gcc dot gnu.org
2023-07-27  8:01 ` shaohua.li at inf dot ethz.ch
2023-07-27 14:47 ` shaohua.li at inf dot ethz.ch

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-107257-4-eqEiQqEBMe@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).