public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
@ 2021-12-14  4:42 asolokha at gmx dot com
  2021-12-14  8:50 ` [Bug target/103702] " linkw at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2021-12-14  4:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103702
           Summary: [12 Regression] ICE in update_target_cost_per_stmt, at
                    config/rs6000/rs6000.c:5457
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: powerpc-*-linux-gnu

gcc 12.0.0 20211212 snapshot (g:0b52083ea2c2dd9897031fdc3802a68fd4aa45ef) ICEs
when compiling gcc/testsuite/gcc.dg/vect/pr53185.c w/ -mcpu=power6 -O2
-ftree-loop-vectorize -fno-tree-scev-cprop:

% powerpc-e300c3-linux-gnu-gcc-12.0.0 -mcpu=power6 -O2 -ftree-loop-vectorize
-fno-tree-scev-cprop -c gcc/testsuite/gcc.dg/vect/pr53185.c
during GIMPLE pass: vect
gcc/testsuite/gcc.dg/vect/pr53185.c: In function 'fn1':
gcc/testsuite/gcc.dg/vect/pr53185.c:8:6: internal compiler error: in
update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
    8 | void fn1 () {
      |      ^~~
0x7527d3 rs6000_cost_data::update_target_cost_per_stmt(vect_cost_for_stmt,
_stmt_vec_info*, vect_cost_model_location, unsigned int)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/config/rs6000/rs6000.c:5457
0x121bb3b rs6000_cost_data::add_stmt_cost(int, vect_cost_for_stmt,
_stmt_vec_info*, tree_node*, int, vect_cost_model_location)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/config/rs6000/rs6000.c:5497
0x121bb3b rs6000_cost_data::add_stmt_cost(int, vect_cost_for_stmt,
_stmt_vec_info*, tree_node*, int, vect_cost_model_location)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/config/rs6000/rs6000.c:5479
0x1122b39 add_stmt_cost
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.h:1691
0x1122b39 add_stmt_costs(vector_costs*, vec<stmt_info_for_cost, va_heap,
vl_ptr>*)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.h:1727
0x1122b39 vect_analyze_loop_operations
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:1765
0x1122b39 vect_analyze_loop_2
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:2499
0x1123352 vect_analyze_loop_1
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:2830
0x11238f9 vect_analyze_loop(loop*, vec_info_shared*)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vect-loop.c:2952
0x1158638 try_vectorize_loop_1
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.c:1047
0x1158638 try_vectorize_loop
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.c:1162
0x1159334 execute
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-12.0.0_p20211212/work/gcc-12-20211212/gcc/tree-vectorizer.c:1278

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
@ 2021-12-14  8:50 ` linkw at gcc dot gnu.org
  2021-12-14  9:04 ` linkw at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2021-12-14  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |bergner at gcc dot gnu.org,
                   |                            |linkw at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org,
                   |                            |wschmidt at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-14

--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed.

Thanks for reporting, it failed at

 5457     gcc_assert (nunits > 1);

the given nunits is 1.

The assertion was introduced in r12-5589, which aims to ensure we only consider
tweaking the cost for the vectype which has more than 1 elements (units).

This issue with Power6 32bit shows that when the preferred vector mode is
SImode, vectorizer will use vector(1) int as vectype and tries to vectorize
scalar int load as scalar_load and further vector construction.

One fix would be to bypass this kind of case with 1 nunit fed into vector
construction instead of one assertion.

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
  2021-12-14  8:50 ` [Bug target/103702] " linkw at gcc dot gnu.org
@ 2021-12-14  9:04 ` linkw at gcc dot gnu.org
  2022-01-03 10:20 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2021-12-14  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Another alternative seems that vectorizer avoids to count in the vector
construction cost for 1 unit vector type whose mode isn't qualified as vector
mode, since there isn't no related vector mode in backend, it would act as
scalar type in the end.

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
  2021-12-14  8:50 ` [Bug target/103702] " linkw at gcc dot gnu.org
  2021-12-14  9:04 ` linkw at gcc dot gnu.org
@ 2022-01-03 10:20 ` rguenth at gcc dot gnu.org
  2022-01-17 12:44 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-03 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the backend should be fixed in either case.

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-01-03 10:20 ` rguenth at gcc dot gnu.org
@ 2022-01-17 12:44 ` rguenth at gcc dot gnu.org
  2022-01-18  1:39 ` linkw at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-01-17 12:44 ` rguenth at gcc dot gnu.org
@ 2022-01-18  1:39 ` linkw at gcc dot gnu.org
  2022-01-27 11:16 ` cvs-commit at gcc dot gnu.org
  2022-01-27 11:20 ` linkw at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-01-18  1:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
Patch was posted with the link
https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587309.html, still
pending on review.

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-01-18  1:39 ` linkw at gcc dot gnu.org
@ 2022-01-27 11:16 ` cvs-commit at gcc dot gnu.org
  2022-01-27 11:20 ` linkw at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-27 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2022be54daf638885e1e685afd36619cb4b01a93

commit r12-6891-g2022be54daf638885e1e685afd36619cb4b01a93
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Thu Jan 27 03:46:28 2022 -0600

    rs6000: Fix an assertion in update_target_cost_per_stmt [PR103702]

    This patch is to fix one wrong assertion which is too aggressive.
    Vectorizer can do vec_construct costing for the vector type which
    only has one unit.  For the failed case, the passed in vector type
    is "vector(1) int", though it doesn't end up with any construction
    eventually, we have to handle this kind of possibility.

    gcc/ChangeLog:

            PR target/103702
            * config/rs6000/rs6000.cc
            (rs6000_cost_data::update_target_cost_per_stmt): Fix one wrong
            assertion with early return.

    gcc/testsuite/ChangeLog:

            PR target/103702
            * gcc.target/powerpc/pr103702.c: New test.

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

* [Bug target/103702] [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457
  2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-01-27 11:16 ` cvs-commit at gcc dot gnu.org
@ 2022-01-27 11:20 ` linkw at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-01-27 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

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

--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on latest trunk.

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

end of thread, other threads:[~2022-01-27 11:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14  4:42 [Bug target/103702] New: [12 Regression] ICE in update_target_cost_per_stmt, at config/rs6000/rs6000.c:5457 asolokha at gmx dot com
2021-12-14  8:50 ` [Bug target/103702] " linkw at gcc dot gnu.org
2021-12-14  9:04 ` linkw at gcc dot gnu.org
2022-01-03 10:20 ` rguenth at gcc dot gnu.org
2022-01-17 12:44 ` rguenth at gcc dot gnu.org
2022-01-18  1:39 ` linkw at gcc dot gnu.org
2022-01-27 11:16 ` cvs-commit at gcc dot gnu.org
2022-01-27 11:20 ` linkw 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).