[PATCH] Fix two bugs in gimple-fold.c and/or folding (PR tree-optimization/46909)
Jeff Law
law@redhat.com
Tue Dec 14 14:27:00 GMT 2010
On 12/14/10 02:45, Jakub Jelinek wrote:
> Hi!
>
> This patch fixes two bugs in or_var_with_comparison_1
> - one is that bool BIT_IOR_EXPR was mistakenly handled as TRUTH_AND_EXPR
> instead of TRUTH_OR_EXPR
> - another one is that it tried to optimize (x AND x) for arbitrary x
> into 1 instead of x
> and makes it optimize even when both partial results are the same in the
> and/and and or/or case.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2010-12-14 Jakub Jelinek<jakub@redhat.com>
>
> PR tree-optimization/46909
> * gimple-fold.c (and_var_with_comparison_1): Save partial
> result even in the is_and case, if both partial results
> are the same, return it.
> (or_var_with_comparison_1): Use is_or predicate instead of
> innercode == TRUTH_OR_EXPR test. Save partial result
> even in the is_or case, if both partial results are the
> same, return it. In the !is_or case when both partial
> results are the same, return the partial result instead
> of boolean_true_node.
>
> * gcc.c-torture/execute/pr46909-1.c: New test.
> * gcc.c-torture/execute/pr46909-2.c: New test.
> * gcc.dg/pr46909.c: New test.
OK.
jeff
More information about the Gcc-patches
mailing list