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 to handle perfect loop unrolling in tree_transform_and_unroll_loop


> You are right. These lines are leftover of previous atttempt to merge code.
> Removed now in new patch.

Actually (again just looking at your patch code, have not tested), but now:

- Since you removed that code, new_exit does not get set at the
perfect_unrolling case. The call to tree_duplicate_loop_to_header_edge
now has new_exit passed as NULL instead of being set to either exit or
single_dom_exit like you did before.

>> - More to the point, I did something similar except I added a test to
>> see if the factor requested by the user was above the limit of
>> n_iters. If so, I say that the unrolling is perfect and issue a
>> warning.
>
> Can the check be done in unrolling pass?
> Does your test case only work with an extra unrolling pass? Or can be
> tested with this patch only? Currently, tree_transform_and_unroll_loop
> seems to be called by prefetch pass only.
>

You've got a point, I was thinking of my code where the user can
request an unrolling of a higher degree

#pragma unroll 100
for (i=0; i<20; i++)
{
...
}

Your patch won't unroll it at all.

However, in the case where this patch is only to fix the current code,
I don't think the unrolling passes would ever ask to unroll more than
the known iterations, so this is not a problem.

> BTW: the following lines in original tree_transform_and_unroll_loop (I didn't change) are problematic. Some complex loops won't
> meet requirements of single_pred(loop->latch) (e.g., 20060905-1.c) should this function is called to unroll them.

I don't understand this. Can you explain a bit more ?

I looked at this, my modified version 4.3.2 does not have any issues
with this test. Without my pragma, it does not try to unroll, with it,
it does not fail.

Jc


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