Segher Boessenkool <seg...@kernel.crashing.org> writes:

Hi,

Thanks for all your comments!

> Hi!
>
> On Wed, Apr 15, 2020 at 08:21:03AM +0200, Richard Biener wrote:
>> On Wed, Apr 15, 2020 at 3:56 AM Jiufu Guo via Gcc-patches
>> <gcc-patches@gcc.gnu.org> wrote:
>> > As you may know, we have loop unroll pass in RTL which was introduced a few
>> > years ago, and works for a long time.  Currently, this unroller is using 
>> > the
>> > pseudos in the original body, and then the pseudos are written multiple 
>> > times.
>> >
>> > It would be a good idea to create new pseudos for those duplicated 
>> > instructions
>> > during loop unrolling.  This would relax reg dependence, and then provide 
>> > more
>> > freedom/opportunity for other optimizations, like scheduling, RA...
>> 
>> I think there's a separate pass to do something like this, conveniently
>> placed after unrolling.  -fweb, IIRC enabled by default for -funroll-loops
>> unless explicitly disabled.  Related is regrename which is also
>> enabled then.
web/rnreg have some help for some cases, while they does not know much
information about loop, and do not care if a BB/pseudo/reg is generated
during unrolling. Unroller know these information, and it maybe accurate
to create new pseudos and relax depences between insns in unroller. 
For the example of preview RTL sequences, using new pseudo in unroller
is better than web/rnreg.

>> 
>> So where does your patch make a difference?  Is the webizers dataflow 
>> analysis
>> maybe confused by backedges?
>
> Does -fweb handle things set by the last unrolled iteration, used by the
> first unrolled iteration?
>
> On a general note, we shouldn't depend on some pass that may or may not
> clean up the mess we make, when we could just avoid making a mess in the
> first place.
Yes, this is a reason that I also think it maybe good to do it during
unroller.

>
> The web pass belongs immediately after expand; but ideally, even expand
> would not reuse pseudos anyway.
Currently, web runs after loop done now. 

Jiufu

>
> Maybe it would be better as some utility routines, not a pass?
>
>
> Segher

Reply via email to