[LLVMdev] IR Passes and TargetTransformInfo: Straw Man
clattner at apple.com
Tue Jul 30 21:44:36 PDT 2013
On Jul 30, 2013, at 10:19 AM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> The pro for running LICM early is that it may move big redundant stuff out of loop nest. You never know
> how big it is. In case you are lucky , you can move lot of stuff out of
> loop, the loop may become much smaller and hence enable lots of downstream optimizations. This sound
> to be a big win for control-intensive programs where Loop-nest-opt normally is a big, expensive no-op.
> The con side is that, as you said, the nest is not perfect any more. However, I would argue LNO optimizations
> should be able to tackle the cases when imperfect part is simple enough (say, no call, no control etc).
> (FYI, Open64's LNO is able to tackle imperfect nesting so long as imperfect part is simple). Or you just reverse
> the LICM, that dosen't sound hard.
FWIW, I completely agree with this. The canonical form should be that loop invariants are hoisted. Optimizations should not depend on perfect loops. This concept really only makes sense for Source/AST level transformations anyway, which don't apply at the LLVM IR level.
More information about the llvm-dev