[llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td
Chris Lattner
clattner at apple.com
Mon Dec 10 16:38:18 PST 2007
On Dec 10, 2007, at 3:44 PM, Evan Cheng wrote:
>> This is going to happen with the current pass, though. Each loop is
>> going to see the hoisted instructions from the previous iteration and
>> try to re-hoist them. Is there some heuristic we should apply to
>> prevent it from hoisting instructions too far?
>>
>
> For innermost loops, hoisting invariants out into the preheader always
> make sense. Intuitively, hoisting invariants from inner loops out of
> the outermost loop only makes sense when all (or a lot, whatever that
> means :-) of the inner loops use it. Or at least the first inner loop
> use it.
We discussed this today: I'm strongly of the opinion that licm should
hoist aggressively and not "think" about register pressure. It
should assume that remat is capable of resinking stuff into the loop
when possible. This means that we shouldn't have ad-hoc hacks in
LICM to avoid "increasing register pressure", but I'm fine with
making LICM aware of what remat is able to sink, and having it not
hoist things that it can't handle yet.
With that said, licm should hoist things as far out as possible. The
LLVM LICM pass is structured the way it is in order to hoist loads
out, which require checking alias information at each level of a loop
nest. We don't have short-term plans to hoist out loops (which will
require extensive machine aliasing support), so switching to a model
like dan describes (single pass over all bb's in outermost loops,
hoisting instructions once instead of iteratively) makes sense to me.
-Chris
More information about the llvm-commits
mailing list