[PATCH, PR 40866] decrease the cost of an IV candidate by 1 when the IV is used in a test against zero

H.J. Lu hjl.tools@gmail.com
Sun Feb 28 17:44:00 GMT 2010


On Wed, Feb 10, 2010 at 3:03 PM, Changpeng Fang <changpeng.fang@amd.com> wrote:
> Hi,
>
> The patch below fixes PR 40866 : [4.3/4.4/4.5 Regression] No counter
> reversal for simple loops anymore.
>
> Problem:
> 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
> model.
>
> Solution:
> 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
> report.
>
> Bootstrapped and tested on x86-64-linux. OK for trunk?
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43209

-- 
H.J.



More information about the Gcc-patches mailing list