This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch tree-optimization]: Handle boolean-type case in canonicalize_cond_expr_cond


n Wed, Jul 27, 2011 at 12:59 PM, Kai Tietz <ktietz@redhat.com> wrote:
> Hello,
>
> this patch handles for canonicalize_cond_expr_cond the case, that we have an
> type-cast from boolean-type.
>
> ChangeLog
>
> 2011-07-27 ?Kai Tietz ?<ktietz@redhat.com>
>
> ? ? ? ?* gimple.c (canonicalize_cond_expr_cond): Handle cast
> ? ? ? ?from boolean-type case.
>
> Bootstrapped and regression tested on x86_64-pc-linux-gnu. ?Ok for apply?

Ok.  Do you have a testcase that you can add?

Thanks,
Richard.

> Regards,
> Kai
>
> Index: gcc-head/gcc/gimple.c
> ===================================================================
> --- gcc-head.orig/gcc/gimple.c
> +++ gcc-head/gcc/gimple.c
> @@ -3160,7 +3160,9 @@ canonicalize_cond_expr_cond (tree t)
> ?{
> ? /* Strip conversions around boolean operations. ?*/
> ? if (CONVERT_EXPR_P (t)
> - ? ? ?&& truth_value_p (TREE_CODE (TREE_OPERAND (t, 0))))
> + ? ? ?&& (truth_value_p (TREE_CODE (TREE_OPERAND (t, 0)))
> + ? ? ? ? || TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0)))
> + ? ? ? ? ? ?== BOOLEAN_TYPE))
> ? ? t = TREE_OPERAND (t, 0);
>
> ? /* For !x use x == 0. ?*/
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]