public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219
@ 2022-04-13  6:34 asolokha at gmx dot com
  2022-04-13  8:00 ` [Bug tree-optimization/105254] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-04-13  6:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105254
           Summary: ICE in exact_div, at poly-int.h:2219
           Product: gcc
           Version: 12.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
                CC: rsandifo at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-linux-gnu

g++ 12.0.1 20220410 snapshot (g:54c5e064cc3dc3c9b3dff12b6d48dc3efd482b07) ICEs
when compiling the following testcase w/ -mcpu=demeter -O1
-ftree-loop-vectorize:

template <typename>
struct complex;

template <>
struct complex<double> {
  void operator+= (complex r) { v_ += r.v_; }
  _Complex v_;
};

template <typename T>
void
bar (T);

void
foo (complex<double> *x)
{
  complex<double> s {0.0};

  for (int i = 0; i < 16; ++i)
    s += x[i];

  bar<complex<double>> (s);
}

% aarch64-linux-gnu-g++-12.0.1 -mcpu=demeter -O1 -ftree-loop-vectorize -c
blv9apl0.cpp
during GIMPLE pass: vect
blv9apl0.cpp: In function 'void foo(complex<double>*)':
blv9apl0.cpp:15:1: internal compiler error: in exact_div, at poly-int.h:2219
   15 | foo (complex<double> *x)
      | ^~~
0x8a54a7 poly_int<2u, poly_result<unsigned long, if_nonpoly<unsigned int,
unsigned int, poly_int_traits<unsigned int>::is_poly>::type,
poly_coeff_pair_traits<unsigned long, if_nonpoly<unsigned int, unsigned int,
poly_int_traits<unsigned int>::is_poly>::type>::result_kind>::type>
exact_div<2u, unsigned long, unsigned int>(poly_int_pod<2u, unsigned long>
const&, unsigned int)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/poly-int.h:2219
0x8a8422 poly_int<2u, poly_result<unsigned long, if_nonpoly<unsigned int,
unsigned int, poly_int_traits<unsigned int>::is_poly>::type,
poly_coeff_pair_traits<unsigned long, if_nonpoly<unsigned int, unsigned int,
poly_int_traits<unsigned int>::is_poly>::type>::result_kind>::type>
exact_div<2u, unsigned long, unsigned int>(poly_int_pod<2u, unsigned long>
const&, unsigned int)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vect-loop.cc:3158
0x8a8422 vect_analyze_loop(loop*, vec_info_shared*)
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vect-loop.cc:3032
0x14bc3d9 try_vectorize_loop_1
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vectorizer.cc:1050
0x14bc3d9 try_vectorize_loop
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vectorizer.cc:1165
0x14bd074 execute
       
/var/tmp/portage/cross-aarch64-linux-gnu/gcc-12.0.1_p20220410/work/gcc-12-20220410/gcc/tree-vectorizer.cc:1281

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
@ 2022-04-13  8:00 ` marxin at gcc dot gnu.org
  2022-04-13  8:10 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-13  8:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-04-13
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
  2022-04-13  8:00 ` [Bug tree-optimization/105254] " marxin at gcc dot gnu.org
@ 2022-04-13  8:10 ` marxin at gcc dot gnu.org
  2022-04-13  8:48 ` asolokha at gmx dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-13  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Bisection would be difficult as it's closely related to -mcpu=demeter. Is there
any other CPU that triggers that?

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
  2022-04-13  8:00 ` [Bug tree-optimization/105254] " marxin at gcc dot gnu.org
  2022-04-13  8:10 ` marxin at gcc dot gnu.org
@ 2022-04-13  8:48 ` asolokha at gmx dot com
  2022-04-13 12:53 ` rsandifo at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-04-13  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Arseny Solokha <asolokha at gmx dot com> ---
I tried to replace -mcpu w/ individual options reported by -Q --help=target and
failed. But yes, -mcpu=zeus also works and reveals that it is likely [12
Regression].

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-04-13  8:48 ` asolokha at gmx dot com
@ 2022-04-13 12:53 ` rsandifo at gcc dot gnu.org
  2022-04-13 16:54 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2022-04-13 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
Not sure what's wrong yet, but: mine.

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-04-13 12:53 ` rsandifo at gcc dot gnu.org
@ 2022-04-13 16:54 ` cvs-commit at gcc dot gnu.org
  2022-04-13 17:02 ` rsandifo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-13 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:f2ebf2d98efe0ac2314b58cf474f44cb8ebd5244

commit r12-8146-gf2ebf2d98efe0ac2314b58cf474f44cb8ebd5244
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Apr 13 17:53:54 2022 +0100

    aarch64: Make sure the UF divides the VF [PR105254]

    In this PR, we were trying to set the unroll factor to a value higher
    than the minimum VF (or more specifically, to a value that doesn't
    divide the VF).  I guess there are two approaches to this: let the
    target pick any value it likes and make target-independent code pare
    it back to something that makes sense, or require targets to supply
    sensible values from the outset.  This patch goes for the latter
    approach.

    gcc/
            PR tree-optimization/105254
            * config/aarch64/aarch64.cc
            (aarch64_vector_costs::determine_suggested_unroll_factor): Take a
            loop_vec_info as argument.  Restrict the unroll factor to values
            that divide the VF.
            (aarch64_vector_costs::finish_cost): Update call accordingly.

    gcc/testsuite/
            PR tree-optimization/105254
            * g++.dg/vect/pr105254.cc: New test.

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-04-13 16:54 ` cvs-commit at gcc dot gnu.org
@ 2022-04-13 17:02 ` rsandifo at gcc dot gnu.org
  2022-06-15 10:13 ` cvs-commit at gcc dot gnu.org
  2022-06-23  2:25 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2022-04-13 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed.

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-04-13 17:02 ` rsandifo at gcc dot gnu.org
@ 2022-06-15 10:13 ` cvs-commit at gcc dot gnu.org
  2022-06-23  2:25 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-15 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:2636660b6f35423e0cfbf53bfad5c5fed6ae6471

commit r13-1103-g2636660b6f35423e0cfbf53bfad5c5fed6ae6471
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Jun 15 11:12:51 2022 +0100

    aarch64: Revert bogus fix for PR105254

    In f2ebf2d98efe0ac2314b58cf474f44cb8ebd5244 I'd forced the
    chosen unroll factor to be a factor of the VF, in order to
    work around an exact_div ICE in PR105254.  This was completely
    bogus -- clearly I didn't look in enough detail at why we ended
    up with an unrolled VF that wasn't a multiple of the UF.

    Kewen has since fixed the bug properly for PR105940, so this
    patch reverts my earlier attempt.  Sorry for the stupidity.

    gcc/
            PR tree-optimization/105254
            PR tree-optimization/105940

            Revert:

            * config/aarch64/aarch64.cc
            (aarch64_vector_costs::determine_suggested_unroll_factor): Take a
            loop_vec_info as argument.  Restrict the unroll factor to values
            that divide the VF.
            (aarch64_vector_costs::finish_cost): Update call accordingly.

    gcc/testsuite/
            * gcc.target/aarch64/sve/cost_model_14.c: New test.

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

* [Bug tree-optimization/105254] ICE in exact_div, at poly-int.h:2219
  2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-06-15 10:13 ` cvs-commit at gcc dot gnu.org
@ 2022-06-23  2:25 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-23  2:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

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

commit r12-8505-gbb1a6d92989a50df13b1a21085c86625089c9e53
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Jun 15 11:12:51 2022 +0100

    aarch64: Revert bogus fix for PR105254

    In f2ebf2d98efe0ac2314b58cf474f44cb8ebd5244 I'd forced the
    chosen unroll factor to be a factor of the VF, in order to
    work around an exact_div ICE in PR105254.  This was completely
    bogus -- clearly I didn't look in enough detail at why we ended
    up with an unrolled VF that wasn't a multiple of the UF.

    Kewen has since fixed the bug properly for PR105940, so this
    patch reverts my earlier attempt.  Sorry for the stupidity.

    gcc/
            PR tree-optimization/105254
            PR tree-optimization/105940

            Revert:

            * config/aarch64/aarch64.cc
            (aarch64_vector_costs::determine_suggested_unroll_factor): Take a
            loop_vec_info as argument.  Restrict the unroll factor to values
            that divide the VF.
            (aarch64_vector_costs::finish_cost): Update call accordingly.

    gcc/testsuite/
            * gcc.target/aarch64/sve/cost_model_14.c: New test.

    (cherry picked from commit 2636660b6f35423e0cfbf53bfad5c5fed6ae6471)

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

end of thread, other threads:[~2022-06-23  2:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13  6:34 [Bug tree-optimization/105254] New: ICE in exact_div, at poly-int.h:2219 asolokha at gmx dot com
2022-04-13  8:00 ` [Bug tree-optimization/105254] " marxin at gcc dot gnu.org
2022-04-13  8:10 ` marxin at gcc dot gnu.org
2022-04-13  8:48 ` asolokha at gmx dot com
2022-04-13 12:53 ` rsandifo at gcc dot gnu.org
2022-04-13 16:54 ` cvs-commit at gcc dot gnu.org
2022-04-13 17:02 ` rsandifo at gcc dot gnu.org
2022-06-15 10:13 ` cvs-commit at gcc dot gnu.org
2022-06-23  2:25 ` 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).