public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
@ 2021-04-23 21:20 zsojka at seznam dot cz
2021-04-23 21:24 ` [Bug rtl-optimization/100239] " jakub at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2021-04-23 21:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Bug ID: 100239
Summary: [10/11/12 Regression] ICE: in expand_expr_real_2, at
expr.c:9865 with __builtin_shuffle()
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Created attachment 50663
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50663&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:9:7: internal compiler error: in expand_expr_real_2, at expr.c:9865
9 | c & __builtin_shuffle (v != v, 0 < (V){}, (V){719} >>5);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x671830 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
/repo/gcc-trunk/gcc/expr.c:9865
0xb94d3f expand_gimple_stmt_1
/repo/gcc-trunk/gcc/cfgexpand.c:3947
0xb94d3f expand_gimple_stmt
/repo/gcc-trunk/gcc/cfgexpand.c:4008
0xb9a5d1 expand_gimple_basic_block
/repo/gcc-trunk/gcc/cfgexpand.c:6045
0xb9c246 execute
/repo/gcc-trunk/gcc/cfgexpand.c:6729
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-96-20210423095621-g886b6c1e8af-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-96-20210423095621-g886b6c1e8af-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210423 (experimental) (GCC)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug rtl-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
@ 2021-04-23 21:24 ` jakub at gcc dot gnu.org
2021-04-26 12:55 ` [Bug tree-optimization/100239] " jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-23 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Last reconfirmed| |2021-04-23
CC| |jakub at gcc dot gnu.org
Priority|P3 |P2
Target Milestone|--- |10.4
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with my r10-1201-g2e83f583c27ef7a9d3b0fb0b5ed372439d6222a8
I'll have a look.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
2021-04-23 21:24 ` [Bug rtl-optimization/100239] " jakub at gcc dot gnu.org
@ 2021-04-26 12:55 ` jakub at gcc dot gnu.org
2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-26 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50678
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50678&action=edit
gcc11-pr100239.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
2021-04-23 21:24 ` [Bug rtl-optimization/100239] " jakub at gcc dot gnu.org
2021-04-26 12:55 ` [Bug tree-optimization/100239] " jakub at gcc dot gnu.org
@ 2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-27 13:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:83d26d0e1b3625ab6c2d83610a13976b52f63e0a
commit r12-159-g83d26d0e1b3625ab6c2d83610a13976b52f63e0a
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 27 15:42:47 2021 +0200
veclower: Fix up vec_shl matching of VEC_PERM_EXPR [PR100239]
The following testcase ICEs at -O0, because lower_vec_perm sees the
_1 = { 0, 0, 0, 0, 0, 0, 0, 0 };
_2 = VEC_COND_EXPR <_1, { -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0,
0, 0, 0, 0 }>;
_3 = { 6, 0, 0, 0, 0, 0, 0, 0 };
_4 = VEC_PERM_EXPR <{ 0, 0, 0, 0, 0, 0, 0, 0 }, _2, _3>;
and as the ISA is SSE2, there is no support for the particular permutation
nor for variable mask permutation. But, the code to match vec_shl matches
it, because the permutation has the first operand a zero vector and the
mask picks all elements randomly from that vector.
So, in the end that isn't a vec_shl, but the permutation could be in theory
optimized into the first argument. As we keep it as is, it will fail
during expansion though, because that for vec_shl correctly requires that
it actually is a shift:
unsigned firstidx = 0;
for (unsigned int i = 0; i < nelt; i++)
{
if (known_eq (sel[i], nelt))
{
if (i == 0 || firstidx)
return NULL_RTX;
firstidx = i;
}
else if (firstidx
? maybe_ne (sel[i], nelt + i - firstidx)
: maybe_ge (sel[i], nelt))
return NULL_RTX;
}
if (firstidx == 0)
return NULL_RTX;
first = firstidx;
The if (firstidx == 0) return NULL; is what is missing a counterpart
on the lower_vec_perm side.
As with optimize != 0 we fold it in other spots, I think it is not needed
to optimize this cornercase in lower_vec_perm (which would mean we'd need
to recurse on the newly created _4 = { 0, 0, 0, 0, 0, 0, 0, 0 };
whether it is supported or not).
2021-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/100239
* tree-vect-generic.c (lower_vec_perm): Don't accept constant
permutations with all indices from the first zero element as
vec_shl.
* gcc.dg/pr100239.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (2 preceding siblings ...)
2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
@ 2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
2021-04-27 13:58 ` [Bug tree-optimization/100239] [10 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-27 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:80dc24f813a9d8951d75eea7324f6d713b872bca
commit r11-8300-g80dc24f813a9d8951d75eea7324f6d713b872bca
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 27 15:42:47 2021 +0200
veclower: Fix up vec_shl matching of VEC_PERM_EXPR [PR100239]
The following testcase ICEs at -O0, because lower_vec_perm sees the
_1 = { 0, 0, 0, 0, 0, 0, 0, 0 };
_2 = VEC_COND_EXPR <_1, { -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0,
0, 0, 0, 0 }>;
_3 = { 6, 0, 0, 0, 0, 0, 0, 0 };
_4 = VEC_PERM_EXPR <{ 0, 0, 0, 0, 0, 0, 0, 0 }, _2, _3>;
and as the ISA is SSE2, there is no support for the particular permutation
nor for variable mask permutation. But, the code to match vec_shl matches
it, because the permutation has the first operand a zero vector and the
mask picks all elements randomly from that vector.
So, in the end that isn't a vec_shl, but the permutation could be in theory
optimized into the first argument. As we keep it as is, it will fail
during expansion though, because that for vec_shl correctly requires that
it actually is a shift:
unsigned firstidx = 0;
for (unsigned int i = 0; i < nelt; i++)
{
if (known_eq (sel[i], nelt))
{
if (i == 0 || firstidx)
return NULL_RTX;
firstidx = i;
}
else if (firstidx
? maybe_ne (sel[i], nelt + i - firstidx)
: maybe_ge (sel[i], nelt))
return NULL_RTX;
}
if (firstidx == 0)
return NULL_RTX;
first = firstidx;
The if (firstidx == 0) return NULL; is what is missing a counterpart
on the lower_vec_perm side.
As with optimize != 0 we fold it in other spots, I think it is not needed
to optimize this cornercase in lower_vec_perm (which would mean we'd need
to recurse on the newly created _4 = { 0, 0, 0, 0, 0, 0, 0, 0 };
whether it is supported or not).
2021-04-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/100239
* tree-vect-generic.c (lower_vec_perm): Don't accept constant
permutations with all indices from the first zero element as
vec_shl.
* gcc.dg/pr100239.c: New test.
(cherry picked from commit 83d26d0e1b3625ab6c2d83610a13976b52f63e0a)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (3 preceding siblings ...)
2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
@ 2021-04-27 13:58 ` jakub at gcc dot gnu.org
2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07 9:37 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] ICE: |[10 Regression] ICE: in
|in expand_expr_real_2, at |expand_expr_real_2, at
|expr.c:9865 with |expr.c:9865 with
|__builtin_shuffle() |__builtin_shuffle()
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk and for 11.2 so far.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (4 preceding siblings ...)
2021-04-27 13:58 ` [Bug tree-optimization/100239] [10 " jakub at gcc dot gnu.org
@ 2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07 9:37 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/100239] [10 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle()
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
` (5 preceding siblings ...)
2022-06-28 10:44 ` jakub at gcc dot gnu.org
@ 2023-07-07 9:37 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 9:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100239
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |11.2.0
Known to fail| |10.5.0
Status|ASSIGNED |RESOLVED
Target Milestone|10.5 |11.2
Resolution|--- |FIXED
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 11.2.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-07 9:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 21:20 [Bug rtl-optimization/100239] New: [10/11/12 Regression] ICE: in expand_expr_real_2, at expr.c:9865 with __builtin_shuffle() zsojka at seznam dot cz
2021-04-23 21:24 ` [Bug rtl-optimization/100239] " jakub at gcc dot gnu.org
2021-04-26 12:55 ` [Bug tree-optimization/100239] " jakub at gcc dot gnu.org
2021-04-27 13:43 ` cvs-commit at gcc dot gnu.org
2021-04-27 13:56 ` cvs-commit at gcc dot gnu.org
2021-04-27 13:58 ` [Bug tree-optimization/100239] [10 " jakub at gcc dot gnu.org
2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07 9:37 ` rguenth 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).