1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -passes=ipsccp -S %s | FileCheck %s
6 define void @spam(ptr %arg) {
7 ; CHECK-LABEL: define void @spam(
8 ; CHECK-SAME: ptr [[ARG:%.*]]) {
9 ; CHECK-NEXT: [[BB:.*:]]
10 ; CHECK-NEXT: call void @blam(i32 0, ptr nonnull [[ARG]])
11 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw [4 x [24 x float]], ptr [[ARG]], i64 0, i64 1, i64 0
12 ; CHECK-NEXT: call void @blam(i32 1, ptr nonnull [[TMP1]])
13 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4 x [24 x float]], ptr [[ARG]], i64 0, i64 2, i64 0
14 ; CHECK-NEXT: call void @blam(i32 2, ptr nonnull [[TMP2]])
15 ; CHECK-NEXT: ret void
18 call void @blam(i32 0, ptr nonnull %arg)
19 %tmp1 = getelementptr inbounds [4 x [24 x float]], ptr %arg, i64 0, i64 1, i64 0
20 call void @blam(i32 1, ptr nonnull %tmp1)
21 %tmp2 = getelementptr inbounds [4 x [24 x float]], ptr %arg, i64 0, i64 2, i64 0
22 call void @blam(i32 2, ptr nonnull %tmp2)
26 ; Make sure we do not incorrectly eliminate the checks in @blam.
27 define internal void @blam(i32 %arg, ptr nocapture %arg1) {
28 ; CHECK-LABEL: define internal void @blam(
29 ; CHECK-SAME: i32 range(i32 0, 3) [[ARG:%.*]], ptr nocapture [[ARG1:%.*]]) {
30 ; CHECK-NEXT: [[BB:.*:]]
31 ; CHECK-NEXT: [[TMP:%.*]] = icmp eq i32 [[ARG]], 0
32 ; CHECK-NEXT: br i1 [[TMP]], label %[[BB2:.*]], label %[[BB3:.*]]
34 ; CHECK-NEXT: br label %[[BB5:.*]]
36 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[ARG]], 2
37 ; CHECK-NEXT: br i1 [[TMP4]], label %[[BB5]], label %[[BB6:.*]]
39 ; CHECK-NEXT: ret void
41 ; CHECK-NEXT: ret void
44 %tmp = icmp eq i32 %arg, 0
45 br i1 %tmp, label %bb2, label %bb3
51 %tmp4 = icmp eq i32 %arg, 2
52 br i1 %tmp4, label %bb5, label %bb6
54 bb5: ; preds = %bb3, %bb2