Tue, 9 May 2006, Richard Guenther wrote:
2006-05-09 Richard Guenther <rguenther (AT) suse (DOT) 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 K 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),
- TREEPERAND (arg1, 1),
- TREEPERAND (arg1, 0)), flags);
+return operand_equal_p (TREEPERAND (arg0, 0),
+TREEPERAND (arg1, 1), flags)
+ && operand_equal_p (TREEPERAND (arg0, 1),
+ TREEPERAND (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.
K for mainline with this change. Thanks again.
Roger
--