1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=ipsccp -S %s | FileCheck %s
6 define void @spam(ptr %arg) {
9 ; CHECK-NEXT: call void @blam(i32 0, ptr nonnull [[ARG:%.*]])
10 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [4 x [24 x float]], ptr [[ARG]], i64 0, i64 1, i64 0
11 ; CHECK-NEXT: call void @blam(i32 1, ptr nonnull [[TMP1]])
12 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [4 x [24 x float]], ptr [[ARG]], i64 0, i64 2, i64 0
13 ; CHECK-NEXT: call void @blam(i32 2, ptr nonnull [[TMP2]])
14 ; CHECK-NEXT: ret void
17 call void @blam(i32 0, ptr nonnull %arg)
18 %tmp1 = getelementptr inbounds [4 x [24 x float]], ptr %arg, i64 0, i64 1, i64 0
19 call void @blam(i32 1, ptr nonnull %tmp1)
20 %tmp2 = getelementptr inbounds [4 x [24 x float]], ptr %arg, i64 0, i64 2, i64 0
21 call void @blam(i32 2, ptr nonnull %tmp2)
25 ; Make sure we do not incorrectly eliminate the checks in @blam.
26 define internal void @blam(i32 %arg, ptr nocapture %arg1) {
27 ; CHECK-LABEL: define {{.*}} @blam(
29 ; CHECK-NEXT: [[TMP:%.*]] = icmp eq i32 [[ARG:%.*]], 0
30 ; CHECK-NEXT: br i1 [[TMP]], label [[BB2:%.*]], label [[BB3:%.*]]
32 ; CHECK-NEXT: br label [[BB5:%.*]]
34 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[ARG]], 2
35 ; CHECK-NEXT: br i1 [[TMP4]], label [[BB5]], label [[BB6:%.*]]
37 ; CHECK-NEXT: ret void
39 ; CHECK-NEXT: ret void
42 %tmp = icmp eq i32 %arg, 0
43 br i1 %tmp, label %bb2, label %bb3
49 %tmp4 = icmp eq i32 %arg, 2
50 br i1 %tmp4, label %bb5, label %bb6
52 bb5: ; preds = %bb3, %bb2