I want to perform optimizations available in opt on already optimized IR (via O1,O2,O3).
when I used O3 with opt, i get different performance as compared to clang -O3.
So, now i m first optimizing IR with clang O3 then using opt available optimizations as follows;
$LLVM_BIN/opt -O3 wc-O3.ll -S -o wc-O3-op.ll
$LLVM_BIN/opt -disable-loop-unrolling wc-O3-op.ll -S -o wc-O3-op2.ll
Is this the right approach?
Clang applies different options to the pass manager builder than opt
does, which may explain the difference in performance.
If LoopUnrolling considered the IR worthy for unrolling, it will
already have been unrolled in wc-O3.ll. It should never unroll an
already unrolled loop again or unroll a loop it did not consider
profitable in a previous run. That is, applying
-disable-loop-unrolling retroactively will have no effect (in the
majority of cases).