• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s -check-prefix=NOIPRA
2; RUN: llc -enable-ipra < %s | FileCheck %s
3
4target triple = "x86_64--"
5
6define internal void @foo() norecurse {
7; When IPRA is not enabled R15 will be saved by foo as it is callee saved reg.
8; NOIPRA-LABEL: foo:
9; NOIPRA: pushq	%r15
10; When IPRA is enabled none register should be saved as foo() is local function
11; so we optimize it to save no registers.
12; CHECK-LABEL: foo:
13; CHECK-NOT: pushq %r15
14  call void asm sideeffect "movl	%r14d, %r15d", "~{r15}"()
15  ret void
16}
17
18define void @bar(i32 %X) {
19  call void asm sideeffect "movl  %r12d, $0", "{r15}~{r12}"(i32 %X)
20  ; As R15 is clobbered by foo() when IPRA is enabled value of R15 should be
21  ; saved if register containing orignal value is also getting clobbered
22  ; and reloaded after foo(), here original value is loaded back into R15D after
23  ; call to foo.
24  call void @foo()
25  ; CHECK-LABEL: bar:
26  ; CHECK: callq foo
27  ; CHECK-NEXT: movl  %edi, %r15d
28  call void asm sideeffect "movl  $0, %r12d", "{r15}~{r12}"(i32 %X)
29  ret void
30}
31