This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, PR 40866] decrease the cost of an IV candidate by 1 when the IV is used in a test against zero
- From: Sebastian Pop <sebpop at gmail dot com>
- To: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- Cc: Changpeng Fang <changpeng dot fang at amd dot com>, gcc-patches at gcc dot gnu dot org, rakdver at gcc dot gnu dot org, "Harle, Christophe" <christophe dot harle at amd dot com>
- Date: Thu, 11 Feb 2010 09:46:26 -0600
- Subject: Re: [PATCH, PR 40866] decrease the cost of an IV candidate by 1 when the IV is used in a test against zero
- References: <4B733B52.email@example.com> <20100211113548.GA18428@kam.mff.cuni.cz>
On Thu, Feb 11, 2010 at 05:35, Zdenek Dvorak <firstname.lastname@example.org> wrote:
>> The patch below fixes PR 40866 : [4.3/4.4/4.5 Regression] No counter
>> reversal for simple loops anymore.
>> The loop optimizer canonicalizes the loop to a downward counting loop
>> which may save one instruction if
>> the bound test is against zero. However, ivopts do not know that
>> comparing with zero is more efficient
>> than comparing with any other expressions and thus eliminate the
>> reversed IV based on the current cost
>> In this patch, we changed the ivopts cost model to decrease the cost of
>> an IV candidate by 1 when the IV is
>> a test against zero. This idea was initially proposed by Zdenek Dvorak
>> as shown in the comment #3 of the bug
>> Bootstrapped and tested on x86-64-linux. OK for trunk?
Committed to trunk.