public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522
@ 2022-07-04 19:43 gscfq@t-online.de
  2022-07-04 22:31 ` [Bug tree-optimization/106192] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2022-07-04 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106192
           Summary: [11/12/13 Regression] ICE in vect_loop_versioning, at
                    tree-vect-loop-manip.cc:3522
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20200621 and 20200628, at -O3 or -Ofast,
with file gfortran.dg/gomp/combined-if.f90 :


$ gfortran-13-20220703 -c combined-if.f90 -Ofast -fopenmp-simd
during GIMPLE pass: vect
combined-if.f90:95:60:

   95 |   subroutine test_target_teams_distribute_parallel_loop_simd
      |                                                            ^
internal compiler error: in vect_loop_versioning, at
tree-vect-loop-manip.cc:3522
0x1173d92 vect_loop_versioning(_loop_vec_info*, gimple*)
        ../../gcc/tree-vect-loop-manip.cc:3517
0x116aa01 vect_transform_loop(_loop_vec_info*, gimple*)
        ../../gcc/tree-vect-loop.cc:9719
0x11a5ef5 vect_transform_loops
        ../../gcc/tree-vectorizer.cc:1007
0x11a65a6 try_vectorize_loop_1
        ../../gcc/tree-vectorizer.cc:1136
0x11a65a6 try_vectorize_loop
        ../../gcc/tree-vectorizer.cc:1167
0x11a6bd4 execute
        ../../gcc/tree-vectorizer.cc:1281

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

* [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522
  2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
@ 2022-07-04 22:31 ` pinskia at gcc dot gnu.org
  2022-07-05  8:10 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-04 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |tree-optimization
   Target Milestone|---                         |11.4

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

* [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522
  2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
  2022-07-04 22:31 ` [Bug tree-optimization/106192] " pinskia at gcc dot gnu.org
@ 2022-07-05  8:10 ` rguenth at gcc dot gnu.org
  2022-07-05 12:53 ` matz at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-05  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |matz at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |needs-bisection
      Known to work|                            |10.3.0
           Priority|P3                          |P2
      Known to fail|                            |11.3.0, 12.1.0, 13.0
   Last reconfirmed|                            |2022-07-05

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  LOOP_REQUIRES_VERSIONING_FOR_SIMD_IF_COND is _15 and we have the
loop header

<bb 4> [local count: 696725737]:
# i.2_29 = PHI <1(3), i.2_22(11)>
# ivtmp_24 = PHI <100(3), ivtmp_16(11)>
.GOMP_SIMD_LANE (simduid.6_17(D), 0, _12);
_13 = i.2_29 + -1;
_18 = (integer(kind=8)) _13;
_19 = a[_18];
_20 = _19 + 1;
a[_18] = _20;
i.2_22 = i.2_29 + 1;
_3 = j.0_28 + 1;
_15 = _3 <= 59;
.GOMP_SIMD_LANE (simduid.6_17(D), 0, _15);
_8 = _19 + 2;
a[_18] = _8;
ivtmp_16 = ivtmp_24 - 1;
if (ivtmp_16 != 0)
  goto <bb 11>; [87.50%]
else
  goto <bb 12>; [12.50%]

so the bb != loop->header part of the assert already fires.  The condition
is loop invariant but it wasn't hoisted for some reason.  Or rather it
looks like we unrolled the loop once which we might not do to .GOMP_SIMD_LANE
bbs IIRC.

unroll-and-jam does this.

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

* [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522
  2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
  2022-07-04 22:31 ` [Bug tree-optimization/106192] " pinskia at gcc dot gnu.org
  2022-07-05  8:10 ` rguenth at gcc dot gnu.org
@ 2022-07-05 12:53 ` matz at gcc dot gnu.org
  2022-07-05 12:54 ` matz at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: matz at gcc dot gnu.org @ 2022-07-05 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Michael Matz <matz at gcc dot gnu.org> ---
Unroll-and-jam simply unrolls the outer loop and merged all resulting
inner-loop bodies.  In this situation we have (before unroll-and-jam):

outerloop(i_1) {
  _12 = i_1 <= 59
  innerloop(i_1, j by 1) {
    .GOMP_SIMD_LANE (simduid.6_16(D), 0, _12);
    ... uninteresting things (j) ...
  }
}

Unroll-and-jam then simply does (that's the unrolling):

outerloop(i by 2) {
  _12 = i_1 <= 59
  innerloop(i_1, j by 1) {
    .GOMP_SIMD_LANE (simduid.6_16(D), 0, _12);
    ... uninteresting things (i, j) ...
  }
  i_2 = i_1 + 1
  _15 = i_2 <= 59
  innerloop(i_2, j by 1) {
    .GOMP_SIMD_LANE (simduid.6_16(D), 0, _15);
    ... uninteresting things (i + 1, j) ...
  }
}

and then fuses the two inner loops, which means that the instructions between
them (the original pre-header of the inner loop) become replicated inside
the new inner loop body (here, the loop-invariant condition):

outerloop(i by 2) {
  _12 = i_1 <= 59
  innerloop(i_1, j by 1) {
    .GOMP_SIMD_LANE (simduid.6_16(D), 0, _12);
    ... uninteresting things (i, j) ...
    i_2 = i_1 + 1
    _15 = i_2 <= 59
    .GOMP_SIMD_LANE (simduid.6_16(D), 0, _15);
    ... uninteresting things (i + 1, j) ...
  }
}

There is nothing which somehow would indicate that this is invalid, and I can't
see why it should be.  If GIMP_SIMD_LANE has properties that make this
transformation invalid I would argue that those properties are correctly
represented.  One could of course hack bb_prevents_fusion_p or
unroll_jam_possible_p to avoid this situation, but that would seem like a
bad hack, as random other CFG transformation might introduce similar things:
namely a GOMP_SIMD_LANE statement that's fed by an unhoisted loop-invariant
condition.

So, I'd argue the assert is too eager.

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

* [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522
  2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-07-05 12:53 ` matz at gcc dot gnu.org
@ 2022-07-05 12:54 ` matz at gcc dot gnu.org
  2022-07-07 12:46 ` [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 since r11-1650-g1dfa89b0355520ca marxin at gcc dot gnu.org
  2023-05-29 10:07 ` [Bug tree-optimization/106192] [11/12/13/14 " jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: matz at gcc dot gnu.org @ 2022-07-05 12:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Michael Matz <matz at gcc dot gnu.org> ---
(In reply to Michael Matz from comment #2)
> see why it should be.  If GIMP_SIMD_LANE has properties that make this
> transformation invalid I would argue that those properties are correctly

"are _not_" I meant to say, of course.

> represented.

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

* [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 since r11-1650-g1dfa89b0355520ca
  2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-07-05 12:54 ` matz at gcc dot gnu.org
@ 2022-07-07 12:46 ` marxin at gcc dot gnu.org
  2023-05-29 10:07 ` [Bug tree-optimization/106192] [11/12/13/14 " jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-07 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13 Regression] ICE   |[11/12/13 Regression] ICE
                   |in vect_loop_versioning, at |in vect_loop_versioning, at
                   |tree-vect-loop-manip.cc:352 |tree-vect-loop-manip.cc:352
                   |2                           |2 since
                   |                            |r11-1650-g1dfa89b0355520ca
                 CC|                            |kcy at codesourcery dot com,
                   |                            |marxin at gcc dot gnu.org
           Keywords|needs-bisection             |

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-1650-g1dfa89b0355520ca.

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

* [Bug tree-optimization/106192] [11/12/13/14 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 since r11-1650-g1dfa89b0355520ca
  2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-07-07 12:46 ` [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 since r11-1650-g1dfa89b0355520ca marxin at gcc dot gnu.org
@ 2023-05-29 10:07 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.4                        |11.5

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.

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

end of thread, other threads:[~2023-05-29 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 19:43 [Bug fortran/106192] New: [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 gscfq@t-online.de
2022-07-04 22:31 ` [Bug tree-optimization/106192] " pinskia at gcc dot gnu.org
2022-07-05  8:10 ` rguenth at gcc dot gnu.org
2022-07-05 12:53 ` matz at gcc dot gnu.org
2022-07-05 12:54 ` matz at gcc dot gnu.org
2022-07-07 12:46 ` [Bug tree-optimization/106192] [11/12/13 Regression] ICE in vect_loop_versioning, at tree-vect-loop-manip.cc:3522 since r11-1650-g1dfa89b0355520ca marxin at gcc dot gnu.org
2023-05-29 10:07 ` [Bug tree-optimization/106192] [11/12/13/14 " jakub 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).