https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92185
Bug ID: 92185
Summary: ICE when perform condition reduction vectorization on
uchar ind var
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: linkw at gcc dot gnu.org
Target Milestone: ---
TESTCASE:
#include "tree-vect.h"
extern void abort (void) __attribute__ ((noreturn));
#define N 27
unsigned char
condition_reduction (short *a, short min_v)
{
unsigned char last = 0;
for (unsigned char i = 0; i < 27; i++)
if (a[i] < min_v)
last = i;
return last;
}
int
main (void)
{
short a[27] = {
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
21, 22, 23, 24, 25, 26, 27
};
check_vect ();
int ret = condition_reduction (a, 10);
if (ret != 18)
abort ();
return 0;
}
BTW, tree-vect.h is from gcc/testsuite/gcc.dg/vect/tree-vect.h
Options: -Ofast -fno-inline -fdump-tree-vect-details
-fvect-cost-model=unlimited
ICE backtrace:
13 | condition_reduction (short *a, short min_v)
| ^~~~~~~~~~~~~~~~~~~
0x115016ff vect_create_epilog_for_reduction
/home/linkw/gcc/gcc-git-fix/gcc/tree-vect-loop.c:4252
0x1150ccb3 vectorizable_live_operation(_stmt_vec_info*, gimple_stmt_iterator*,
_slp_tree*, _slp_instance*, int, bool, vec<stmt_info_for_cost, va_heap,
vl_ptr>*)
/home/linkw/gcc/gcc-git-fix/gcc/tree-vect-loop.c:7478
0x114df9bf can_vectorize_live_stmts
/home/linkw/gcc/gcc-git-fix/gcc/tree-vect-stmts.c:10578
0x114e1933 vect_transform_stmt(_stmt_vec_info*, gimple_stmt_iterator*,
_slp_tree*, _slp_instance*)
/home/linkw/gcc/gcc-git-fix/gcc/tree-vect-stmts.c:11031
0x1150e9d7 vect_transform_loop_stmt
/home/linkw/gcc/gcc-git-fix/gcc/tree-vect-loop.c:7918
0x1150f73f vect_transform_loop(_loop_vec_info*)
/home/linkw/gcc/gcc-git-fix/gcc/tree-vect-loop.c:8133
0x1154acc7 try_vectorize_loop_1
/home/linkw/gcc/gcc-git-fix/gcc/tree-vectorizer.c:982
0x1154aff3 try_vectorize_loop
/home/linkw/gcc/gcc-git-fix/gcc/tree-vectorizer.c:1035
0x1154b243 vectorize_loops()
/home/linkw/gcc/gcc-git-fix/gcc/tree-vectorizer.c:1115
0x1132976f execute
/home/linkw/gcc/gcc-git-fix/gcc/tree-ssa-loop.c:414