public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f
@ 2023-08-24  2:05 thiago.bauermann at linaro dot org
  2023-08-24  7:41 ` [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91 rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: thiago.bauermann at linaro dot org @ 2023-08-24  2:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111125
           Summary: tree-ssa.exp and vect.exp failures after commit
                    99b5921bfc8f
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago.bauermann at linaro dot org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Created attachment 55784
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55784&action=edit
gcc.log from commit 829c0c06fe7b

Our CI detected that commit 99b5921bfc8f "Handle TYPE_OVERFLOW_UNDEFINED
vectorized BB reductions" introduced these testsuite failures on aarch64-linux:

                === gcc tests ===

Running gcc:gcc.dg/tree-ssa/tree-ssa.exp ...
FAIL: gcc.dg/tree-ssa/slsr-11.c scan-tree-dump-times optimized " \\* " 1

Running gcc:gcc.dg/vect/vect.exp ...
FAIL: gcc.dg/vect/bb-slp-29.c -flto -ffat-lto-objects  scan-tree-dump-times
slp1 "optimized: basic block" 1
FAIL: gcc.dg/vect/bb-slp-29.c scan-tree-dump-times slp1 "optimized: basic
block" 1
FAIL: gcc.dg/vect/pr53773.c -flto -ffat-lto-objects  scan-tree-dump-times
optimized "\\* 10" 2
FAIL: gcc.dg/vect/pr53773.c scan-tree-dump-times optimized "\\* 10" 2

I confirmed that they are still present in trunk as of commit 829c0c06fe7b
"Fortran: improve diagnostic message for COMMON with automatic object
[PR32986]" from today.

The tests above fail with these messages found in gcc.log:

- gcc.dg/tree-ssa/slsr-11.c: pattern found 3 times
- gcc.dg/vect/bb-slp-29.c: pattern found 2 times
- gcc.dg/vect/pr53773.c: pattern found 0 times

Tested on Ubuntu 22.04 with:

$ ~/src/gcc/configure \
    --disable-bootstrap \
    --disable-multilib \
    && make -j 60 \
    && make -C gcc check-gcc RUNTESTFLAGS="gcc.dg/tree-ssa/tree-ssa.exp
gcc.dg/vect/vect.exp"

I'll attach gcc.log from trunk.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
@ 2023-08-24  7:41 ` rguenth at gcc dot gnu.org
  2023-08-24  8:15 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-24  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Keywords|                            |testsuite-fail
            Summary|tree-ssa.exp and vect.exp   |[14 Regression]
                   |failures after commit       |tree-ssa.exp and vect.exp
                   |r14-3281-g99b5921bfc8f91    |failures after commit
                   |                            |r14-3281-g99b5921bfc8f91

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
  2023-08-24  7:41 ` [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91 rguenth at gcc dot gnu.org
@ 2023-08-24  8:15 ` rguenth at gcc dot gnu.org
  2023-08-24  8:44 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-24  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-08-24
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
For gcc.dg/tree-ssa/slsr-11.c we vectorize the reduction to

  <bb 2> [local count: 1073741824]:
  _15 = {s_5(D), s_5(D)};
  vect_a3_11.3_16 = _15 * { 6, 4 };
  vect__3.4_17 = (vector(2) long int) vect_a3_11.3_16;
  a1_6 = s_5(D) * 2;
  _18 = VIEW_CONVERT_EXPR<vector(2) unsigned long>(vect__3.4_17);
  _19 = .REDUC_PLUS (_18);
  _20 = (unsigned long) a1_6;
  _21 = (unsigned long) c_7(D);
  _29 = _21 * 2;
  _31 = _19 + _29;
  _30 = _20 + _21;
  _27 = _30 + _31;
  _28 = (long int) _27;
  return _28;

note: Cost model analysis for part in loop 0:
  Vector cost: 9
  Scalar cost: 9

doesn't look profitable.  I think there's something off with the scalar
accounting, I'll have a look there.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
  2023-08-24  7:41 ` [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91 rguenth at gcc dot gnu.org
  2023-08-24  8:15 ` rguenth at gcc dot gnu.org
@ 2023-08-24  8:44 ` rguenth at gcc dot gnu.org
  2023-08-24  8:54 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-24  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
For gcc.dg/vect/bb-slp-29.c we are now vectorizing

#pragma GCC novector
  for (i = 0; i < N/2; i++)
    {
      if (dst[i] != A * src[i] + B * src[i+1])
        abort ();
    }

in particular the multiplication and the addition (but not the load which
had predictive commoning applied).  When cost modeling is enabled this
vectorization is not deemed profitable (but the vect testsuite runs with
-fno-vect-cost-model).

I wonder if we want to excempt basic blocks within loops marked with novector
from BB vectorization.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
                   ` (2 preceding siblings ...)
  2023-08-24  8:44 ` rguenth at gcc dot gnu.org
@ 2023-08-24  8:54 ` rguenth at gcc dot gnu.org
  2023-08-24  8:59 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-24  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
gcc.dg/vect/pr53773.c is interesting - we vectorize the function to

  <bb 2> [local count: 118111600]:
  _20 = {integral_4(D), decimal_5(D)};
  if (power_ten_6(D) > 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 3> [local count: 955630224]:
  # power_ten_19 = PHI <power_ten_11(3), power_ten_6(D)(2)>
  # vect_integral_15.4_1 = PHI <vect_integral_9.5_12(3), _20(2)>
  vect_integral_9.5_12 = vect_integral_15.4_1 * { 10, 10 };
  power_ten_11 = power_ten_19 + -1;
  if (power_ten_11 != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 4> [local count: 118111600]:
  # vect_integral_16.7_21 = PHI <vect_integral_9.5_12(3), _20(2)>
  _22 = VIEW_CONVERT_EXPR<vector(2) unsigned int>(vect_integral_16.7_21);
  _23 = .REDUC_PLUS (_22); [tail call]
  _24 = (int) _23;
  return _24;

where loop vectorization fails because

/space/rguenther/src/gcc/gcc/testsuite/gcc.dg/vect/pr53773.c:9:20: note: 
Analyze phi: integral_15 = PHI <integral_9(6), integral_4(D)(5)>
/space/rguenther/src/gcc/gcc/testsuite/gcc.dg/vect/pr53773.c:9:20: missed: 
Peeling for epilogue is not supported for nonlinear induction except neg when
iteration count is unknown.
/space/rguenther/src/gcc/gcc/testsuite/gcc.dg/vect/pr53773.c:9:20: missed:  not
vectorized: can't create required epilog loop

loop vectorization doesn't try SLP here because we only SLP reduction groups,
not induction groups.

So I think this vectorization is quite nice, possibly even better than
the loop vectorization we expect.  generated code:

foo:
.LFB0:
        .cfi_startproc
        fmov    s31, w0
        ins     v31.s[1], w1
        cmp     w2, 0
        ble     .L2
        movi    v30.2s, 0xa
        .p2align 3,,7
.L3:
        mul     v31.2s, v31.2s, v30.2s
        subs    w2, w2, #1
        bne     .L3
.L2:
        addp    v31.2s, v31.2s, v31.2s
        fmov    w0, s31
        ret

the path for power_ten == 0 is of course sub-optimal.  Note it's again
determined not profitable with costing (we do not try to weight stmts
based on profile, thus in-loop stmts cost the same as out-of-loop stmts).

I'm going to adjust the testcase, disabling BB vectorization.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
                   ` (3 preceding siblings ...)
  2023-08-24  8:54 ` rguenth at gcc dot gnu.org
@ 2023-08-24  8:59 ` cvs-commit at gcc dot gnu.org
  2023-08-24  9:36 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-24  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:308e716266787f84ba4a47546317dae83be8901c

commit r14-3436-g308e716266787f84ba4a47546317dae83be8901c
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Aug 24 10:55:06 2023 +0200

    testsuite/111125 - disable BB vectorization for the test

    The test is for loop vectorization producing non-canonical
    multiplications.  We can now BB vectorize the whole function
    when the target supports .REDUC_PLUS for V2SImode but we don't
    have a dejagnu selector for that.  Disable BB vectorization
    like we disabled epilogue vectorization.

            PR testsuite/111125
            * gcc.dg/vect/pr53773.c: Disable BB vectorization.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
                   ` (4 preceding siblings ...)
  2023-08-24  8:59 ` cvs-commit at gcc dot gnu.org
@ 2023-08-24  9:36 ` cvs-commit at gcc dot gnu.org
  2023-08-24 11:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-24  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:e80f7c13f64e10c6a3354c5d6b42da60b21ed0b8

commit r14-3440-ge80f7c13f64e10c6a3354c5d6b42da60b21ed0b8
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Aug 24 10:30:12 2023 +0200

    tree-optimization/111125 - properly cost BB reduction remain stmt handling

    We assume that all root stmts which compose the total reduction chain
    are vectorized but fail to account for the cost of adding back the
    scalar defs we are not vectorizing.  The following rectifies this,
    fixing the gcc.dg/tree-ssa/slsr-11.c FAIL on aarch64.

            PR tree-optimization/111125
            * tree-vect-slp.cc (vectorizable_bb_reduc_epilogue): Account
            for the remain_defs processing.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
                   ` (5 preceding siblings ...)
  2023-08-24  9:36 ` cvs-commit at gcc dot gnu.org
@ 2023-08-24 11:03 ` cvs-commit at gcc dot gnu.org
  2023-08-24 11:03 ` rguenth at gcc dot gnu.org
  2023-08-24 15:38 ` thiago.bauermann at linaro dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-24 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:43da77a4f1636280c4259402c9c2c543e6ec6c0b

commit r14-3444-g43da77a4f1636280c4259402c9c2c543e6ec6c0b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Aug 24 11:10:43 2023 +0200

    tree-optimization/111125 - avoid BB vectorization in novector loops

    When a loop is marked with

      #pragma GCC novector

    the following makes sure to also skip BB vectorization for contained
    blocks.  That avoids gcc.dg/vect/bb-slp-29.c failing on aarch64
    because of extra BB vectorization therein.  I'm not specifically
    dealing with sub-loops of novector loops, the desired semantics
    isn't documented.

            PR tree-optimization/111125
            * tree-vect-slp.cc (vect_slp_function): Split at novector
            loop entry, do not push blocks in novector loops.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
                   ` (6 preceding siblings ...)
  2023-08-24 11:03 ` cvs-commit at gcc dot gnu.org
@ 2023-08-24 11:03 ` rguenth at gcc dot gnu.org
  2023-08-24 15:38 ` thiago.bauermann at linaro dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-24 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be all fixed now.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91
  2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
                   ` (7 preceding siblings ...)
  2023-08-24 11:03 ` rguenth at gcc dot gnu.org
@ 2023-08-24 15:38 ` thiago.bauermann at linaro dot org
  8 siblings, 0 replies; 10+ messages in thread
From: thiago.bauermann at linaro dot org @ 2023-08-24 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Thiago Jung Bauermann <thiago.bauermann at linaro dot org> ---
Confirmed. All the failures I reported are fixed in trunk. Thank you!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-24 15:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-24  2:05 [Bug middle-end/111125] New: tree-ssa.exp and vect.exp failures after commit 99b5921bfc8f thiago.bauermann at linaro dot org
2023-08-24  7:41 ` [Bug middle-end/111125] [14 Regression] tree-ssa.exp and vect.exp failures after commit r14-3281-g99b5921bfc8f91 rguenth at gcc dot gnu.org
2023-08-24  8:15 ` rguenth at gcc dot gnu.org
2023-08-24  8:44 ` rguenth at gcc dot gnu.org
2023-08-24  8:54 ` rguenth at gcc dot gnu.org
2023-08-24  8:59 ` cvs-commit at gcc dot gnu.org
2023-08-24  9:36 ` cvs-commit at gcc dot gnu.org
2023-08-24 11:03 ` cvs-commit at gcc dot gnu.org
2023-08-24 11:03 ` rguenth at gcc dot gnu.org
2023-08-24 15:38 ` thiago.bauermann at linaro dot org

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).