1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=ipsccp -S %s | FileCheck %s
4 declare noalias i8* @malloc(i64)
6 ; Make sure we can eliminate `%tmp17 = icmp ult i32 %tmp10, 3`.
10 define internal i32* @spam(i32* %arg) {
13 ; CHECK-NEXT: [[TMP:%.*]] = call i8* @malloc(i64 10368)
14 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP]] to i32*
15 ; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[ARG:%.*]], i32 0
16 ; CHECK-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP4]], align 8
17 ; CHECK-NEXT: [[TMP6:%.*]] = add i32 [[TMP5]], 1
18 ; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i32, i32* [[ARG]], i32 1
19 ; CHECK-NEXT: [[TMP10:%.*]] = icmp ne i32* [[TMP7]], null
20 ; CHECK-NEXT: br i1 [[TMP10]], label [[BB17:%.*]], label [[BB13:%.*]]
22 ; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i32, i32* [[ARG]], i32 2
23 ; CHECK-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP14]], align 8
24 ; CHECK-NEXT: [[TMP16:%.*]] = add i32 [[TMP15]], 1
25 ; CHECK-NEXT: br label [[BB30:%.*]]
27 ; CHECK-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP6]], [[TMP5]]
28 ; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i32, i32* [[ARG]], i32 3
29 ; CHECK-NEXT: [[TMP20:%.*]] = load i32, i32* [[TMP19]], align 8
30 ; CHECK-NEXT: br i1 [[TMP18]], label [[BB30]], label [[BB13]]
32 ; CHECK-NEXT: ret i32* [[TMP1]]
35 %tmp = call i8* @malloc(i64 10368)
36 %tmp1 = bitcast i8* %tmp to i32*
37 %tmp4 = getelementptr inbounds i32, i32* %arg, i32 0
38 %tmp5 = load i32, i32* %tmp4, align 8
39 %tmp6 = add i32 %tmp5, 1
40 %tmp7 = getelementptr inbounds i32, i32* %arg, i32 1
41 %tmp10 = icmp ne i32* %tmp7, null
42 br i1 %tmp10, label %bb17, label %bb13
45 %tmp14 = getelementptr inbounds i32, i32* %arg, i32 2
46 %tmp15 = load i32, i32* %tmp14, align 8
47 %tmp16 = add i32 %tmp15, 1
51 %tmp18 = icmp eq i32 %tmp6, %tmp5
52 %tmp19 = getelementptr inbounds i32, i32* %arg, i32 3
53 %tmp20 = load i32, i32* %tmp19, align 8
54 br i1 %tmp18, label %bb30, label %bb13
60 define void @spam.1(i32* %arg) {
62 %tmp = alloca i8*, align 8
63 %tmp4 = call i32* @spam(i32* %arg)
67 %tmp7 = getelementptr inbounds i32, i32* %tmp4, i32 1
68 %tmp10 = load i32, i32* %tmp7, align 8
69 %tmp11 = icmp ne i32 %tmp10, 0
70 br i1 %tmp11, label %bb6, label %bb15
73 %tmp17 = icmp ult i32 %tmp10, 3
74 call void @use(i1 %tmp17)
75 br i1 %tmp17, label %bb6, label %bb24