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 PR27302


On Tue, 9 May 2006, Richard Guenther wrote:
> 2006-05-09  Richard Guenther  <rguenther@suse.de>
>
> 	PR tree-optimization/27302
> 	* fold-const.c (operand_equal_p): For two comparisons,
> 	try comparison of one comparison code swapped if that yields
> 	the same code.

If it's OK with you, I think I'd prefer explicit operand_equal_p
calls on the operands, rather than build a new tree node just for
this test.  Something like:

- 	return operand_equal_p (arg0,
- 				build2 (swap_code, TREE_TYPE (arg1),
- 					TREE_OPERAND (arg1, 1),
- 					TREE_OPERAND (arg1, 0)), flags);
+	return operand_equal_p (TREE_OPERAND (arg0, 0),
+				TREE_OPERAND (arg1, 1), flags)
+	       && operand_equal_p (TREE_OPERAND (arg0, 1),
+				   TREE_OPERAND (arg1, 1), flags);

This matches the idiom for commutative_tree_codes in the tcc_comparison
case below, and saves leaking memory to be garbage collector on each
invocation.  I'm sorry for missing this earlier, my bad.


OK for mainline with this change.  Thanks again.

Roger
--


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