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 tree-optimization]: Improve handling of conditional-branches on targets with high branch costs


On Thu, Oct 6, 2011 at 3:49 PM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> 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
> argument.

It seems to me it should then simply be

  if (!TREE_SIDE_EFFECTS (arg1)
     && simple_operand_p (arg1))
   return fold-the-not-and-variant ();

Richard.


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