1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -indvars -S | FileCheck %s
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4 target triple = "i386-apple-darwin10.0"
6 ; We make sinking here, Changed flag should be set properly.
7 define i32 @test(i32 %a, i32 %b, i32 %N) {
10 ; CHECK-NEXT: br label [[LOOP:%.*]]
12 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]
13 ; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1
14 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[IV_NEXT]], [[N:%.*]]
15 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP]], label [[EXIT:%.*]]
17 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A:%.*]], [[B:%.*]]
18 ; CHECK-NEXT: ret i32 [[ADD]]
25 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
26 %iv.next = add i32 %iv, 1
27 %cmp = icmp slt i32 %iv.next, %N
28 br i1 %cmp, label %loop, label %exit