public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS
@ 2021-02-05 10:20 avieira at gcc dot gnu.org
  2021-02-05 10:22 ` [Bug middle-end/98974] " avieira at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: avieira at gcc dot gnu.org @ 2021-02-05 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98974
           Summary: ICE in vectorizable_condition after
                    STMT_VINFO_VEC_STMTS
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: avieira at gcc dot gnu.org
  Target Milestone: ---

Hi,

After
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b05d5563f4be13b4a0d0951375a82adf483973c0
we found vectorizable_condition to ICE when autovectorizing for SVE.

The reduced fortran testcase is an example of this:
$ cat foo.F90
 module module_foobar
  integer,parameter :: fp_kind = selected_real_kind(15)
   contains
   subroutine foobar( foo, ix ,jx ,kx,iy,ky)
 real, dimension( ix, kx, jx )  :: foo
 real(fp_kind), dimension( iy, ky, 3 ) :: bar, baz
   j_loop: do j=jts,enddo
       do k=0,ky
          do i=0,iy
                if ( baz(i,k,1) > 0. ) then
                  bar(i,k,1) = 0
                endif
                foo(i,nk,j) = baz0 *  bar(i,k,1)
          enddo
       enddo
   enddo j_loop
 end
end

And the following command will cause it to ICE:
$ gfortran  -Ofast -mcpu=neoverse-v1 foo.F90 -S

I have debugged this and I believe the issue is that before Richi's change
vectorizable_condition used to set vec_oprnds0 to vec_cond_lhs for each copy.
Now it is collected for all copies at the same time. However, when calling
vect_get_loop_mask we pass vec_num * ncopies as the nvectors parameter, where
vec_num has been set to the length of vec_oprnds0. I believe that because we
are now doing all ncopies at the same time we no longer need to multiply it by
ncopies.

I'll be posting a patch for this soon.

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

* [Bug middle-end/98974] ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS
  2021-02-05 10:20 [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS avieira at gcc dot gnu.org
@ 2021-02-05 10:22 ` avieira at gcc dot gnu.org
  2021-02-05 10:35 ` [Bug middle-end/98974] [11 Regression] " ktkachov at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: avieira at gcc dot gnu.org @ 2021-02-05 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from avieira at gcc dot gnu.org ---
The testcase above issues a warning, around do j=jts,enddo

To use it as a testcase in my patch I'd like to get rid of it so if someone
proficient in Fortran knows a way to get rid of it that'd be great!

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

* [Bug middle-end/98974] [11 Regression] ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS
  2021-02-05 10:20 [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS avieira at gcc dot gnu.org
  2021-02-05 10:22 ` [Bug middle-end/98974] " avieira at gcc dot gnu.org
@ 2021-02-05 10:35 ` ktkachov at gcc dot gnu.org
  2021-02-05 12:04 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2021-02-05 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

ktkachov at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-02-05
      Known to fail|                            |11.0
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ktkachov at gcc dot gnu.org
            Summary|ICE in                      |[11 Regression] ICE in
                   |vectorizable_condition      |vectorizable_condition
                   |after STMT_VINFO_VEC_STMTS  |after STMT_VINFO_VEC_STMTS
           Priority|P3                          |P1
   Target Milestone|---                         |11.0
     Ever confirmed|0                           |1
             Target|                            |aarch64
      Known to work|                            |10.2.1

--- Comment #2 from ktkachov at gcc dot gnu.org ---
Confirmed. This affects building 521.wrf_r from SPEC2017 with LTO

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

* [Bug middle-end/98974] [11 Regression] ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS
  2021-02-05 10:20 [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS avieira at gcc dot gnu.org
  2021-02-05 10:22 ` [Bug middle-end/98974] " avieira at gcc dot gnu.org
  2021-02-05 10:35 ` [Bug middle-end/98974] [11 Regression] " ktkachov at gcc dot gnu.org
@ 2021-02-05 12:04 ` rguenth at gcc dot gnu.org
  2021-02-08 16:07 ` cvs-commit at gcc dot gnu.org
  2021-02-08 16:08 ` avieira at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-05 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to avieira from comment #1)
> The testcase above issues a warning, around do j=jts,enddo
> 
> To use it as a testcase in my patch I'd like to get rid of it so if someone
> proficient in Fortran knows a way to get rid of it that'd be great!

The following still reproduces the issue for me and is more valid.

module module_foobar
  integer,parameter :: fp_kind = selected_real_kind(15)
contains
 subroutine foobar( foo, ix ,jx ,kx,iy,ky)
   real, dimension( ix, kx, jx )  :: foo
   real(fp_kind), dimension( iy, ky, 3 ) :: bar, baz
       do k=1,ky
          do i=1,iy
                if ( baz(i,k,1) > 0. ) then
                  bar(i,k,1) = 0
                endif
                foo(i,nk,j) = baz0 *  bar(i,k,1)
          enddo
       enddo
 end
end

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

* [Bug middle-end/98974] [11 Regression] ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS
  2021-02-05 10:20 [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS avieira at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-02-05 12:04 ` rguenth at gcc dot gnu.org
@ 2021-02-08 16:07 ` cvs-commit at gcc dot gnu.org
  2021-02-08 16:08 ` avieira at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-08 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andre Simoes Dias Vieira
<avieira@gcc.gnu.org>:

https://gcc.gnu.org/g:40c92180df970143249f3cd5056f8fb48a4d9333

commit r11-7135-g40c92180df970143249f3cd5056f8fb48a4d9333
Author: Andre Vieira <andre.simoesdiasvieira@arm.com>
Date:   Mon Feb 8 16:04:18 2021 +0000

    middle-end/98974 - fixup after STMT_VINFO_VEC_STMTS rework

    This fixes up the nvectors parameter passed to vect_get_loop_mask in
    vectorizable_condition after the STMT_VINFO_VEC_STMTS rework.

    gcc/ChangeLog:
    2021-02-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>

            PR middle-end/98974
            * tree-vect-stmts.c (vectorizable_condition): Remove shadow vec_num
            parameter in vectorizable_condition.

    gcc/testsuite/ChangeLog:
    2021-02-08  Andre Vieira  <andre.simoesdiasvieira@arm.com>

            PR middle-end/98974
            * gfortran.dg/pr98974.F90: New test.

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

* [Bug middle-end/98974] [11 Regression] ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS
  2021-02-05 10:20 [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS avieira at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-02-08 16:07 ` cvs-commit at gcc dot gnu.org
@ 2021-02-08 16:08 ` avieira at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: avieira at gcc dot gnu.org @ 2021-02-08 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

avieira at gcc dot gnu.org changed:

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

--- Comment #5 from avieira at gcc dot gnu.org ---
That should fix it.

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

end of thread, other threads:[~2021-02-08 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 10:20 [Bug middle-end/98974] New: ICE in vectorizable_condition after STMT_VINFO_VEC_STMTS avieira at gcc dot gnu.org
2021-02-05 10:22 ` [Bug middle-end/98974] " avieira at gcc dot gnu.org
2021-02-05 10:35 ` [Bug middle-end/98974] [11 Regression] " ktkachov at gcc dot gnu.org
2021-02-05 12:04 ` rguenth at gcc dot gnu.org
2021-02-08 16:07 ` cvs-commit at gcc dot gnu.org
2021-02-08 16:08 ` avieira 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).