1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=indvars -S < %s | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
5 target triple = "x86_64-unknown-linux-gnu"
7 define void @test(i1 %arg) personality ptr @snork {
10 ; CHECK-NEXT: br label [[BB4:%.*]]
12 ; CHECK-NEXT: [[INDVARS_IV_NEXT:%.*]] = add i32 [[INDVARS_IV:%.*]], 1
13 ; CHECK-NEXT: [[TMP0:%.*]] = sub i32 [[TMP1:%.*]], [[SMAX:%.*]]
14 ; CHECK-NEXT: br i1 [[ARG:%.*]], label [[BB2:%.*]], label [[BB4]]
16 ; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP0]], [[BB1:%.*]] ]
17 ; CHECK-NEXT: ret void
19 ; CHECK-NEXT: [[INDVARS_IV]] = phi i32 [ [[INDVARS_IV_NEXT]], [[BB1]] ], [ undef, [[BB:%.*]] ]
20 ; CHECK-NEXT: [[SMAX]] = call i32 @llvm.smax.i32(i32 [[INDVARS_IV]], i32 36)
21 ; CHECK-NEXT: [[TMP6:%.*]] = invoke i32 @quux() [ "deopt"(i32 0, i32 0, i32 0, i32 180, i32 0, i32 25, i32 0, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 3, i32 [[INDVARS_IV]], i32 3, i32 undef, i32 7, ptr null, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 4, double undef, i32 7, ptr null, i32 4, i64 undef, i32 7, ptr null, i32 0, ptr addrspace(1) undef, i32 3, i32 undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 7, ptr null) ]
22 ; CHECK-NEXT: to label [[BB7:%.*]] unwind label [[BB15:%.*]]
24 ; CHECK-NEXT: [[TMP1]] = add i32 [[TMP6]], [[INDVARS_IV]]
25 ; CHECK-NEXT: br label [[BB9:%.*]]
27 ; CHECK-NEXT: br i1 true, label [[BB1]], label [[BB9]]
29 ; CHECK-NEXT: [[TMP16:%.*]] = landingpad { ptr, i32 }
31 ; CHECK-NEXT: ret void
38 %tmp = phi i32 [ %tmp12, %bb9 ]
39 br i1 %arg, label %bb2, label %bb4
42 %tmp3 = phi i32 [ %tmp, %bb1 ]
45 bb4: ; preds = %bb1, %bb
46 %tmp5 = phi i32 [ %tmp8, %bb1 ], [ undef, %bb ]
47 %tmp6 = invoke i32 @quux() #2 [ "deopt"(i32 0, i32 0, i32 0, i32 180, i32 0, i32 25, i32 0, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 3, i32 %tmp5, i32 3, i32 undef, i32 7, ptr null, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 4, double undef, i32 7, ptr null, i32 4, i64 undef, i32 7, ptr null, i32 0, ptr addrspace(1) undef, i32 3, i32 undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 7, ptr null) ]
48 to label %bb7 unwind label %bb15
51 %tmp8 = add nsw i32 %tmp5, 1
54 bb9: ; preds = %bb9, %bb7
55 %tmp10 = phi i32 [ %tmp5, %bb7 ], [ %tmp13, %bb9 ]
56 %tmp11 = phi i32 [ %tmp6, %bb7 ], [ %tmp12, %bb9 ]
57 %tmp12 = add i32 %tmp11, -1
58 %tmp13 = add nsw i32 %tmp10, 1
59 %tmp14 = icmp sgt i32 %tmp10, 35
60 br i1 %tmp14, label %bb1, label %bb9
63 %tmp16 = landingpad { ptr, i32 }