http://llvm.org/bugs/show_bug.cgi?id=14432

             Bug #: 14432
           Summary: -indvars generates infinite loop
           Product: libraries
           Version: 3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


Created attachment 9594
  --> http://llvm.org/bugs/attachment.cgi?id=9594
test case, compile with "opt -indvars".

The attached .ll file seems to trigger a bug in -indvars with LLVM 3.1, the 3.2
branch (r168527) and SVN trunk (r168548):

In this loop:
---
forcond38:
  %__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
  %tmp46 = icmp slt i32 %__key8.0, 10
  br i1 %tmp46, label %forbody39, label %unrolledend

forbody39:
  %tmp51 = sdiv i32 32767, %__key8.0
  %tmp57 = sdiv i32 -32768, %__key8.0
  %sext33 = shl i32 %tmp51, 16
  %sext = shl i32 %tmp51, 16
  %tmp66 = icmp eq i32 %sext33, %sext
  br i1 %tmp66, label %noassert68, label %assert67

assert67:
  tail call void @llvm.trap()
  unreachable

noassert68:
  %sext34 = shl i32 %tmp57, 16
  %sext21 = shl i32 %tmp57, 16
  %tmp76 = icmp eq i32 %sext34, %sext21
  %tmp81 = add i32 %__key8.0, 1
  br i1 %tmp76, label %forcond38, label %assert77

assert77:                                         ; preds = %noassert68
  tail call void @llvm.trap()
  unreachable

unrolledend:                                      ; preds = %forcond38
  ret i32 0
---

-indvars replaces the loop condition with an unconditional jump:

---
-  %tmp46 = icmp slt i32 %__key8.0, 10
-  br i1 %tmp46, label %forbody39, label %unrolledend
+  br i1 true, label %forbody39, label %unrolledend
---

It would be great if somebody could have a look at this before the 3.2 release,
because this effectively causes a regression in the LDC test suite compared to
LLVM 3.1.

Sorry for the slightly big test case, but bugpoint crashes and I'm not sure if
I'll be able to have another look at the issue before the end of the first
release testing phase.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to