95 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -o - %s -run-pass fixup-statepoint-caller-saved -verify-machineinstrs | FileCheck %s3# RUN: llc -o - %s -passes='fixup-statepoint-caller-saved' | FileCheck %s4 5# Check that COPY is not eliminated if dest register is used in6# non-meta arguments of statepoint.7 8--- |9 ; ModuleID = 'cp.ll'10 source_filename = "cp.ll"11 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"12 target triple = "x86_64-pc-linux-gnu"13 14 declare void @foo(i64)15 16 define ptr addrspace(1) @test(i64 %a, i64 %b, i64 %c, ptr addrspace(1) %p) gc "statepoint-example" {17 entry:18 %token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (i64)) @foo, i32 1, i32 0, i64 %b, i3 0, i32 0) [ "deopt"(i64 %b), "gc-live"(ptr addrspace(1) %p) ]19 %p2 = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %token, i32 0, i32 0) ; (%p, %p)20 ret ptr addrspace(1) %p221 }22 23 ; Function Attrs: nounwind readonly24 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #025 26 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)27 28 attributes #0 = { nounwind readonly }29 30...31---32name: test33alignment: 1634exposesReturnsTwice: false35legalized: false36regBankSelected: false37selected: false38failedISel: false39tracksRegLiveness: true40hasWinCFI: false41registers: []42liveins:43 - { reg: '$rsi', virtual-reg: '' }44 - { reg: '$rcx', virtual-reg: '' }45frameInfo:46 isFrameAddressTaken: false47 isReturnAddressTaken: false48 hasStackMap: false49 hasPatchPoint: false50 stackSize: 051 offsetAdjustment: 052 maxAlignment: 853 adjustsStack: false54 hasCalls: true55 stackProtector: ''56 maxCallFrameSize: 429496729557 cvBytesOfCalleeSavedRegisters: 058 hasOpaqueSPAdjustment: false59 hasVAStart: false60 hasMustTailInVarArgFunc: false61 localFrameSize: 062 savePoint: []63 restorePoint: []64fixedStack: []65stack:66 - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 8,67 stack-id: default, callee-saved-register: '', callee-saved-restored: true,68 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }69callSites: []70constants: []71machineFunctionInfo: {}72body: |73 bb.0.entry:74 liveins: $rcx, $rsi75 76 ; CHECK-LABEL: name: test77 ; CHECK: liveins: $rcx, $rsi78 ; CHECK: renamable $rdi = COPY $rsi79 ; CHECK: MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $rcx :: (store (s64) into %stack.0)80 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp81 ; CHECK: MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi :: (store (s64) into %stack.1)82 ; CHECK: STATEPOINT 0, 0, 1, @foo, $rdi, 2, 0, 2, 0, 2, 1, 1, 8, %stack.1, 0, 2, 1, 1, 8, %stack.0, 0, 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (volatile load store (s64) on %stack.0), (load (s64) from %stack.1)83 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp84 ; CHECK: renamable $rax = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load (s64) from %stack.0)85 ; CHECK: RET 0, $rax86 renamable $rdi = COPY $rsi87 MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $rcx :: (store (s64) into %stack.0)88 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp89 STATEPOINT 0, 0, 1, @foo, $rdi, 2, 0, 2, 0, 2, 1, killed renamable $rdi, 2, 1, 1, 8, %stack.0, 0, 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (volatile load store (s64) on %stack.0)90 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp91 renamable $rax = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load (s64) from %stack.0)92 RET 0, $rax93 94...95