diff --git a/llvm/test/CodeGen/X86/machine-latecleanup-inlineasm.mir b/llvm/test/CodeGen/X86/machine-latecleanup-inlineasm.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/X86/machine-latecleanup-inlineasm.mir @@ -0,0 +1,127 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2 +# RUN: llc -start-before=machine-latecleanup -stop-after=machine-latecleanup \ +# RUN: -o - %s | FileCheck %s +--- | + ; ModuleID = 'reload.ll' + source_filename = "reload.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-apple-macosx" + + @__stack_chk_guard = external global ptr + + ; Function Attrs: nounwind sspreq + define void @foo() #0 { + entry: + %StackGuardSlot = alloca ptr, align 8 + %0 = call ptr @llvm.stackguard() + call void @llvm.stackprotector(ptr %0, ptr %StackGuardSlot) + %_tags = alloca [3 x i32], align 4 + call void asm sideeffect "", "~{memory}"() + ret void + } + + ; Function Attrs: nocallback nofree nosync nounwind willreturn + declare ptr @llvm.stackguard() #1 + + ; Function Attrs: nocallback nofree nosync nounwind willreturn + declare void @llvm.stackprotector(ptr, ptr) #1 + + attributes #0 = { nounwind sspreq } + attributes #1 = { nocallback nofree nosync nounwind willreturn } + +... +--- +name: foo +alignment: 16 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +failsVerification: false +tracksDebugUserValues: true +registers: [] +liveins: [] +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 24 + offsetAdjustment: -24 + maxAlignment: 8 + adjustsStack: true + hasCalls: true + stackProtector: '%stack.0.StackGuardSlot' + functionContext: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: + - { id: 0, name: StackGuardSlot, type: default, offset: -16, size: 8, + alignment: 8, stack-id: default, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } + - { id: 1, name: _tags, type: default, offset: -28, size: 12, alignment: 4, + stack-id: default, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + ; CHECK-LABEL: name: foo + ; CHECK: bb.0.entry: + ; CHECK-NEXT: successors: %bb.2(0x7ffff800), %bb.1(0x00000800) + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $rsp = frame-setup SUB64ri8 $rsp, 24, implicit-def dead $eflags + ; CHECK-NEXT: renamable $rax = LOAD_STACK_GUARD :: (dereferenceable invariant load (s64) from @__stack_chk_guard) + ; CHECK-NEXT: MOV64mr $rsp, 1, $noreg, 16, $noreg, renamable $rax :: (volatile store (s64) into %stack.0.StackGuardSlot) + ; CHECK-NEXT: INLINEASM &"", 25 /* sideeffect mayload maystore attdialect */ + ; CHECK-NEXT: CMP64rm killed renamable $rax, $rsp, 1, $noreg, 16, $noreg, implicit-def $eflags :: (volatile load (s64) from %stack.0.StackGuardSlot) + ; CHECK-NEXT: JCC_1 %bb.1, 5, implicit killed $eflags + ; CHECK-NEXT: JMP_1 %bb.2 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1.entry: + ; CHECK-NEXT: successors: + ; CHECK-BLANK: {{ $}} + ; CHECK: CALL64pcrel32 &__stack_chk_fail, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2.entry: + ; CHECK-NEXT: $rsp = frame-destroy ADD64ri8 $rsp, 24, implicit-def dead $eflags + ; CHECK-NEXT: RET 0 + bb.0.entry: + successors: %bb.2(0x7ffff800), %bb.1(0x00000800) + + $rsp = frame-setup SUB64ri8 $rsp, 24, implicit-def dead $eflags + renamable $rax = LOAD_STACK_GUARD :: (dereferenceable invariant load (s64) from @__stack_chk_guard) + MOV64mr $rsp, 1, $noreg, 16, $noreg, killed renamable $rax :: (volatile store (s64) into %stack.0.StackGuardSlot) + INLINEASM &"", 25 /* sideeffect mayload maystore attdialect */ + renamable $rax = LOAD_STACK_GUARD :: (dereferenceable invariant load (s64) from @__stack_chk_guard) + CMP64rm killed renamable $rax, $rsp, 1, $noreg, 16, $noreg, implicit-def $eflags :: (volatile load (s64) from %stack.0.StackGuardSlot) + JCC_1 %bb.1, 5, implicit killed $eflags + JMP_1 %bb.2 + + bb.1.entry: + successors: + + CALL64pcrel32 &__stack_chk_fail, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp + + bb.2.entry: + $rsp = frame-destroy ADD64ri8 $rsp, 24, implicit-def dead $eflags + RET 0 + +...