title: Does the -loop-unroll pass force LLVM to unroll loops?
body: <p>I have a piece of code and I want LLVM to unroll all loops in it by a certain factor. I'm using the following command:</p>
  
  <p><code>opt -mem2reg -simplifycfg -loops -lcssa -loop-simplify -loop-rotate -loop-unroll -unroll-count=3 -unroll-allow-partial -debug TrainingCode/trainingCode.ll -o TrainingCode/unrolledTrainingCode.bc</code></p>
  
  <p>Specifically, the <code>-loop-unroll</code> and <code>-unroll-count=3</code> handle the loop unrolling stuff - the rest just transforms the code so that LLVM can unroll the code.</p>
  
  <p>Does this command guarantee that all loops will be unrolled by a factor of 3? Or is it more like using pragma statements with GCC, which the compiler can choose to ignore if it deems non-optimal? In other words, do the <code>-loop-unroll</code> and <code>-unroll-count=3</code> passes <em>force</em> the compiler to use an unroll factor of 3 or is it more of a "hint" the compiler can choose to ignore?</p>