1 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
3 ; Store instructions are allowed users for byval arguments only.
4 define internal void @callee(ptr %arg) nounwind {
5 ; CHECK-LABEL: define {{[^@]+}}@callee
6 ; CHECK-SAME: (ptr [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
8 ; CHECK-NEXT: [[TEMP:%.*]] = load i32, ptr [[ARG]], align 4
9 ; CHECK-NEXT: [[SUM:%.*]] = add i32 [[TEMP]], 1
10 ; CHECK-NEXT: store i32 [[SUM]], ptr [[ARG]], align 4
11 ; CHECK-NEXT: ret void
14 %temp = load i32, ptr %arg, align 4
15 %sum = add i32 %temp, 1
16 store i32 %sum, ptr %arg, align 4
20 define i32 @caller(ptr %arg) nounwind {
21 ; CHECK-LABEL: define {{[^@]+}}@caller
22 ; CHECK-SAME: (ptr [[ARG:%.*]]) #[[ATTR0]] {
24 ; CHECK-NEXT: call void @callee(ptr [[ARG]]) #[[ATTR0]]
25 ; CHECK-NEXT: ret i32 0
28 call void @callee(ptr %arg) nounwind