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: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Changpeng Fang <changpeng dot fang at amd dot com>
- Cc: gcc-patches at gcc dot gnu dot org, rakdver at gcc dot gnu dot org, spop at gcc dot gnu dot org
- Date: Thu, 11 Feb 2010 12:35:49 +0100
- 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>
> 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?