1; RUN: opt < %s -mtriple=x86_64-apple-darwin -frame-pointer=all -S | FileCheck -check-prefixes=ALL,CHECK %s
2; RUN: opt < %s -mtriple=x86_64-apple-darwin -frame-pointer=none -S | FileCheck -check-prefixes=NONE,CHECK %s
3; RUN: opt < %s -mtriple=x86_64-apple-darwin -frame-pointer=non-leaf -S | FileCheck -check-prefixes=NONLEAF,CHECK %s
4
5; Check behavior of -frame-pointer flag and frame-pointer atttribute.
6
7; CHECK: @no_frame_pointer_attr() [[VARATTR:#[0-9]+]] {
8define i32 @no_frame_pointer_attr() #0 {
9entry:
10  ret i32 0
11}
12
13; CHECK: @frame_pointer_attr_all() [[ALL_ATTR:#[0-9]+]] {
14define i32 @frame_pointer_attr_all() #1 {
15entry:
16  ret i32 0
17}
18
19; CHECK: @frame_pointer_attr_none() [[NONE_ATTR:#[0-9]+]] {
20define i32 @frame_pointer_attr_none() #2 {
21entry:
22  ret i32 0
23}
24
25; CHECK: @frame_pointer_attr_leaf() [[NONLEAF_ATTR:#[0-9]+]] {
26define i32 @frame_pointer_attr_leaf() #3 {
27entry:
28  ret i32 0
29}
30
31; ALL-DAG: attributes [[VARATTR]] = { nounwind "frame-pointer"="all" }
32; ALL-DAG: attributes [[NONE_ATTR]] = { nounwind "frame-pointer"="none" }
33; ALL-DAG: attributes [[NONLEAF_ATTR]] = { nounwind "frame-pointer"="non-leaf" }
34; ALL-NOT: attributes
35
36; NONE-DAG: attributes [[VARATTR]] = { nounwind "frame-pointer"="none" }
37; NONE-DAG: attributes [[ALL_ATTR]] = { nounwind "frame-pointer"="all" }
38; NONE-DAG: attributes [[NONLEAF_ATTR]] = { nounwind "frame-pointer"="non-leaf" }
39; NONE-NOT: attributes
40
41; NONLEAF-DAG: attributes [[VARATTR]] = { nounwind "frame-pointer"="non-leaf" }
42; NONLEAF-DAG: attributes [[ALL_ATTR]] = { nounwind "frame-pointer"="all" }
43; NONLEAF-DAG: attributes [[NONE_ATTR]] = { nounwind "frame-pointer"="none" }
44; NONLEAF-NOT: attributes
45
46
47attributes #0 = { nounwind }
48attributes #1 = { nounwind "frame-pointer"="all" }
49attributes #2 = { nounwind "frame-pointer"="none" }
50attributes #3 = { nounwind "frame-pointer"="non-leaf" }
51