[IndVarSimplify] Partially revert r217953 to see if this fixes the bots.
[oota-llvm.git] / test / Transforms / LoopRotate / simplifylatch.ll
index f4227245f74bc3fdc376d2a26882d567fdd4eb1d..d646cb9d6cb2608fdc15b3a747b7ce1ba2dd5880 100644 (file)
@@ -1,9 +1,9 @@
-; RUN: opt -S < %s -loop-rotate -verify-dom-info -verify-loop-info | FileCheck %s
+; RUN: opt -S < %s -loop-rotate -licm -verify-dom-info -verify-loop-info | FileCheck %s
 ; PR2624 unroll multiple exits
 
 @mode_table = global [4 x i32] zeroinitializer         ; <[4 x i32]*> [#uses=1]
 
-; CHECK: @f
+; CHECK-LABEL: @f(
 ; CHECK-NOT: bb4
 define i8 @f() {
 entry:
@@ -37,3 +37,40 @@ bb5:         ; preds = %bb2
 declare i32 @fegetround()
 
 declare void @raise_exception() noreturn
+
+;CHECK: for.body.lr.ph:
+;CHECK-NEXT:  %arrayidx1 = getelementptr inbounds i8* %CurPtr, i64 0
+;CHECK-NEXT:  %0 = load i8* %arrayidx1, align 1
+;CHECK-NEXT:  %conv2 = sext i8 %0 to i32
+;CHECK-NEXT:  br label %for.body
+
+define i32 @foo(i8* %CurPtr, i32 %a) #0 {
+entry:
+  br label %for.cond
+
+for.cond:                                        ; preds = %for.inc, %entry
+  %i.0 = phi i32 [ 1, %entry ], [ %inc, %for.inc ]
+  %cmp = icmp ne i32 %i.0, %a
+  br i1 %cmp, label %for.body, label %return
+
+for.body:                                        ; preds = %for.cond
+  %idxprom = zext i32 %i.0 to i64
+  %arrayidx = getelementptr inbounds i8* %CurPtr, i64 %idxprom
+  %0 = load i8* %arrayidx, align 1
+  %conv = sext i8 %0 to i32
+  %arrayidx1 = getelementptr inbounds i8* %CurPtr, i64 0
+  %1 = load i8* %arrayidx1, align 1
+  %conv2 = sext i8 %1 to i32
+  %cmp3 = icmp ne i32 %conv, %conv2
+  br i1 %cmp3, label %return, label %for.inc
+
+for.inc:                                         ; preds = %for.body
+  %inc = add i32 %i.0, 1
+  br label %for.cond
+
+return:                                                  ; preds = %for.cond, %for.body
+  %retval.0 = phi i32 [ 0, %for.body ], [ 1, %for.cond ]
+  ret i32 %retval.0
+}
+
+attributes #0 = { nounwind uwtable }