This is the mail archive of the
mailing list for the GCC project.
Match-and-simplify and COND_EXPR
- From: Andrew Pinski <pinskia at gmail dot com>
- To: GCC Mailing List <gcc at gcc dot gnu dot org>, Richard Guenther <rguenther at suse dot de>
- Date: Wed, 5 Nov 2014 14:34:31 -0800
- Subject: Match-and-simplify and COND_EXPR
- Authentication-results: sourceware.org; auth=none
I was trying to hook up tree-ssa-phiopt to match-and-simplify using
either gimple_build (or rather using gimple_simplify depending on if
we want to produce cond_expr for conditional move). I ran into a
With the pattern below:
/* a ? 0 : 1 -> a if 0 and 1 are integral types. */
(cond_expr @0 integer_zerop integer_onep)
(if (INTEGRAL_TYPE_P (type))
This produces a gimple statement with an incorrect gimple statement
where we have have a convert with an compare expression.
t.c: In function âfâ:
t.c:1:5: error: invalid operand in unary operation
int f(int c, int a, int b)
_4 = (int) (c_2(D) != 0);
Did I implement the pattern incorrectly or is there a bug due to the
way cond_expr handles its 0th operand in that it is valid for compares
there in gimple form.
I don't have a good patch to test tree-ssa-phiopt.c connection due the
patch having extra code in it already which handles creating cond_expr
for conditional moves already.