1 // RUN: %clang_cc1 -triple aarch64 -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64 -emit-llvm %s -fpatchable-function-entry=1 -o - | FileCheck --check-prefixes=CHECK,OPT %s
3 
4 // CHECK: define{{.*}} void @f0() #0
f0()5 __attribute__((patchable_function_entry(0))) void f0() {}
6 
7 // CHECK: define{{.*}} void @f00() #0
f00()8 __attribute__((patchable_function_entry(0, 0))) void f00() {}
9 
10 // CHECK: define{{.*}} void @f2() #1
f2()11 __attribute__((patchable_function_entry(2))) void f2() {}
12 
13 // CHECK: define{{.*}} void @f20() #1
f20()14 __attribute__((patchable_function_entry(2, 0))) void f20() {}
15 
16 // CHECK: define{{.*}} void @f20decl() #1
17 __attribute__((patchable_function_entry(2, 0))) void f20decl();
f20decl()18 void f20decl() {}
19 
20 // CHECK: define{{.*}} void @f44() #2
f44()21 __attribute__((patchable_function_entry(4, 4))) void f44() {}
22 
23 // CHECK: define{{.*}} void @f52() #3
f52()24 __attribute__((patchable_function_entry(5, 2))) void f52() {}
25 
26 // OPT: define{{.*}} void @f() #4
f()27 void f() {}
28 
29 /// No need to emit "patchable-function-entry"="0"
30 // CHECK: attributes #0 = { {{.*}}
31 // CHECK-NOT: "patchable-function-entry"
32 
33 // CHECK: attributes #1 = { {{.*}} "patchable-function-entry"="2"
34 // CHECK: attributes #2 = { {{.*}} "patchable-function-entry"="0" "patchable-function-prefix"="4"
35 // CHECK: attributes #3 = { {{.*}} "patchable-function-entry"="3" "patchable-function-prefix"="2"
36 // OPT:   attributes #4 = { {{.*}} "patchable-function-entry"="1"
37