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] (-fstrict-overflow) optimize counted loops on signed iv


On 2/14/07, Christian BRUEL <christian.bruel@st.com> wrote:
I would like to propose the following iv optimization, that is now made
legitimate thank to -fstrict-overflow.

This patch improves the computation of the final value of the loop's
control variable when the signed initial value of the scalar evolution
for iv1 is relative to the scalar evolution for iv0, like in
for (i = iv0->base ; i < iv1->base ; i++) with iv1->base = iv0->base+Cst

This allows to optimize loops like :
   for (i = start; i <= start+1; i++) ...

I know it looks stupid as a test case, but this pattern happens in
Dhrystone...

Another minor change in this patch is the addition of
FLAG_OVERFLOW_UNDEFINED to avoid testing the overflow flags for each
type like in :

   if (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (op0))
     || TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (op1)))
       return false;

That doesn't work unless you want to make unsigned overflow undefined as well.


Richard.


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