brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 787b16f Raw
31 lines · plain
1; RUN: llc < %s | FileCheck %s -check-prefix=NOIPRA2; RUN: llc -enable-ipra < %s | FileCheck %s3 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	%r1510; When IPRA is enabled none register should be saved as foo() is local function11; so we optimize it to save no registers.12; CHECK-LABEL: foo:13; CHECK-NOT: pushq %r1514  call void asm sideeffect "movl	%r14d, %r15d", "~{r15}"()15  ret void16}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 be21  ; saved if register containing orignal value is also getting clobbered22  ; and reloaded after foo(), here original value is loaded back into R15D after23  ; call to foo.24  call void @foo()25  ; CHECK-LABEL: bar:26  ; CHECK: callq foo27  ; CHECK-NEXT: movl  %edi, %r15d28  call void asm sideeffect "movl  $0, %r12d", "{r15}~{r12}"(i32 %X)29  ret void30}31