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+
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