On Tue, Jan 12, 2016 at 11:05 PM, Jim Wilson <jim.wil...@linaro.org> wrote: > On Tue, Jan 12, 2016 at 2:22 PM, Jim Wilson <jim.wil...@linaro.org> wrote: >> 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. > > To elaborate on this a bit more, I see a number of places that do this > if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (new_rhs))) > new_rhs = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs), > new_rhs); > > In match.pd, there is a rule to convert VIEW_CONVERT_EXPR to NOP_EXPR > (simplify > (view_convert @0) > (if ((INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)) > && (INTEGRAL_TYPE_P (TREE_TYPE (@0)) || POINTER_TYPE_P (TREE_TYPE > (@0))) > && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (@0))) > (convert @0))) > > But according to useless_type_conversion_p, there are two more > conditions that need to be met, the signedness must be the same, and > if one is boolean and one is not then the precision must be one. In > my case, we have a 32-bit int type and a 32-bit boolean type. So > useless_type_conversion_p is demanding a type conversion, but match.pd > is converting the VIEW_CONVERT_EXPR to a NOP_EXPR, and gimplify_build1 > is stripping it. So there appears to be an inconsistency here.
Can you file a bug so it does not get lost (with a reduced testcase)? The VIEW_CONVERT_EXPR to NOP_EXPR is correct as that does not remove any conversion. I don't think gimplify_build1 is stripping the nop_expr either as it should be using useless_type_conversion_p there. Also in C there is no 32bit boolean types only a 1 bit one (which fills a 1 byte field). So something else is going wrong. Thanks, Andrew