brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 6f2c322 Raw
59 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes2; RUN: opt -S -passes=argpromotion < %s | FileCheck %s3 4; Test argument promotion involving bitcasts.5 6%opaque = type opaque7 8define internal i32 @callee_basic(ptr %p) {9; CHECK-LABEL: define {{[^@]+}}@callee_basic10; 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]]13;14  %x = load i32, ptr %p15  %p1 = getelementptr i8, ptr %p, i64 416  %y = load i32, ptr %p117  %z = add i32 %x, %y18  ret i32 %z19}20 21define void @caller_basic(ptr %p) {22; CHECK-LABEL: define {{[^@]+}}@caller_basic23; CHECK-SAME: (ptr [[P:%.*]]) {24; CHECK-NEXT:    [[P_VAL:%.*]] = load i32, ptr [[P]], align 425; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i8, ptr [[P]], i64 426; CHECK-NEXT:    [[P_VAL1:%.*]] = load i32, ptr [[TMP2]], align 427; CHECK-NEXT:    [[TMP4:%.*]] = call i32 @callee_basic(i32 [[P_VAL]], i32 [[P_VAL1]])28; CHECK-NEXT:    ret void29;30  call i32 @callee_basic(ptr %p)31  ret void32}33 34define internal i32 @callee_opaque(ptr %p) {35; CHECK-LABEL: define {{[^@]+}}@callee_opaque36; 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]]39;40  %x = load i32, ptr %p41  %p1.32 = getelementptr i32, ptr %p, i64 142  %y = load i32, ptr %p1.3243  %z = add i32 %x, %y44  ret i32 %z45}46 47define void @caller_opaque(ptr %p) {48; CHECK-LABEL: define {{[^@]+}}@caller_opaque49; CHECK-SAME: (ptr [[P:%.*]]) {50; CHECK-NEXT:    [[P_VAL:%.*]] = load i32, ptr [[P]], align 451; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i8, ptr [[P]], i64 452; CHECK-NEXT:    [[P_VAL1:%.*]] = load i32, ptr [[TMP3]], align 453; CHECK-NEXT:    [[TMP5:%.*]] = call i32 @callee_opaque(i32 [[P_VAL]], i32 [[P_VAL1]])54; CHECK-NEXT:    ret void55;56  call i32 @callee_opaque(ptr %p)57  ret void58}59