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: Improve loop detection and loop header copying


> 
> I've run across a number of "interesting" problems while analyzing SPEC's
> perl performance problems when using the tree-ssa compiler.   At the root
> of our problems appears to be bad register allocation and block placement
> due to odd branch prediction & frequency information.
> 
> Needless to say these are not easy problems to analyze.
> 
> This patch fixes one specific issue (loop header copying).  As it turns out
> this patch alone does not help perl in any way shape or form, but it does
> appear to be a minor help for other benchmarks.
> 
> --
> 
> There is a fundamental difference between tree-ssa and mainline in regards
> to loops.   tree-ssa uses loop analysis to create LOOP_BEGIN/LOOP_END notes
> while mainline creates LOOP_BEGIN/LOOP_END notes when it expands source level
> looping constructs.
> 
> The notes created by tree-ssa actually reflect reality more accurately and
> that's generally been a good thing :-)  However, loop header copying is 
> highly sensitive to the placement of the LOOP_END note.  The net result is
> the tree-ssa code is not copying loop headers nearly as often as the mainline
> code.
> 
> My original direction to fix this was to take the loop header copying code
> from the rtlopt branch which doesn't need the loop notes to perform this
> optimization.  However, that turned out to be an amazingly bad idea as
> nearly every benchmark got notably worse, primarily because the rtlopt
> header copying is *extremely* conservative.  This is probably still the
> right long term direction since ultimately loop notes must die! :-)

I don't even recall that we do have some kind of header copying in
rtlopt branch, but did you try Zdenek's new tree-ssa loop header
duplication code?  I believe it is in the LNO branch but Zdenek also
sent patch against tree-SSA at some point that got unreviewed.

Honza


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