[llvm-commits] [PATCH] MCAssembler Performance: Lazy invalidation

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Dec 14 09:55:55 PST 2010


On 10-12-14 9:29 AM, David Meyer wrote:
> This patch moves invalidation of the layout until after all relaxations
> have occurred.
>
> This prevents wasting time recomputing portions of the layout over and
> over. Computing the layout is expensive, so we want to use as much of
> the information generated each time as possible, instead of throwing it
> away each  time a relaxation happens.
>
> This removes a hidden O(n^2) runtime factor (where n is the number of
> fragments) which causes terrifying performance problems when assembling
> really large .s file with lots of relaxable instructions.

You can probably remove the WasRelaxed variable now.

Do you have an example of the .s file? While working on PR8711 I tried 
something along these lines. It helped on some files, but caused more
passes on others.

One thing I tried that was unnecessary after decoupling sections but 
might help in here (and I can try it with a .s):

*) Relax align fragments. With this you can remove the EffectiveSize 
field and then invalidate should mark the last relaxed fragment as the 
last valid one (instead of the previous).

Other ideas I had but didn't implement:

*) Have a working list of fragments that might need to be relaxed, that 
way you don't revisit every fragment on every pass.
*) Have EvaluateAsAbsolute return an enum: Absolute, 
AbsoluteAfterLayout, NotAbsolute. With this you can then prune the work 
list earlier.


> - David Meyer

Cheers,
Rafael



More information about the llvm-commits mailing list