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 @may_not_return()
6 ; The argument cannot be promoted, as we do not know whether the load can be
7 ; speculatively executed.
9 define internal i32 @callee(ptr %p) {
10 ; CHECK-LABEL: define {{[^@]+}}@callee
11 ; CHECK-SAME: (ptr [[P:%.*]]) {
12 ; CHECK-NEXT: call void @may_not_return()
13 ; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
14 ; CHECK-NEXT: ret i32 [[X]]
16 call void @may_not_return() readnone
21 define void @caller(ptr %p) {
22 ; CHECK-LABEL: define {{[^@]+}}@caller
23 ; CHECK-SAME: (ptr [[P:%.*]]) {
24 ; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee(ptr [[P]])
25 ; CHECK-NEXT: ret void
27 call i32 @callee(ptr %p)