title: Loop unrolling in clang
body: <p>I am trying to selectively unroll the second loop in the following program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int in[1000], out[1000]; 
      int i,j;
  
      #pragma nounroll
      for (i = 100; i &lt; 1000; i++)
      {
         in[i]+= 10;
      }
  
      #pragma unroll 2
      for (j = 100; j &lt; 1000; j++)
      {
         out[j]+= 10;
      }
  
      return 1;
  }
  </code></pre>
  
  <p>When I run clang (3.5) with the following options, it unrolls both the loops 4 times.</p>
  
  <pre><code>clang -std=c++11 -O3 -fno-slp-vectorize -fno-vectorize -mllvm -unroll-count=4 -mllvm -debug-pass=Arguments -emit-llvm -c *.cpp 
  </code></pre>
  
  <p>What am I doing wrong? Also, if I add <code>-fno-unroll-loops</code>, or skip the <code>-unroll-count=4</code> flag, it does not unroll any loop.</p>
  
  <p>Also, any hints on how to debug pragma errors?</p>