xref: /llvm-project/llvm/test/CodeGen/X86/ipra-transform.ll (revision c166a43c6e6157b1309ea757324cc0a71c078e66)
1
2; RUN: llc < %s | FileCheck %s -check-prefix=NOIPRA
3; RUN: llc -enable-ipra < %s | FileCheck %s
4
5
6target triple = "x86_64-unknown-unknown"
7define void @bar1() {
8	ret void
9}
10define preserve_allcc void @foo()#0 {
11; Due to preserve_allcc foo() will save some registers at start of foo()
12; prefix NOIPRA will verify that.
13; NOIPRA-LABEL: foo:
14; NOIPRA: pushq	%r10
15; NOIPRA-NEXT: pushq %r9
16; NOIPRA-NEXT: pushq %r8
17; NOIPRA: callq bar1
18; When IPRA is present above registers will not be saved and that is verified
19; by prefix CHECK.
20; CHECK: foo:
21; CHECK-NOT: pushq %r10
22; CHECK-NOT: pushq %r9
23; CHECK-NOT: pushq %r8
24; CHECK: callq bar1
25	call void @bar1()
26	call void @bar2()
27	ret void
28}
29define void @bar2() {
30	ret void
31}
32
33define preserve_nonecc void @foo2()#0 {
34; Due to preserve_nonecc foo2() will save above registers no matter IPRA is
35; present or not.
36; NOIPRA-LABEL: foo2:
37; NOIPRA-NOT: pushq %r10
38; NOIPRA-NOT: pushq %r9
39; NOIPRA-NOT: pushq %r8
40; NOIPRA: callq bar1
41; CHECK: foo2:
42; CHECK-NOT: pushq %r10
43; CHECK-NOT: pushq %r9
44; CHECK-NOT: pushq %r8
45; CHECK: callq bar1
46	call void @bar1()
47	call void @bar2()
48	ret void
49}
50
51attributes #0 = {nounwind}
52