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

            Bug ID: 129287
           Summary: [17 Regression] ICE: tree check: expected none of
                    vector_type, have vector_type in gimple_simplify_610
                    since with r17-7081-g8ac259a759eec1
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: soumyaa at gcc dot gnu.org
  Target Milestone: ---

Hi,

Commit r17-7081-g8ac259a759eec1 is causing several ICEs in SPEC2026 suites on
aarch64 (-O3)

Min repro:

void f(unsigned *a, unsigned *b) {
  for (int i = 0; i < 1024; i++)
    a[i] = __builtin_bswap32(b[i]) >> 3;
}

https://godbolt.org/z/nM7f6jKqz

This commit maps __builtin_bswap* to IFN_BSWAP, so the vectorizer now emits a
vector .BSWAP. That vector .BSWAP then matches the match.pd pattern "/*
bswap(x) >> C1 can sometimes be simplified to (T)x >> C2.  */" which was only
written for scalars. Adding an INTEGRAL_TYPE_P check should fix this.

----

Backtrace: 

during GIMPLE pass: vect
u.c: In function 'f':
u.c:1:6: internal compiler error: tree check: expected none of vector_type,
have vector_type in gimple_simplify_610, at gimple-match-8.cc:7581
0x2a5b367 internal_error(char const*, ...)
        gcc/diagnostic-global-context.cc:787
0x993fa3 tree_not_check_failed(tree_node const*, char const*, int, char const*,
...)
        gcc/tree.cc:9431
0x1cc0e83 tree_not_check(tree_node*, char const*, int, char const*, tree_code)
        gcc/tree.h:4080
0x1cc0e83 gimple_simplify_610(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node*, tree_node**, combined_fn)
        gimple-match-8.cc:7581
0x1a705f7 gimple_simplify_RSHIFT_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
        gimple-match-3.cc:37169
0x1e6eccb gimple_resimplify2
        gcc/gimple-match-exports.cc:1029
0x1e6f5cb gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        gcc/gimple-match-exports.cc:896
0xe07aeb gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
        gcc/gimple-fold.cc:9867
0x14db93b try_to_simplify
        gcc/tree-ssa-sccvn.cc:6786
0x14db93b visit_stmt
        gcc/tree-ssa-sccvn.cc:6829
0x14dca27 process_bb
        gcc/tree-ssa-sccvn.cc:8787
0x14de39f do_rpo_vn_1
        gcc/tree-ssa-sccvn.cc:9398
0x14df827 vn_driver::vn_driver(function*, edge_def*, bitmap_head*, bool, bool,
bool, vn_lookup_kind)
        gcc/tree-ssa-sccvn.cc:9542
0x14df973 do_rpo_vn(function*, edge_def*, bitmap_head*, bool, bool, bool,
vn_lookup_kind)
        gcc/tree-ssa-sccvn.cc:9514
0x161514f execute
        gcc/tree-vectorizer.cc:1440

Reply via email to