[LLVMdev] Landing my new development on the trunk ...

Dan Gohman gohman at apple.com
Fri Oct 29 14:21:16 PDT 2010


On Oct 29, 2010, at 12:20 PM, Brian West wrote:

> On 10/29/10 1:26 PM, Eli Friedman wrote:
>> Sure, but you know which induction variables you created; you can just
>> zap the unused ones at the end of the pass, no?
> This is feasible.  We would have to collect more information during OSR 
> proper pass and add logic to cleanup at the end.
> 
>>> FWIW I noticed that other optimizations (as seen in StandardPasses.h) are
>>> followed by -instcombine for cleanup. I thought requiring or suggesting
>>> running
>>> -instcombine after -osr would be SOP.
>> 
>> Strength reduction is sort of a special case; it runs extremely late
>> because it interferes with other optimizations.
>> 
>>> FWIW2 our intent in creating OSR was not to replace LSR, just provide an
>>> alternative strength reduction optimization.
>> 
>> Sure, but if it can't be used as an alternative to LSR, how would it be used?
> 
> The PACE project intends to use LLVM to perform lower level 
> optimizations in its compiler.  OSR would be another optimization that 
> it would have in its bag of tricks.  Remember that OSR finds reductions 
> that LSR does not.

LSR's primary goal is to reduce integer register pressure, with
strength reduction being just one of its available tools.  Also, it aggressively
uses the target addressing modes (which is awkward in LLVM IR, since the
addressing modes aren't explicit, but that's another story).  Without
a Target, it currently assumes it can use register+register addressing,
which is probably pretty bad when used with the C backend.  We
can probably fix this, if you're interested.

A big downside of the current LSR algorithm is it's slow.  I had initially
hoped that some of the heuristics would protect it better, but the problem is
more complex than I had expected.  I haven't done any measurements,
but it's likely that OSR is faster, which may interest some people regardless
of how the output compares.

> For code generation, the PACE compiler can use the LLVM C Backend (plus 
> the native compiler) or the LLVM native backend (if available) or just 
> the native compiler.  Thus, when the PACE compiler uses LLVM, LSR may 
> not be run.

LSR can be run from opt, though as I mentioned above the current
target-independent addressing mode assumptions may need to be tuned.

> I suspect that there may be other LLVM C Backend users who could use OSR 
> as well, right?

Not many people use the C backend.

Dan





More information about the llvm-dev mailing list