LLVM unable to unroll loops [Can't unroll; loop not terminated by a conditional branch]

前端 未结 1 1057
清酒与你
清酒与你 2021-01-16 14:08


I am getting an error Can\'t unroll; loop not terminated by a conditional branch for the following code:
for(i=0 ; j<10 && i<5 ; i+

相关标签:
1条回答
  • 2021-01-16 14:56

    use this command and it should work (I have tested it on LLVM 3.6 and 3.7)

        opt -mem2reg  -simplifycfg  -loops  -lcssa -loop-simplify -loop-rotate   
    -loop-unroll -unroll-count=3 -unroll-allow-partial -debug a.bc -o a.loop.bc
    

    you need first of all mem2reg to have your bitcode converted to SSA from (if it is not already), in the other hand the loop has two conditional exiting branches and one unconditional backedge, so simplifycfg seems helpful to transform it to one-conditional backedge form which can be handled by unroll pass

    0 讨论(0)
提交回复
热议问题