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 ; Test argument promotion involving bitcasts.
8 define internal i32 @callee_basic(ptr %p) {
9 ; CHECK-LABEL: define {{[^@]+}}@callee_basic
10 ; CHECK-SAME: (i32 [[P_0_VAL:%.*]], i32 [[P_4_VAL:%.*]]) {
11 ; CHECK-NEXT: [[Z:%.*]] = add i32 [[P_0_VAL]], [[P_4_VAL]]
12 ; CHECK-NEXT: ret i32 [[Z]]
15 %p1 = getelementptr i8, ptr %p, i64 4
16 %y = load i32, ptr %p1
21 define void @caller_basic(ptr %p) {
22 ; CHECK-LABEL: define {{[^@]+}}@caller_basic
23 ; CHECK-SAME: (ptr [[P:%.*]]) {
24 ; CHECK-NEXT: [[P_VAL:%.*]] = load i32, ptr [[P]], align 4
25 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr i8, ptr [[P]], i64 4
26 ; CHECK-NEXT: [[P_VAL1:%.*]] = load i32, ptr [[TMP2]], align 4
27 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @callee_basic(i32 [[P_VAL]], i32 [[P_VAL1]])
28 ; CHECK-NEXT: ret void
30 call i32 @callee_basic(ptr %p)
34 define internal i32 @callee_opaque(ptr %p) {
35 ; CHECK-LABEL: define {{[^@]+}}@callee_opaque
36 ; CHECK-SAME: (i32 [[P_0_VAL:%.*]], i32 [[P_4_VAL:%.*]]) {
37 ; CHECK-NEXT: [[Z:%.*]] = add i32 [[P_0_VAL]], [[P_4_VAL]]
38 ; CHECK-NEXT: ret i32 [[Z]]
41 %p1.32 = getelementptr i32, ptr %p, i64 1
42 %y = load i32, ptr %p1.32
47 define void @caller_opaque(ptr %p) {
48 ; CHECK-LABEL: define {{[^@]+}}@caller_opaque
49 ; CHECK-SAME: (ptr [[P:%.*]]) {
50 ; CHECK-NEXT: [[P_VAL:%.*]] = load i32, ptr [[P]], align 4
51 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr i8, ptr [[P]], i64 4
52 ; CHECK-NEXT: [[P_VAL1:%.*]] = load i32, ptr [[TMP3]], align 4
53 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @callee_opaque(i32 [[P_VAL]], i32 [[P_VAL1]])
54 ; CHECK-NEXT: ret void
56 call i32 @callee_opaque(ptr %p)