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: [rtlopt] runtime iterations unrolling fix


> Hello,
> 
> > the test to disable exit conditional in peeled copy of loop body is
> > reversed compared to the comment.  I guess the comment is what you've
> > intended so I've changed it.  Still I am not able to come with
> > testcase when we need exit test in all copies.  Can you enlighten me?
> 
> thinking about it, I come to belief the comment is the thing that is wrong --
> suppose that we have a preincr loop, that means we are
> trying to arrange things so that the exit from loop body is in the last
> block of the loop; it is, we must arrange that after entering the body,
> there will be -1 (mod # of unrollings) iterations left. I must have
> tests for exit in every copy (in preconditioning), as we may exit
> in some of these copies (in case the loops rolls less than # of
> unrollings times).
> 
> So I will revert the change and fix the comment.
> 
> Did the code as it was cause some problem?
I see what are you shooting for now, but it seems to be quite
unnecesarily expensive way to do so.
We have two problems - one problem is the case where loop is
paradoxical, then we need one of the original exit tests to bail out in
very first iteration.
In the other cases we know the number of iterations to be valid, but
still it can be set up in a way that the unrolled loops will iterate 0
times, if I understand it correctly, you are keeping the exit test just
for this case.
It would be better to base exit condition only on the number of
iterations that is anyway readilly available - keep the
(niter&nuroll==x) tests in the peeled copies, removing exit tests and
add one extra testst (niter >= nunroll) just preconditioning the loop.

Then we will execute in worst case npeelings+2 tests instead of
2*npeelings.

Honza
> 
> Zdenek


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