1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
4 %ptr.struct = type { ptr, ptr, ptr }
6 define internal void @child(ptr %this, ptr %y, ptr %x) {
7 ; CHECK-LABEL: define internal void @child
8 ; CHECK-SAME: (ptr [[Y:%.*]], half [[X_0_VAL:%.*]]) {
10 ; CHECK-NEXT: store half [[X_0_VAL]], ptr [[Y]], align 2
11 ; CHECK-NEXT: ret void
14 %0 = load half, ptr %x
19 define internal void @parent(ptr %this, ptr %p1, ptr %p2) {
20 ; CHECK-LABEL: define internal void @parent
21 ; CHECK-SAME: (ptr [[P1:%.*]], ptr [[P2:%.*]]) {
23 ; CHECK-NEXT: [[P2_VAL2:%.*]] = load half, ptr [[P2]], align 2
24 ; CHECK-NEXT: call void @child(ptr [[P1]], half [[P2_VAL2]])
25 ; CHECK-NEXT: [[P2_VAL1:%.*]] = load half, ptr [[P2]], align 2
26 ; CHECK-NEXT: call void @child(ptr [[P1]], half [[P2_VAL1]])
27 ; CHECK-NEXT: [[P2_VAL:%.*]] = load half, ptr [[P2]], align 2
28 ; CHECK-NEXT: call void @child(ptr [[P1]], half [[P2_VAL]])
29 ; CHECK-NEXT: ret void
32 %src_element_op_0 = getelementptr ptr, ptr %this, i64 0
33 %load0 = load ptr, ptr %src_element_op_0
34 call void @child(ptr %load0, ptr %p1, ptr %p2)
35 %src_element_op_1 = getelementptr ptr, ptr %this, i64 1
36 %load1 = load ptr, ptr %src_element_op_1
37 call void @child(ptr %load1, ptr %p1, ptr %p2)
38 %src_element_op_2 = getelementptr ptr, ptr %this, i64 2
39 %load2 = load ptr, ptr %src_element_op_2
40 call void @child(ptr %load2, ptr %p1, ptr %p2)
44 define void @grandparent() {
45 ; CHECK-LABEL: define void @grandparent() {
47 ; CHECK-NEXT: [[XPTR:%.*]] = alloca i32, align 4
48 ; CHECK-NEXT: [[YPTR:%.*]] = alloca i32, align 4
49 ; CHECK-NEXT: call void @parent(ptr [[XPTR]], ptr [[YPTR]])
50 ; CHECK-NEXT: ret void
53 %f = alloca %ptr.struct
56 call void @parent(ptr %f, ptr %xptr, ptr %yptr)
60 define internal ptr @callee(ptr %dead) {
61 ; CHECK-LABEL: define internal ptr @callee() {
62 ; CHECK-NEXT: ret ptr null
67 define void @caller() {
68 ; CHECK-LABEL: define void @caller() {
69 ; CHECK-NEXT: [[TMP1:%.*]] = call ptr @callee()
70 ; CHECK-NEXT: [[TMP2:%.*]] = call ptr @callee()
71 ; CHECK-NEXT: ret void
73 %ret = call ptr @callee(ptr null)
74 %ret2 = call ptr @callee(ptr %ret)