1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
4 declare void @use.i32(i32)
5 declare void @use.p32(ptr)
7 define internal void @callee(ptr %p1, ptr %p2, ptr %p3, ptr %p4, ptr %p5, ptr %p6, ptr %p7, ptr %p8, ptr %p9, ptr %p10) {
8 ; CHECK-LABEL: define {{[^@]+}}@callee
9 ; CHECK-SAME: (i32 [[P1_0_VAL:%.*]], i32 [[P2_0_VAL:%.*]], ptr [[P3_0_VAL:%.*]], ptr [[P4_0_VAL:%.*]], ptr [[P5_0_VAL:%.*]], ptr [[P6_0_VAL:%.*]], ptr [[P7_0_VAL:%.*]], ptr [[P8_0_VAL:%.*]], ptr [[P9_0_VAL:%.*]], ptr [[P10_0_VAL:%.*]]) {
10 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[P4_0_VAL]], null
11 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP1]])
12 ; CHECK-NEXT: call void @use.i32(i32 [[P1_0_VAL]])
13 ; CHECK-NEXT: call void @use.i32(i32 [[P2_0_VAL]])
14 ; CHECK-NEXT: call void @use.p32(ptr [[P3_0_VAL]])
15 ; CHECK-NEXT: call void @use.p32(ptr [[P4_0_VAL]])
16 ; CHECK-NEXT: call void @use.p32(ptr [[P5_0_VAL]])
17 ; CHECK-NEXT: call void @use.p32(ptr [[P6_0_VAL]])
18 ; CHECK-NEXT: call void @use.p32(ptr [[P7_0_VAL]])
19 ; CHECK-NEXT: call void @use.p32(ptr [[P8_0_VAL]])
20 ; CHECK-NEXT: call void @use.p32(ptr [[P9_0_VAL]])
21 ; CHECK-NEXT: call void @use.p32(ptr [[P10_0_VAL]])
22 ; CHECK-NEXT: ret void
24 %v1 = load i32, ptr %p1, !range !0
25 %v2 = load i32, ptr %p2, !range !0, !noundef !1
26 %v3 = load ptr, ptr %p3, !nonnull !1
27 %v4 = load ptr, ptr %p4, !nonnull !1, !noundef !1
28 %v5 = load ptr, ptr %p5, !dereferenceable !2
29 %v6 = load ptr, ptr %p6, !dereferenceable_or_null !2
30 %v7 = load ptr, ptr %p7, !align !3
31 %v8 = load ptr, ptr %p8, !align !3, !noundef !1
32 %v9 = load ptr, ptr %p9, !noundef !1
33 %v10 = load ptr, ptr %p10, !nontemporal !4
34 call void @use.i32(i32 %v1)
35 call void @use.i32(i32 %v2)
36 call void @use.p32(ptr %v3)
37 call void @use.p32(ptr %v4)
38 call void @use.p32(ptr %v5)
39 call void @use.p32(ptr %v6)
40 call void @use.p32(ptr %v7)
41 call void @use.p32(ptr %v8)
42 call void @use.p32(ptr %v9)
43 call void @use.p32(ptr %v10)
47 define void @caller(ptr %p1, ptr %p2, ptr %p3, ptr %p4, ptr %p5, ptr %p6, ptr %p7, ptr %p8, ptr %p9, ptr %p10) {
48 ; CHECK-LABEL: define {{[^@]+}}@caller
49 ; CHECK-SAME: (ptr [[P1:%.*]], ptr [[P2:%.*]], ptr [[P3:%.*]], ptr [[P4:%.*]], ptr [[P5:%.*]], ptr [[P6:%.*]], ptr [[P7:%.*]], ptr [[P8:%.*]], ptr [[P9:%.*]], ptr [[P10:%.*]]) {
50 ; CHECK-NEXT: [[P1_VAL:%.*]] = load i32, ptr [[P1]], align 4
51 ; CHECK-NEXT: [[P2_VAL:%.*]] = load i32, ptr [[P2]], align 4, !range [[RNG0:![0-9]+]], !noundef !1
52 ; CHECK-NEXT: [[P3_VAL:%.*]] = load ptr, ptr [[P3]], align 8
53 ; CHECK-NEXT: [[P4_VAL:%.*]] = load ptr, ptr [[P4]], align 8, !nonnull !1, !noundef !1
54 ; CHECK-NEXT: [[P5_VAL:%.*]] = load ptr, ptr [[P5]], align 8, !dereferenceable !2
55 ; CHECK-NEXT: [[P6_VAL:%.*]] = load ptr, ptr [[P6]], align 8, !dereferenceable_or_null !2
56 ; CHECK-NEXT: [[P7_VAL:%.*]] = load ptr, ptr [[P7]], align 8
57 ; CHECK-NEXT: [[P8_VAL:%.*]] = load ptr, ptr [[P8]], align 8, !align !3, !noundef !1
58 ; CHECK-NEXT: [[P9_VAL:%.*]] = load ptr, ptr [[P9]], align 8, !noundef !1
59 ; CHECK-NEXT: [[P10_VAL:%.*]] = load ptr, ptr [[P10]], align 8, !nontemporal !4
60 ; CHECK-NEXT: call void @callee(i32 [[P1_VAL]], i32 [[P2_VAL]], ptr [[P3_VAL]], ptr [[P4_VAL]], ptr [[P5_VAL]], ptr [[P6_VAL]], ptr [[P7_VAL]], ptr [[P8_VAL]], ptr [[P9_VAL]], ptr [[P10_VAL]])
61 ; CHECK-NEXT: ret void
63 call void @callee(ptr %p1, ptr %p2, ptr %p3, ptr %p4, ptr %p5, ptr %p6, ptr %p7, ptr %p8, ptr %p9, ptr %p10)
67 define internal ptr @callee_conditional(i1 %c, ptr dereferenceable(8) align 8 %p) {
68 ; CHECK-LABEL: define {{[^@]+}}@callee_conditional
69 ; CHECK-SAME: (i1 [[C:%.*]], ptr [[P_0_VAL:%.*]]) {
70 ; CHECK-NEXT: br i1 [[C]], label [[IF:%.*]], label [[ELSE:%.*]]
72 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[P_0_VAL]], null
73 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP1]])
74 ; CHECK-NEXT: ret ptr [[P_0_VAL]]
76 ; CHECK-NEXT: ret ptr null
78 br i1 %c, label %if, label %else
81 %v = load ptr, ptr %p, !nonnull !1, !noundef !1
88 define void @caller_conditional(i1 %c, ptr %p) {
89 ; CHECK-LABEL: define {{[^@]+}}@caller_conditional
90 ; CHECK-SAME: (i1 [[C:%.*]], ptr [[P:%.*]]) {
91 ; CHECK-NEXT: [[P_VAL:%.*]] = load ptr, ptr [[P]], align 8
92 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr @callee_conditional(i1 [[C]], ptr [[P_VAL]])
93 ; CHECK-NEXT: ret void
95 call ptr @callee_conditional(i1 %c, ptr %p)