This is the mail archive of the gcc@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: Useless conditional branches


On Tue, Mar 2, 2010 at 10:55 AM, Andrew Haley <aph@redhat.com> wrote:
> On 03/02/2010 08:55 AM, Alain Ketterlin wrote:
>>
>> It looks like gcc sometimes produces "useless" conditional branches.
>> I've found code like this:
>>
>> ? xor ? ?%edx,%edx
>> ? ; code with no effect on edx (see full code below)
>> ? test ? %edx,%edx
>> ? jne ? ?<somewhere else>
>>
>> The branch on the last line is never taken. Why does gcc generate such
>> code sequences? Is this patched at runtime, or something? Am I missing
>> something obvious here?
>
>> Let me know if more detail is needed.
>
> We really need a test case, with source, that illustrates the problem.
> When we have that, we can treat is as a missed-optimization bug.

I can't reproduce it with 4.3 nor 4.5 but indeed 4.4 has this interesting
code sequence.  It looks like a missed jump threading opportunity.

Richard.

> Andrew.
>


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