[llvm-bugs] [Bug 51178] New: support runtime loop unroll with pointer type

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 23 03:33:38 PDT 2021


            Bug ID: 51178
           Summary: support runtime loop unroll with pointer type
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: jaykang10 at gmail.com
                CC: llvm-bugs at lists.llvm.org

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) {
  %s.addr.a = getelementptr i8, i8* %s, i64 %a
  br label %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

  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 -

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210723/837cb02d/attachment.html>

More information about the llvm-bugs mailing list