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

--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> #1  0x00000000015d76c0 in fold_using_range::range_of_cond_expr (
>     this=0x7fffffff9dff, r=..., s=0x7ffff680e820, src=...)
>     at /space/rguenther/src/gcc-clean/gcc/gimple-range-fold.cc:1513
> 1513      gcc_checking_assert (range_compatible_p (TREE_TYPE (op1),
> TREE_TYPE (op2)));
> 
> confirmed.
> 
> (gdb) p debug_tree (op1)
>  <ssa_name 0x7ffff6605840
>     type <integer_type 0x7ffff681d690 unsigned int sizes-gimplified public
> unsigned SI
>         size <integer_cst 0x7ffff681f210 constant 32>
>         unit-size <integer_cst 0x7ffff681f228 constant 4>
>         align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7ffff681d690 precision:32 min <integer_cst 0x7ffff681f240 0> max
> <integer_cst 0x7ffff681f1f8 4294967295>
>         pointer_to_this <pointer_type 0x7ffff682d738>>
>     visited var <var_decl 0x7ffff69ff130 i>
>     def_stmt i_18 = PHI <i_15(8), 0(15)>
> 
> (gdb) p debug_tree (op2)
>  <ssa_name 0x7ffff69d1948
>     type <bitint_type 0x7ffff69c9498 public unsigned SI
>         size <integer_cst 0x7ffff681f210 constant 32>
>         unit-size <integer_cst 0x7ffff681f228 constant 4>
>         align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
> 0x7ffff69c9498 precision:17 min <integer_cst 0x7ffff69dc618 0> max
> <integer_cst 0x7ffff69dc558 131071>
>         pointer_to_this <pointer_type 0x7ffff69c9540>>
>     visited
>     def_stmt g1.0_1 = g1;
> 
> 
> patt_11 = patt_38 ? i_18 : g1.0_1;
> 
> 
> this inconsistency is introduced by vectorizer patterns.  Built by
> 
> 0x0000000003af9768 in vect_recog_bool_pattern (vinfo=0x57fdf50, 
>     stmt_vinfo=0x57ff680, type_out=0x7fffffffc5d8)
>     at /space/rguenther/src/gcc-clean/gcc/tree-vect-patterns.cc:6209
> 6209            = gimple_build_assign (lhs, COND_EXPR, lhs_var,
> 
> and taken from
> 
> patt_11 = _16 ? i_18 : g1.0_1;
> 
> built by
> 
> 0x0000000003ae8582 in vect_recog_cond_expr_convert_pattern (vinfo=0x57fdf50, 
>     stmt_vinfo=0x57feb20, type_out=0x7fffffffc698)
>     at /space/rguenther/src/gcc-clean/gcc/tree-vect-patterns.cc:1185
> 1185      cond_stmt = gimple_build_assign (temp, build3 (COND_EXPR, type,
> match[3],
> 
> from
> 
> _7 = _16 ? _4 : _5;
> 
> which was OK.  gimple_cond_expr_convert_p has a match that ends up with
> two operands not of the same precision:
> 
> /* Floatint point/integer comparison and integer->integer
>    or floating point -> float point conversion.  */
> (match (cond_expr_convert_p @0 @2 @3 @6)
>  (cond (simple_comparison@6 @0 @1) (convert@4 @2) (convert@5 @3))
>   (if ((INTEGRAL_TYPE_P (type)
>        || (!flag_trapping_math && SCALAR_FLOAT_TYPE_P (type)))
>        && ((INTEGRAL_TYPE_P (TREE_TYPE (@2))
>             && INTEGRAL_TYPE_P (TREE_TYPE (@3)))
>            || (SCALAR_FLOAT_TYPE_P (TREE_TYPE (@2))
>                && types_match (TREE_TYPE (@2), TREE_TYPE (@3))))
>        && !operand_equal_p (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (@0)))
>        && operand_equal_p (TYPE_SIZE (TREE_TYPE (@0)),
>                            TYPE_SIZE (TREE_TYPE (@2)))
>        && operand_equal_p (TYPE_SIZE (TREE_TYPE (@0)),
>                            TYPE_SIZE (TREE_TYPE (@3)))

So TYPE_SIZE equal of @2 and @3 is not enough for _BitInt, need TYPE_PRECISION
for that, I'm working on a patch.

Reply via email to