Alex Susu via llvm-dev
2017-Feb-23 14:41 UTC
[llvm-dev] Post-register allocation MachineLICM does not optimize loops
Hello. I want to avoid running the pre-register allocation (pre-RA) MachineLICM pass, since it can "destroy" some sequences of instructions that should be bundled together (and it seems LLVM, by design, does NOT allow to bundle MachineInstr instructions before the pre-RA MachineLICM pass). So I disabled the pre-RA LICM by always giving llc -disable-machine-licm. I've also applied all possible passes subarguments for the post-register allocation (post-RA) MachineLICM pass without any success: -hoist-cheap-insts - MachineLICM should hoist even cheap instructions -disable-licm-promotion - Disable memory promotion in LICM pass -sink-insts-to-avoid-spills - MachineLICM should sink instructions into loops to avoid register spills -avoid-speculation - MachineLICM should avoid speculation (Note that llc has some other arguments related to hoisting that I did not yet use.) With any of these arguments I always obtain the following UNoptimized loop assembly code: REPEAT_X_TIMES(numRowsCols) R(3) = 1 ;; this instruction is a loop invariant and should be moved before the loop R(5) = LS[R(0)] ... R(1) = R(1) + R(3) END_REPEAT Could you please tell me if I can optimize this kind of loops with the post-RA MachineLICM? Thank you very much, Alex