1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=indvars -S < %s | FileCheck %s
5 define i2 @iv_hoist_nsw_poison(i2 %arg) {
6 ; CHECK-LABEL: @iv_hoist_nsw_poison(
8 ; CHECK-NEXT: br label [[BB1:%.*]]
10 ; CHECK-NEXT: [[DOT07:%.*]] = phi i2 [ 1, [[BB:%.*]] ], [ [[I:%.*]], [[BB1]] ]
11 ; CHECK-NEXT: [[I]] = add nuw i2 [[DOT07]], 1
12 ; CHECK-NEXT: [[DOTNOT_NOT:%.*]] = icmp ult i2 1, [[ARG:%.*]]
13 ; CHECK-NEXT: br i1 [[DOTNOT_NOT]], label [[COMMON_RET:%.*]], label [[BB1]]
15 ; CHECK-NEXT: [[I2_LCSSA:%.*]] = phi i2 [ [[I]], [[BB1]] ]
16 ; CHECK-NEXT: ret i2 [[I2_LCSSA]]
21 bb1: ; preds = %bb1, %bb
22 %.07 = phi i2 [ 1, %bb ], [ %i, %bb1 ]
23 %.0 = phi i2 [ 1, %bb ], [ %i2, %bb1 ]
24 %i = add nsw i2 %.07, 1
26 %.not.not = icmp ult i2 %.07, %arg
27 br i1 %.not.not, label %common.ret, label %bb1
29 common.ret: ; preds = %bb1