; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
; RUN: opt < %s -passes=argpromotion -S -pass-remarks-output=%t | FileCheck %s
; RUN: cat %t | FileCheck -check-prefix=REMARK %s
define internal i32 @deref(ptr %x) nounwind {
; CHECK-LABEL: define {{[^@]+}}@deref
; CHECK-SAME: (i32 [[X_0_VAL:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 [[X_0_VAL]]
;
; REMARK-LABEL: Function: deref
; REMARK: Args:
; REMARK-NEXT: - String: 'promoting argument '
; REMARK-NEXT: - ArgName: x
; REMARK-NEXT: - String: '('
; REMARK-NEXT: - ArgIndex: '0'
; REMARK-NEXT: - String: ')'
; REMARK-NEXT: - String: ' to pass by value'
;
entry:
%temp2 = load i32, ptr %x, align 4
ret i32 %temp2
}
define i32 @f(i32 %x) {
; CHECK-LABEL: define {{[^@]+}}@f
; CHECK-SAME: (i32 [[X:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4
; CHECK-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4
; CHECK-NEXT: [[X_ADDR_VAL:%.*]] = load i32, ptr [[X_ADDR]], align 4
; CHECK-NEXT: [[TEMP1:%.*]] = call i32 @deref(i32 [[X_ADDR_VAL]])
; CHECK-NEXT: ret i32 [[TEMP1]]
;
entry:
%x_addr = alloca i32
store i32 %x, ptr %x_addr, align 4
%temp1 = call i32 @deref( ptr %x_addr ) nounwind
ret i32 %temp1
}