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] Fix two bugs in gimple-fold.c and/or folding (PR tree-optimization/46909)


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


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