Predict register usage



Function call has overheads including calling convention spill/reload
or maybe you do global register allocation. Finally the code is
executed at the same place, right? call or no call there is no magic,
you need the resources. Though inlining reduces call overhead,
subsequent code motion can increase register usage. Maybe by not
inlining you are limiting the ability of downstream optimizations to
mess up and inlining is not the issue. So what you can do here might
be driven less by the particular goodness of a particular approach and
more by what your downstream optimizations do, including how good
allocation is. For a cheap solution, you could try putting code motion
barriers around your inlined function when you see high register
pressure.

For a general solution, to me it seems that my ability to consider all
inter-optimization tradeoffs, architectural tradeoffs, fiddle
endlessly with switches to produce good results is limited. Using
machine learning or autotuners and letting machine do a good part of
this work might be the long term solution in coming time.

Inderaj

.



Relevant Pages

  • Re: [git patches 1/2] warnings: attack valid cases spotted by warnings
    ... I noticed one interesting thing while starting on this cleanup. ... lots of register spills, just because it keeps stuff live rather than just ... So inlining a function doesn't even make it faster, ... readability should generally always be the #1 goal, ...
    (Linux-Kernel)
  • Re: Best charting package
    ... You're right about the property inlining, but it is present only in the ... ..NET framework 2.0 and to a certain level - for example having a simple ... Inline functions / properties are badly missing. ... MSVC would ignore the register ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Predict register usage
    ... allocation, the final result for the inlined code after the register ... increased register pressure after inlining, spill code must be added ...
    (comp.compilers)