[LLVMbugs] [Bug 13287] New: Loop unroll pass produce invalid code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 6 12:33:31 PDT 2012


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

             Bug #: 13287
           Summary: Loop unroll pass produce invalid code
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: css20 at mail.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8837
  --> http://llvm.org/bugs/attachment.cgi?id=8837
Test-case

Before optimization:

; <label>:15                                      ; preds = %15, %14
  %16 = phi i32 [ 1741056371, %14 ], [ %30, %15 ]
  %17 = phi i64 [ 0, %14 ], [ %31, %15 ]
  %18 = trunc i64 %17 to i32
  %19 = shl i64 %17, 2
  %20 = getelementptr [12 x i8]* @1, i64 0, i64 %19
  %21 = bitcast i8* %20 to i32*
  %22 = load i32* %21, align 4
  %23 = xor i32 %22, %16
  store i32 %23, i32* %21, align 4
  %24 = and i32 %18, 31
  %25 = shl i32 %16, %24
  %26 = sub i32 32, %24
  %27 = lshr i32 %16, %26
  %28 = or i32 %27, %25
  %29 = xor i32 %23, -1
  %30 = mul i32 %28, %29
  %31 = add i64 %17, 1
  %32 = icmp eq i64 %31, 2
  br i1 %32, label %33, label %15

After opt -loop-unroll:

; <label>:15                                      ; preds = %14
  %16 = load i32* bitcast ([12 x i8]* @1 to i32*), align 4
  %17 = xor i32 %16, 1741056371
  store i32 %17, i32* bitcast ([12 x i8]* @1 to i32*), align 4
  %18 = xor i32 %17, -1
  %19 = mul i32 -1, %18
  %20 = load i32* bitcast (i8* getelementptr inbounds ([12 x i8]* @1, i64 0,
i64 4) to i32*), align 4
  %21 = xor i32 %20, %19
  store i32 %21, i32* bitcast (i8* getelementptr inbounds ([12 x i8]* @1, i64
0, i64 4) to i32*), align 4
  %22 = shl i32 %19, 1
  %23 = lshr i32 %19, 31
  %24 = or i32 %23, %22
  %25 = xor i32 %21, -1
  %26 = load i8* getelementptr inbounds ([12 x i8]* @1, i64 0, i64 11), align 1
  %27 = or i8 %26, 8
  store i8 %27, i8* getelementptr inbounds ([12 x i8]* @1, i64 0, i64 11),
align 1
  br label %29

2-iteration Loop has been reduced to one iteration.

-- 
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.



More information about the llvm-bugs mailing list