xref: /llvm-project/llvm/test/CodeGen/X86/fp-elim.ll (revision c22dc71b120b066c0066b8517014149a001cc2b0)
1; RUN: llc < %s -mtriple=i686-- -asm-verbose=false                           | FileCheck %s --check-prefix=FP-ELIM
2; RUN: llc < %s -mtriple=i686-- -asm-verbose=false -frame-pointer=all        | FileCheck %s --check-prefix=NO-ELIM
3
4; Implement -momit-leaf-frame-pointer
5; rdar://7886181
6
7define i32 @t1() nounwind readnone {
8entry:
9; FP-ELIM-LABEL:  t1:
10; FP-ELIM-NEXT:     movl
11; FP-ELIM-NEXT:     ret
12
13; NO-ELIM-LABEL:  t1:
14; NO-ELIM-NEXT:     pushl %ebp
15; NO-ELIM:          popl %ebp
16; NO-ELIM-NEXT:     ret
17  ret i32 10
18}
19
20define void @t2() nounwind {
21entry:
22; FP-ELIM-LABEL:  t2:
23; FP-ELIM-NOT:      pushl %ebp
24; FP-ELIM:          ret
25
26; NO-ELIM-LABEL:  t2:
27; NO-ELIM-NEXT:     pushl %ebp
28; NO-ELIM:          popl %ebp
29; NO-ELIM-NEXT:     ret
30  tail call void @foo(i32 0) nounwind
31  ret void
32}
33
34; The local non-leaf attribute takes precendece over the command line flag.
35define i32 @t3() "frame-pointer"="non-leaf" nounwind readnone {
36entry:
37; ANY-ELIM-LABEL:  t3:
38; ANY-ELIM-NEXT:     movl
39; ANY-ELIM-NEXT:     ret
40  ret i32 10
41}
42
43define void @t4() "frame-pointer"="non-leaf" nounwind {
44entry:
45; ANY-ELIM-LABEL:  t4:
46; ANY-ELIM-NEXT:     pushl %ebp
47; ANY-ELIM:          popl %ebp
48; ANY-ELIM-NEXT:     ret
49  tail call void @foo(i32 0) nounwind
50  ret void
51}
52
53declare void @foo(i32)
54