public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
@ 2023-03-01  2:41 asolokha at gmx dot com
  2023-03-01  2:42 ` [Bug tree-optimization/108979] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2023-03-01  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108979
           Summary: [13 Regression] ICE in compute_live_loop_exits, at
                    tree-ssa-loop-manip.cc:248
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: aarch64-linux-gnu

gcc 13.0.1 20230226 snapshot (g:e6d39f68d03c46637ca6e1bede3d28eae6278df3) ICEs
when compiling the following testcase, extracted from
gcc/testsuite/gfortran.dg/pr68251.f90, w/ -march=armv8-a+sve -O2
-fnon-call-exceptions -fvect-cost-model=unlimited:

MODULE hfx_contract_block
  INTEGER, PARAMETER :: dp=8
CONTAINS
  SUBROUTINE block_2_1_2_1(kbd,kbc,kad,kac,pbd,pbc,pad,pac,prim,scale)
    REAL(KIND=dp) :: kbd(1*1), kbc(1*2), kad(2*1), kac(2*2), pbd(1*1), &
      pbc(1*2), pad(2*1), pac(2*2), prim(2*1*2*1), scale
      DO md = 1,1
        DO mc = 1,2
          DO mb = 1,1
            DO ma = 1,2
              kac((mc-1)*2+ma) = kac((mc-1)*2+ma)-tmp*p_bd
            END DO
          END DO
        END DO
      END DO
  END SUBROUTINE block_2_1_2_1
END MODULE hfx_contract_block

% aarch64-linux-gnu-gfortran-13 -march=armv8-a+sve -O2 -fnon-call-exceptions
-fvect-cost-model=unlimited -c vsg8aaub.f90
during GIMPLE pass: vect
vsg8aaub.f90:4:26:

    4 |   SUBROUTINE block_2_1_2_1(kbd,kbc,kad,kac,pbd,pbc,pad,pac,prim,scale)
      |                          ^
internal compiler error: in compute_live_loop_exits, at
tree-ssa-loop-manip.cc:248
0x7b7fb1 compute_live_loop_exits
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree-ssa-loop-manip.cc:248
0x7b7fb1 add_exit_phis_var
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree-ssa-loop-manip.cc:330
0x7b7fb1 add_exit_phis
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree-ssa-loop-manip.cc:390
0x1128a64 rewrite_into_loop_closed_ssa_1
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree-ssa-loop-manip.cc:604
0x1128a64 rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree-ssa-loop-manip.cc:626
0x1288785 execute
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-13.0.1_p20230226/work/gcc-13-20230226/gcc/tree-vectorizer.cc:1361

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
@ 2023-03-01  2:42 ` pinskia at gcc dot gnu.org
  2023-03-01  7:52 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-01  2:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
  2023-03-01  2:42 ` [Bug tree-optimization/108979] " pinskia at gcc dot gnu.org
@ 2023-03-01  7:52 ` rguenth at gcc dot gnu.org
  2023-03-01  8:35 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-01  7:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2023-03-01
           Keywords|                            |needs-bisection
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
  2023-03-01  2:42 ` [Bug tree-optimization/108979] " pinskia at gcc dot gnu.org
  2023-03-01  7:52 ` rguenth at gcc dot gnu.org
@ 2023-03-01  8:35 ` rguenth at gcc dot gnu.org
  2023-03-02 11:55 ` rsandifo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-01  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|rguenth at gcc dot gnu.org         |unassigned at gcc dot gnu.org
                 CC|                            |rsandifo at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Error: definition in block 4 does not dominate use in block 6
for SSA_NAME: loop_mask_16 in statement:
vect__33.10_19 = .COND_MUL (loop_mask_16, _1, _4, _1);

that stmt ended up in the preheader.  That happens when scheduling

t.f90:4:26: note: node 0x3c6a870 (max_nunits=4, refcnt=1) vector([4,4])
real(kind=4)
t.f90:4:26: note: op template: _33 = tmp_17(D) * p_bd_18(D);
t.f90:4:26: note:       stmt 0 _33 = tmp_17(D) * p_bd_18(D);
t.f90:4:26: note:       stmt 1 _33 = tmp_17(D) * p_bd_18(D);
t.f90:4:26: note:       children 0x3c6a900 0x3c6a990

because as can be seen, the operands are all loop invariant and we are
appearantly not honoring the implicit dependence on a mask (those are not
added as implicit operand to the SLP graph - something we eventually
would want to do).

Now - it's also completely unnecessary to mask this statement, and _that's_
possibly the easier way out here.

Instead of -fnon-call-exceptions one can also use -fno-tree-loop-im to keep
the invariant computation inside the loop and trigger the same ICE.

Richard - you are more familiar with loop masking - where do we decide
whether a stmt needs masking and couldn't we easily decide it doesn't
need if all operand dt are external or invariant?

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2023-03-01  8:35 ` rguenth at gcc dot gnu.org
@ 2023-03-02 11:55 ` rsandifo at gcc dot gnu.org
  2023-03-02 16:40 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-03-02 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot gnu.org

--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Testing a patch.

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2023-03-02 11:55 ` rsandifo at gcc dot gnu.org
@ 2023-03-02 16:40 ` cvs-commit at gcc dot gnu.org
  2023-03-02 16:41 ` rsandifo at gcc dot gnu.org
  2023-04-03  8:58 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-02 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:076d309e36c682176e9f85dc8593e6f2c9e6e75f

commit r13-6418-g076d309e36c682176e9f85dc8593e6f2c9e6e75f
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Thu Mar 2 16:39:50 2023 +0000

    vect: Don't apply masks to operations on invariants [PR108979]

    The loop body in the testcase contains an operation on invariants.
    SLP detects this and can hoist/schedule the operation outside of
    the loop.  However, after the fix for PR96373, we would try to
    apply a loop mask to this operation, even though the mask is
    defined in the loop.

    The patch does what Richi suggested in the PR: suppress the
    masking for externs and constants.

    gcc/
            PR tree-optimization/108979
            * tree-vect-stmts.cc (vectorizable_operation): Don't mask
            operations on invariants.

    gcc/testsuite/
            PR tree-optimization/108979
            * gfortran.dg/vect/pr108979.f90: New test.

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2023-03-02 16:40 ` cvs-commit at gcc dot gnu.org
@ 2023-03-02 16:41 ` rsandifo at gcc dot gnu.org
  2023-04-03  8:58 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2023-03-02 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed.  I'll fold this into the backport for PR96373.

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

* [Bug tree-optimization/108979] [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248
  2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2023-03-02 16:41 ` rsandifo at gcc dot gnu.org
@ 2023-04-03  8:58 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-03  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Sandiford
<rsandifo@gcc.gnu.org>:

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

commit r12-9384-ge11513c7688f583d1f4d0961d79d8aa775add03d
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Apr 3 09:57:09 2023 +0100

    vect: Make partial trapping ops use predication [PR96373]

    PR96373 points out that a predicated SVE loop currently converts
    trapping unconditional ops into unpredicated vector ops.  Doing
    the operation on inactive lanes can then raise an exception.

    As discussed in the PR trail, we aren't 100% consistent about
    whether we preserve traps or not.  But the direction of travel
    is clearly to improve that rather than live with it.  This patch
    tries to do that for the SVE case.

    Doing this regresses gcc.target/aarch64/sve/fabd_1.c.  I've added
    -fno-trapping-math for now and filed PR108571 to track it.
    A similar problem applies to fsubr_1.c.

    I think this is likely to regress Power 10, since conditional
    operations are only available for masked loops.  I think we'll
    need to add -fno-trapping-math to any affected testcases,
    but I don't have a Power 10 system to test on.

    gcc/
            PR tree-optimization/96373
            PR tree-optimization/108979
            * tree-vect-stmts.cc (vectorizable_operation): Predicate trapping
            operations on the loop mask.  Reject partial vectors if this isn't
            possible.  Don't mask operations on invariants.

    gcc/testsuite/
            PR tree-optimization/96373
            PR tree-optimization/108571
            PR tree-optimization/108979
            * gcc.target/aarch64/sve/fabd_1.c: Add -fno-trapping-math.
            * gcc.target/aarch64/sve/fsubr_1.c: Likewise.
            * gcc.target/aarch64/sve/fmul_1.c: Expect predicate ops.
            * gcc.target/aarch64/sve/fp_arith_1.c: Likewise.
            * gfortran.dg/vect/pr108979.f90: New test.

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

end of thread, other threads:[~2023-04-03  8:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01  2:41 [Bug tree-optimization/108979] New: [13 Regression] ICE in compute_live_loop_exits, at tree-ssa-loop-manip.cc:248 asolokha at gmx dot com
2023-03-01  2:42 ` [Bug tree-optimization/108979] " pinskia at gcc dot gnu.org
2023-03-01  7:52 ` rguenth at gcc dot gnu.org
2023-03-01  8:35 ` rguenth at gcc dot gnu.org
2023-03-02 11:55 ` rsandifo at gcc dot gnu.org
2023-03-02 16:40 ` cvs-commit at gcc dot gnu.org
2023-03-02 16:41 ` rsandifo at gcc dot gnu.org
2023-04-03  8:58 ` cvs-commit at gcc dot gnu.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).