machine-outliner-cfi-tail-some.mir 3.42 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-apple-unknown -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s

# Outlining CFI instructions is unsafe if we cannot outline all of the CFI
# instructions from a function.  This shows that we choose not to outline the
# CFI instructions since function foo has a CFI Instruction that would not
# be caught.

--- |
  define void @foo() #0 { ret void }
  define void @bar() #0 { ret void }
  define void @baz() #0 { ret void }
  attributes #0 = { noredzone }
...
---
name:            foo
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: name: foo
    ; CHECK: CFI_INSTRUCTION def_cfa_offset 16
    ; CHECK: CFI_INSTRUCTION offset $rbp, -16
    ; CHECK: CFI_INSTRUCTION def_cfa_register $rbp
    ; CHECK: CALL64pcrel32 @OUTLINED_FUNCTION_1, implicit $rsp, implicit $ssp, implicit-def $eax, implicit-def $ebx, implicit-def $ecx, implicit $rsp, implicit $ssp
    ; CHECK: CFI_INSTRUCTION def_cfa_offset 16
    ; CHECK: CFI_INSTRUCTION offset $rbp, -16
    ; CHECK: CFI_INSTRUCTION def_cfa_register $rsp
    ; CHECK: TAILJMPd64 @OUTLINED_FUNCTION_0, implicit $rsp, implicit $ssp, implicit-def $eax, implicit-def $edi, implicit-def $edx, implicit-def $esi, implicit $rsp, implicit $ssp
    CFI_INSTRUCTION def_cfa_offset 16
    CFI_INSTRUCTION offset $rbp, -16
    CFI_INSTRUCTION def_cfa_register $rbp
    $eax =  MOV32ri 1
    $ebx =  MOV32ri 2
    $ecx =  MOV32ri 3
    CFI_INSTRUCTION def_cfa_offset 16
    CFI_INSTRUCTION offset $rbp, -16
    CFI_INSTRUCTION def_cfa_register $rsp
    $esi = MOV32ri 1
    $edx = MOV32ri 2
    $edi = MOV32ri 3
    $eax = MOV32ri 4
    RETQ
...
---
name:            bar
tracksRegLiveness: true
body:             |
  bb.0:
  ;liveins: $lr
    ; CHECK-LABEL: name: bar
    ; CHECK: CALL64pcrel32 @OUTLINED_FUNCTION_1, implicit $rsp, implicit $ssp, implicit-def $eax, implicit-def $ebx, implicit-def $ecx, implicit $rsp, implicit $ssp
    ; CHECK: CFI_INSTRUCTION def_cfa_offset 16
    ; CHECK: CFI_INSTRUCTION offset $rbp, -16
    ; CHECK: CFI_INSTRUCTION def_cfa_register $rsp
    ; CHECK: TAILJMPd64 @OUTLINED_FUNCTION_0, implicit $rsp, implicit $ssp, implicit-def $eax, implicit-def $edi, implicit-def $edx, implicit-def $esi, implicit $rsp, implicit $ssp
    $eax =  MOV32ri 1
    $ebx =  MOV32ri 2
    $ecx =  MOV32ri 3
    CFI_INSTRUCTION def_cfa_offset 16
    CFI_INSTRUCTION offset $rbp, -16
    CFI_INSTRUCTION def_cfa_register $rsp
    $esi = MOV32ri 1
    $edx = MOV32ri 2
    $edi = MOV32ri 3
    $eax = MOV32ri 4
    RETQ
...
---
name:            baz
tracksRegLiveness: true
body:             |
  bb.0:
  ;liveins: $lr
    ; CHECK-LABEL: name: baz
    ; CHECK: CALL64pcrel32 @OUTLINED_FUNCTION_1, implicit $rsp, implicit $ssp, implicit-def $eax, implicit-def $ebx, implicit-def $ecx, implicit $rsp, implicit $ssp
    ; CHECK: CFI_INSTRUCTION def_cfa_offset 16
    ; CHECK: CFI_INSTRUCTION offset $rbp, -16
    ; CHECK: CFI_INSTRUCTION def_cfa_register $rsp
    ; CHECK: TAILJMPd64 @OUTLINED_FUNCTION_0, implicit $rsp, implicit $ssp, implicit-def $eax, implicit-def $edi, implicit-def $edx, implicit-def $esi, implicit $rsp, implicit $ssp
    $eax =  MOV32ri 1
    $ebx =  MOV32ri 2
    $ecx =  MOV32ri 3
    CFI_INSTRUCTION def_cfa_offset 16
    CFI_INSTRUCTION offset $rbp, -16
    CFI_INSTRUCTION def_cfa_register $rsp
    $esi = MOV32ri 1
    $edx = MOV32ri 2
    $edi = MOV32ri 3
    $eax = MOV32ri 4
    RETQ