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, PR 40866] decrease the cost of an IV candidate by 1 when the IV is used in a test against zero


Thanks for finding this problem. I am working on it.

Changpeng
________________________________________
From: H.J. Lu [hjl.tools@gmail.com]
Sent: Sunday, February 28, 2010 11:04 AM
To: Fang, Changpeng
Cc: gcc-patches@gcc.gnu.org; rakdver@gcc.gnu.org; spop@gcc.gnu.org
Subject: Re: [PATCH, PR 40866] decrease the cost of an IV candidate by 1 when   the IV is used in a test against zero

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.



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