Bug 101860 - [12 Regression] ICE in gen_reg_rtx, at emit-rtl.c:1199 since r12-2837-g50b5877925ef5ae8
Summary: [12 Regression] ICE in gen_reg_rtx, at emit-rtl.c:1199 since r12-2837-g50b587...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
: 101863 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-08-11 08:09 UTC by Martin Liška
Modified: 2021-08-16 08:12 UTC (History)
2 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-11 00:00:00


Attachments
gcc12-pr101860.patch (667 bytes, patch)
2021-08-11 09:17 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2021-08-11 08:09:29 UTC
The following fails:

$ gcc /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c -O1 -mavx5124vnniw -c
during GIMPLE pass: fre
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c: In function ‘test_27’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c:12: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1199
0x69c2a8 gen_reg_rtx(machine_mode)
	/home/marxin/Programming/gcc/gcc/emit-rtl.c:1199
0xafb406 force_reg(machine_mode, rtx_def*)
	/home/marxin/Programming/gcc/gcc/explow.c:686
0xafb406 force_reg(machine_mode, rtx_def*)
	/home/marxin/Programming/gcc/gcc/explow.c:666
0x12fe673 ix86_expand_vec_one_operand_perm_avx512
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:18124
0x12fe673 expand_vec_perm_1
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:18302
0x12fe820 expand_vec_perm_1
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:18311
0x13007e8 ix86_expand_vec_perm_const_1
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:20702
0x1328bb2 ix86_vectorize_vec_perm_const(machine_mode, rtx_def*, rtx_def*, rtx_def*, vec_perm_indices const&)
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:21002
0x14db5ce gimple_simplify_VEC_PERM_EXPR
	/dev/shm/objdir/gcc/gimple-match.c:154152
0x13405c8 gimple_resimplify3
	/home/marxin/Programming/gcc/gcc/gimple-match-head.c:396
0x14dca97 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
	/home/marxin/Programming/gcc/gcc/gimple-match-head.c:1002
0xbb0f10 gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
	/home/marxin/Programming/gcc/gcc/gimple-fold.c:7330
0x10a1ab5 try_to_simplify
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5428
0x10a1ab5 visit_stmt
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5471
0x10a2d86 process_bb
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7239
0x10a4642 do_rpo_vn
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7837
0x10a5e5a execute
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7991
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.
Comment 1 Martin Liška 2021-08-11 08:10:59 UTC
Similarly fails:

$ gcc /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c -Og -mavx512vp2intersect
during GIMPLE pass: fre
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c: In function ‘test_27’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/vshuf-v32hi.c:12: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1199
0x69c2a8 gen_reg_rtx(machine_mode)
	/home/marxin/Programming/gcc/gcc/emit-rtl.c:1199
0xafb406 force_reg(machine_mode, rtx_def*)
	/home/marxin/Programming/gcc/gcc/explow.c:686
0xafb406 force_reg(machine_mode, rtx_def*)
	/home/marxin/Programming/gcc/gcc/explow.c:666
0x12fe673 ix86_expand_vec_one_operand_perm_avx512
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:18124
0x12fe673 expand_vec_perm_1
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:18302
0x12fe820 expand_vec_perm_1
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:18311
0x13007e8 ix86_expand_vec_perm_const_1
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:20702
0x1328bb2 ix86_vectorize_vec_perm_const(machine_mode, rtx_def*, rtx_def*, rtx_def*, vec_perm_indices const&)
	/home/marxin/Programming/gcc/gcc/config/i386/i386-expand.c:21002
0x14db5ce gimple_simplify_VEC_PERM_EXPR
	/dev/shm/objdir/gcc/gimple-match.c:154152
0x13405c8 gimple_resimplify3
	/home/marxin/Programming/gcc/gcc/gimple-match-head.c:396
0x14dca97 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
	/home/marxin/Programming/gcc/gcc/gimple-match-head.c:1002
0xbb0f10 gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
	/home/marxin/Programming/gcc/gcc/gimple-fold.c:7330
0x10a1ab5 try_to_simplify
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5428
0x10a1ab5 visit_stmt
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5471
0x10a2d86 process_bb
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7239
0x10a4642 do_rpo_vn
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7837
0x10a5e5a execute
	/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7991
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.
Comment 2 Jakub Jelinek 2021-08-11 08:14:58 UTC
I'll have a look.
Comment 3 Jakub Jelinek 2021-08-11 09:17:18 UTC
Created attachment 51286 [details]
gcc12-pr101860.patch

Untested fix.
Comment 4 Jakub Jelinek 2021-08-11 10:37:43 UTC
*** Bug 101863 has been marked as a duplicate of this bug. ***
Comment 5 GCC Commits 2021-08-12 09:27:36 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:04b4f3152593f85b05974528d1607619dd77d702

commit r12-2876-g04b4f3152593f85b05974528d1607619dd77d702
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Aug 12 11:26:57 2021 +0200

    i386: Fix up V32HImode permutations with -mno-avx512bw [PR101860]
    
    My patch from yesterday apparently broke some V32HImode permutations
    as the testcase shows.
    The first function assumed it would never be called in d->testing_p mode
    and so went right away into emitting the code.
    And the second one assumed V32HImode would never reach it, which now
    can for the !TARGET_AVX512BW case.  We don't have a instruction
    in that case though.
    
    2021-08-12  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/101860
            * config/i386/i386-expand.c (ix86_expand_vec_one_operand_perm_avx512):
            If d->testing_p, return true after performing checks instead of
            actually expanding the insn.
            (expand_vec_perm_broadcast_1): Handle V32HImode - assert
            !TARGET_AVX512BW and return false.
    
            * gcc.target/i386/avx512f-pr101860.c: New test.
Comment 6 Jakub Jelinek 2021-08-12 09:28:10 UTC
Fixed.