public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076
@ 2023-11-09 16:51 mjires at suse dot cz
2023-11-09 17:22 ` [Bug tree-optimization/112464] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: mjires at suse dot cz @ 2023-11-09 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
Bug ID: 112464
Summary: [14 Regression] ICE avx512 with -ftrapv since r14-5076
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: mjires at suse dot cz
CC: rdapp at gcc dot gnu.org
Target Milestone: ---
Following reduction of testcase avx-vandpd-1.c causes ICE with -mavx512dq
-ftrapv
Bisection points to r14-5076
$ cat included.c
long *e;
int n, i, err;
void fn() {
for (; i < n; i++)
if (e[i])
err++;
}
$ gcc included.c -Ofast -mavx512dq -ftrapv
during GIMPLE pass: vect
included.c: In function ‘fn’:
included.c:3:6: internal compiler error: in vect_finish_replace_stmt, at
tree-vect-stmts.cc:1353
3 | void fn() {
| ^~
0x91fc95 vect_finish_replace_stmt(vec_info*, _stmt_vec_info*, gimple*)
/home/mjires/git/GCC/master/gcc/tree-vect-stmts.cc:1353
0x1296bd6 vectorize_fold_left_reduction
/home/mjires/git/GCC/master/gcc/tree-vect-loop.cc:7191
0x1296bd6 vect_transform_reduction(_loop_vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, gimple**, _slp_tree*)
/home/mjires/git/GCC/master/gcc/tree-vect-loop.cc:8456
0x1fac0f5 vect_transform_stmt(vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
/home/mjires/git/GCC/master/gcc/tree-vect-stmts.cc:13069
0x1287d1f vect_transform_loop_stmt
/home/mjires/git/GCC/master/gcc/tree-vect-loop.cc:11325
0x12acf13 vect_transform_loop(_loop_vec_info*, gimple*)
/home/mjires/git/GCC/master/gcc/tree-vect-loop.cc:11770
0x12ee5a1 vect_transform_loops
/home/mjires/git/GCC/master/gcc/tree-vectorizer.cc:1006
0x12eebac try_vectorize_loop_1
/home/mjires/git/GCC/master/gcc/tree-vectorizer.cc:1152
0x12eebac try_vectorize_loop
/home/mjires/git/GCC/master/gcc/tree-vectorizer.cc:1182
0x12eef34 execute
/home/mjires/git/GCC/master/gcc/tree-vectorizer.cc:1298
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/mjires/built/master/bin/gcc
COLLECT_LTO_WRAPPER=/home/mjires/built/master/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/mjires/git/GCC/master/configure
--prefix=/home/mjires/built/master --disable-bootstrap
--enable-languages=c,c++,fortran,lto --disable-multilib --disable-libsanitizer
--enable-checking
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231109 (experimental) (GCC)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
@ 2023-11-09 17:22 ` pinskia at gcc dot gnu.org
2023-11-09 17:42 ` rdapp at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09 17:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
2023-11-09 17:22 ` [Bug tree-optimization/112464] " pinskia at gcc dot gnu.org
@ 2023-11-09 17:42 ` rdapp at gcc dot gnu.org
2023-11-10 7:54 ` rdapp at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-11-09 17:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
--- Comment #1 from Robin Dapp <rdapp at gcc dot gnu.org> ---
We fail at:
void
vect_finish_replace_stmt (vec_info *vinfo,
stmt_vec_info stmt_info, gimple *vec_stmt)
{
gimple *scalar_stmt = vect_orig_stmt (stmt_info)->stmt;
gcc_assert (gimple_get_lhs (scalar_stmt) == gimple_get_lhs (vec_stmt));
where
scalar_stmt = _ifc__40 = .COND_ADD (_22, err_lsm.9_10, 1, err_lsm.9_10);
and
patt_7 = stmp_patt_7.23_123 + stmp_patt_7.23_124;
It happens when we expand the reduction into separate unconditional statements.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
2023-11-09 17:22 ` [Bug tree-optimization/112464] " pinskia at gcc dot gnu.org
2023-11-09 17:42 ` rdapp at gcc dot gnu.org
@ 2023-11-10 7:54 ` rdapp at gcc dot gnu.org
2023-11-10 8:24 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-11-10 7:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
--- Comment #2 from Robin Dapp <rdapp at gcc dot gnu.org> ---
I tested
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index a544bc9b059..257fd40793e 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7084,7 +7084,7 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo,
opmask, &vec_opmask);
}
- gimple *sdef = scalar_dest_def_info->stmt;
+ gimple *sdef = vect_orig_stmt (scalar_dest_def_info)->stmt;
overnight on x86 and aarch64. This seems to help for the reduced testcase.
It appears as if we "look through" a statement pattern in
vect_finish_replace_stmt but not before when we replace the newly created
vector statement's lhs. Then the lhs is the statement pattern's lhs while in
vect_finish_replace_stmt we assert that it's from the statement the pattern
replaced.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
` (2 preceding siblings ...)
2023-11-10 7:54 ` rdapp at gcc dot gnu.org
@ 2023-11-10 8:24 ` rguenth at gcc dot gnu.org
2023-11-10 8:30 ` rdapp at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-10 8:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-11-10
Ever confirmed|0 |1
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Robin Dapp from comment #2)
> I tested
>
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index a544bc9b059..257fd40793e 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -7084,7 +7084,7 @@ vectorize_fold_left_reduction (loop_vec_info
> loop_vinfo,
> opmask, &vec_opmask);
> }
>
> - gimple *sdef = scalar_dest_def_info->stmt;
> + gimple *sdef = vect_orig_stmt (scalar_dest_def_info)->stmt;
>
> overnight on x86 and aarch64. This seems to help for the reduced testcase.
>
> It appears as if we "look through" a statement pattern in
> vect_finish_replace_stmt but not before when we replace the newly created
> vector statement's lhs. Then the lhs is the statement pattern's lhs while
> in vect_finish_replace_stmt we assert that it's from the statement the
> pattern replaced.
Hmm, that will only work if the orig stmt is the root of the pattern
sequence. But otherwise it looks correct to me.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
` (3 preceding siblings ...)
2023-11-10 8:24 ` rguenth at gcc dot gnu.org
@ 2023-11-10 8:30 ` rdapp at gcc dot gnu.org
2023-11-10 9:01 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-11-10 8:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
--- Comment #4 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Is there another way to make it more robust?
Or does the existing
void
vect_finish_replace_stmt (vec_info *vinfo,
stmt_vec_info stmt_info, gimple *vec_stmt)
{
gimple *scalar_stmt = vect_orig_stmt (stmt_info)->stmt;
have the same problem?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
` (4 preceding siblings ...)
2023-11-10 8:30 ` rdapp at gcc dot gnu.org
@ 2023-11-10 9:01 ` rguenth at gcc dot gnu.org
2023-11-10 13:55 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-10 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Robin Dapp from comment #4)
> Is there another way to make it more robust?
>
> Or does the existing
>
> void
> vect_finish_replace_stmt (vec_info *vinfo,
> stmt_vec_info stmt_info, gimple *vec_stmt)
> {
> gimple *scalar_stmt = vect_orig_stmt (stmt_info)->stmt;
>
> have the same problem?
Well, yeah, it also implicitly assumes that. I couldn't come up with
the "correct" assert quickly, so I didn't suggest any. That is, just
go with your patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
` (5 preceding siblings ...)
2023-11-10 9:01 ` rguenth at gcc dot gnu.org
@ 2023-11-10 13:55 ` cvs-commit at gcc dot gnu.org
2023-11-22 18:52 ` jakub at gcc dot gnu.org
2023-11-22 19:33 ` rdapp at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-10 13:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Robin Dapp <rdapp@gcc.gnu.org>:
https://gcc.gnu.org/g:d7b971cf61ae0091dbc777c9aa056e6f1293da2f
commit r14-5322-gd7b971cf61ae0091dbc777c9aa056e6f1293da2f
Author: Robin Dapp <rdapp@ventanamicro.com>
Date: Fri Nov 10 08:56:18 2023 +0100
vect: Look through pattern stmt in fold_left_reduction.
It appears as if we "look through" a statement pattern in
vect_finish_replace_stmt but not before when we replace the newly
created vector statement's lhs. Then the lhs is the statement pattern's
lhs while in vect_finish_replace_stmt we assert that it's from the
statement the pattern replaced.
This patch uses vect_orig_stmt on the scalar destination's definition so
the replaced statement is used everywhere.
gcc/ChangeLog:
PR tree-optimization/112464
* tree-vect-loop.cc (vectorize_fold_left_reduction): Use
vect_orig_stmt on scalar_dest_def_info.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr112464.c: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
` (6 preceding siblings ...)
2023-11-10 13:55 ` cvs-commit at gcc dot gnu.org
@ 2023-11-22 18:52 ` jakub at gcc dot gnu.org
2023-11-22 19:33 ` rdapp at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-22 18:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, can this be closed as fixed?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/112464] [14 Regression] ICE avx512 with -ftrapv since r14-5076
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
` (7 preceding siblings ...)
2023-11-22 18:52 ` jakub at gcc dot gnu.org
@ 2023-11-22 19:33 ` rdapp at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rdapp at gcc dot gnu.org @ 2023-11-22 19:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
Robin Dapp <rdapp at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #8 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-11-22 19:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 16:51 [Bug tree-optimization/112464] New: [14 Regression] ICE avx512 with -ftrapv since r14-5076 mjires at suse dot cz
2023-11-09 17:22 ` [Bug tree-optimization/112464] " pinskia at gcc dot gnu.org
2023-11-09 17:42 ` rdapp at gcc dot gnu.org
2023-11-10 7:54 ` rdapp at gcc dot gnu.org
2023-11-10 8:24 ` rguenth at gcc dot gnu.org
2023-11-10 8:30 ` rdapp at gcc dot gnu.org
2023-11-10 9:01 ` rguenth at gcc dot gnu.org
2023-11-10 13:55 ` cvs-commit at gcc dot gnu.org
2023-11-22 18:52 ` jakub at gcc dot gnu.org
2023-11-22 19:33 ` rdapp 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).