https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114108
--- Comment #8 from Tejas Belagod <belagod at gcc dot gnu.org> ---
I find this transformation a bit odd:
...
pr114108.c:11:21: note: add new stmt: vect_patt_32.15_181 = .ABD
(vect__3.11_177, vect__7.14_180);
pr114108.c:11:21: note: ------>vectorizing statement: patt_31 = (unsigned
char) patt_32;
pr114108.c:11:21: note: transform statement.
pr114108.c:11:21: note: vect_is_simple_use: operand .ABD (_3, _7), type of
def: internal
pr114108.c:11:21: note: vect_is_simple_use: vectype vector([16,16]) unsigned
char
pr114108.c:11:21: note: transform assignment.
pr114108.c:11:21: note: vect_get_vec_defs_for_operand: patt_32
pr114108.c:11:21: note: vect_is_simple_use: operand .ABD (_3, _7), type of
def: internal
pr114108.c:11:21: note: def_stmt = patt_32 = .ABD (_3, _7);
pr114108.c:11:21: note: add new stmt: vect_patt_31.16_182 =
VIEW_CONVERT_EXPR<vector([16,16]) signed char>(vect_patt_32.15_181);
...
This seems to have a cascading effect on the MIN_EXPR vectorization:
pr114108.c:11:21: note: ------>vectorizing statement: patt_30 = (int) patt_31;
pr114108.c:11:21: note: ------>vectorizing statement: _11 = dst_18(D) + _1;
pr114108.c:11:21: note: ------>vectorizing statement: patt_29 = MIN_EXPR
<patt_31, 127>;
pr114108.c:11:21: note: transform statement.
pr114108.c:11:21: note: vect_is_simple_use: operand (unsigned char) patt_32,
type of def: internal
pr114108.c:11:21: note: vect_is_simple_use: vectype vector([16,16]) signed
char
pr114108.c:11:21: note: vect_is_simple_use: operand 127, type of def: constant
pr114108.c:11:21: note: transform binary/unary operation.
pr114108.c:11:21: note: vect_get_vec_defs_for_operand: patt_31
pr114108.c:11:21: note: vect_is_simple_use: operand (unsigned char) patt_32,
type of def: internal
pr114108.c:11:21: note: def_stmt = patt_31 = (unsigned char) patt_32;
pr114108.c:11:21: note: vect_get_vec_defs_for_operand: 127
pr114108.c:11:21: note: vect_is_simple_use: operand 127, type of def: constant
pr114108.c:11:21: note: created new init_stmt: vect_cst__183 = { 127, ... };
pr114108.c:11:21: note: add new stmt: vect_patt_29.17_184 = MIN_EXPR
<vect_patt_31.16_182, vect_cst__183>;
I suspect that when narrowing analysis drops patt_30 = (int) patt_31; and
replaces patt_30 in MIN_EXPR directly with patt_31, the pre-computed vector
type_out for patt_30 = (int) patt_31; might be getting reused without getting
recomputed. Still digging to see if this theory holds water...