This is the mail archive of the
mailing list for the GCC project.
Re: [patch tree-optimization]: Improve handling of conditional-branches on targets with high branch costs
On Thu, 6 Oct 2011, Richard Guenther wrote:
> > + Â Â Â&& ((TREE_CODE_CLASS (TREE_CODE (arg1)) != tcc_comparison
> > + Â Â Â Â Â&& TREE_CODE (arg1) != TRUTH_NOT_EXPR)
> > + Â Â Â Â || !FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))))
> ? simple_operand_p would have rejected both ! and comparisons.
> I miss a test for side-effects on arg0 (and probably simple_operand_p there,
> as well).
He has it in the if() body. But why? The point of ANDIF/ORIF is to not
evaluate the second argument for side-effects when the first argument is
false/true already, and further to establish an order between both
evaluations. The sideeffect on the first arg is always evaluated.
AND/OR always evaluate both arguments (in unspecified order), but as he
checks the second one for being free of side effects already that alone is
already equivalent to ANDIF/ORIF. No need to check something on the first