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 2/2]: Branch-cost optimizations


On Mon, Nov 7, 2011 at 5:07 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> 2011/11/7 Richard Guenther <richard.guenther@gmail.com>:
>> On Sun, Nov 6, 2011 at 11:17 PM, Kai Tietz <ktietz@redhat.com> wrote:
>>> Hello,
>>>
>>> the second patch extends the tree-ssa-ifcombine pass so, that it chains up simple if-and/or-if patterns via associative bitwise-and/or operations. ?This allows for example optimization for cases like:
>>>
>>> if (c == 0) return 2;
>>> if (c == 1) return 2;
>>> if (c == 2) return 2;
>>> ...
>>>
>>> as now reassociation-pass can optimize on them.
>>
>> err ... tree-ssa-ifcombine does exactly if "merging", why are you now
>> adding a "merging" part!? ?The above description does not shed any
>> light on this either. ?In fact the above example is something
>> that should be optimized by phiopt.
>>
>> Richard.
>
> Well, the example I provided might be not the best, as indeed phiopt
> should handle this. ?But if such if-and/or-if chains have for example
> the kind
> if (a == 0)
> ? return doo ();
> if (a == 1)
> ?return doo ();
>
> etc. ?phiopt won't do much here.

tailmerge should change the above to

 if (a == 0 || a == 1)
   return doo ();

Richard.


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