<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - support runtime loop unroll with pointer type"
   href="https://bugs.llvm.org/show_bug.cgi?id=51178">51178</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>support runtime loop unroll with pointer type
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jaykang10@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The loop unroll pass does not support runtime loop unroll with pointer type.
Let's see a example.

declare i32 @foo(i8 *)

define void @test(i8* %s, i64 %a) {
entry:
  %s.addr.a = getelementptr i8, i8* %s, i64 %a
  br label %while.body.us

while.body.us:    
  %s.addr = phi i8* [ %incdec.ptr, %while.body.us ], [ %s, %entry ]
  %incdec.ptr = getelementptr inbounds i8, i8* %s.addr, i64 1
  %incdec.val = load i8, i8* %s.addr, align 1
  %cmp1 = icmp eq i8 %incdec.val, 10
  br i1 %cmp1, label %return.loopexit, label %while.body.us

return.loopexit:    
  ret void
}

As you can see, the iv's instruction is getelementptr and the pass fails to
runtime unroll the loop with the iv. You can reproduce it with below command.

opt  -loop-unroll -unroll-runtime above_ir_code_file.ll -S -o -</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>