xref: /llvm-project/llvm/test/Bitcode/upgrade-frame-pointer.ll (revision 304f1d59ca41872c094def3aee0a8689df6aa398)
1;; Test that function attributes "no-frame-pointer-elim" ("true" or "false") and
2;; "no-frame-pointer-elim-non-leaf" (value is ignored) can be upgraded to
3;; "frame-pointer".
4
5; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s
6
7; CHECK: define void @all0() #0
8define void @all0() "no-frame-pointer-elim"="true" { ret void }
9; CHECK: define void @all1() #1
10define void @all1() #0 { ret void }
11
12; CHECK: define void @non_leaf0() #2
13define void @non_leaf0() "no-frame-pointer-elim-non-leaf" { ret void }
14; CHECK: define void @non_leaf1() #3
15define void @non_leaf1() #1 { ret void }
16
17; CHECK: define void @none() #4
18define void @none() "no-frame-pointer-elim"="false" { ret void }
19
20;; Don't add "frame-pointer" if neither "no-frame-pointer-elim" nor
21;; "no-frame-pointer-elim-non-leaf" is present.
22; CHECK: define void @no_attr() {
23define void @no_attr() { ret void }
24
25attributes #0 = { readnone "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" }
26attributes #1 = { readnone "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" }
27
28;; Other attributes (e.g. readnone) are unaffected.
29; CHECK: attributes #0 = { "frame-pointer"="all" }
30; CHECK: attributes #1 = { memory(none) "frame-pointer"="all" }
31; CHECK: attributes #2 = { "frame-pointer"="non-leaf" }
32; CHECK: attributes #3 = { memory(none) "frame-pointer"="non-leaf" }
33; CHECK: attributes #4 = { "frame-pointer"="none" }
34