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

Reply via email to