I'm looking at an ICE on SPEC 2006 464.h264ref slice.c that occurs
with -O3 for both aarch64 and armhf.

palantir:2080$ ./xgcc -B./ -O3 -S slice.i
slice.c: In function ‘poc_ref_pic_reorder’:
slice.c:838:6: error: incorrect type of vector CONSTRUCTOR elements

{_48, _55, _189, _59}

vect_no_reorder_16.92_252 = {_48, _55, _189, _59};
slice.c:838:6: internal compiler error: verify_gimple failed
...

This fails because it is expecting int type elements in the
constructor, and we have instead elements with boolean type.
useless_type_conversion_p says that it isn't OK to substitute bool for
int.

I used bisection to trace the problem to the patch for buzilla 68215
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68215

The problem occurs in expand_vector_condition.  a_is_comparison is
false.  Before the patch, aa is an ssa_name with type boolean returned
by tree_vec_extract.   This is passed to passed to gimplify_build3
which returns a cond_expr with type int.  After the patch, aa is a
ne_expr with type boolean.  gimplify_build3 calls fold_build3_loc
which optimizes the cond_expr/ne_expr, and returns a nop_expr of type
int of the boolean ne_expr.  gimplify_build3 then calls STRIP_NOPS
which removes the nop_expr, and the end result here is a ne_expr with
a boolean type, which is the wrong type for the constructor.

I don't have a lot of experience with the gimple work, so I'm not sure
where this is going wrong.

I see a number of places in tree-vect-generic.c that add a
VIEW_CONVERT_EXPR if useless_type_convertsion_p is false.  That should
work, except when I try this, I see that the VIEW_CONVERT_EXPR gets
converted to a NOP_EXPR by gimplify_build1, and gets stripped again.

Maybe the gimplify_build* routines should be using
STRIP_USELESS_TYPE_CONVERSION instead of STRIP_NOPS?  That seems to
work, but I don't know if that will have cascading effects.

Or maybe verify_gimple should allow bools and ints to mix in a
constructor?  That doesn't seem like the right solution to me.

Jim

Reply via email to