[patch gimplifier]: Do folding on truth and/or trees

Richard Guenther richard.guenther@gmail.com
Wed Apr 27 21:10:00 GMT 2011


On Wed, Apr 27, 2011 at 10:26 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Wed, Apr 27, 2011 at 10:03 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Hello,
>>
>> this patch adds the ability to gimple-fold to operate for truth and/or
>> operations
>> on folded binary-and/or optimized truth trees - as done by fold-const.  As fold
>> converts trivial operations like (A && B) to (A & B) != 0, in most cases further
>> folding of truth and/or trees wasn't done.
>> folding will be again detected.
>>
>> ChangeLog gcc/
>>
>> 2011-04-27  Kai Tietz
>>
>>        * gimple-fold.c (is_bit_ior_and): New helper function.
>>        (fold_equal_and_or): New helper function for truth &&
>>        and || logic folding with treating binary optimization.
>>        (maybe_fold_and_comparisons): Folding for and.
>>        (maybe_fold_or_comparisons): Folding for or.
>>
>> ChangeLog gcc/testsuite/
>>
>> 2011-04-27  Kai Tietz
>>
>>        * gcc.dg/binop-tand1.c: New.
>>        * gcc.dg/binop-tand2.c: New.
>>        * gcc.dg/binop-tor1.c: New.
>>        * gcc.dg/binop-tor2.c: New.
>>
>> Tested for x86_64-pc-linux-gnu and x86_64-w64-mingw32. Ok for apply?
>
> No.  This is certainly the wrong place to do tree combining.

Either look into extending tree-ssa-forwprop.c or work on
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01099.html, thus fold
to piecewise gimple expressions so that the machinery can also
be used from value-numbering.

Richard.



More information about the Gcc-patches mailing list