diff options
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/AArch64/chkstk.ll | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/win64_vararg.ll | 68 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame0.mir | 60 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame1.mir | 94 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame2.mir | 72 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame3.mir | 59 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame4.mir | 59 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame5.mir | 135 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame6.mir | 150 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame7.mir | 189 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/wineh-frame8.mir | 88 |
11 files changed, 943 insertions, 35 deletions
diff --git a/llvm/test/CodeGen/AArch64/chkstk.ll b/llvm/test/CodeGen/AArch64/chkstk.ll index 1037a5fdae0..9689a3b9b58 100644 --- a/llvm/test/CodeGen/AArch64/chkstk.ll +++ b/llvm/test/CodeGen/AArch64/chkstk.ll @@ -16,7 +16,7 @@ entry: ; CHECK-DEFAULT-CODE-MODEL: check_watermark: ; CHECK-DEFAULT-CODE-MODEL-DAG: stp x29, x30, [sp -; CHECK-DEFAULT-CODE-MODEL-DAG: orr x15, xzr, #0x100 +; CHECK-DEFAULT-CODE-MODEL-DAG: mov x15, #256 ; CHECK-DEFAULT-CODE-MODEL: bl __chkstk ; CHECK-DEFAULT-CODE-MODEL: sub sp, sp, x15, lsl #4 @@ -24,7 +24,7 @@ entry: ; CHECK-LARGE-CODE-MODEL: check_watermark: ; CHECK-LARGE-CODE-MODEL-DAG: stp x29, x30, [sp -; CHECK-LARGE-CODE-MODEL-DAG: orr x15, xzr, #0x100 +; CHECK-LARGE-CODE-MODEL-DAG: mov x15, #256 ; CHECK-LARGE-CODE-MODEL-DAG: adrp x16, __chkstk ; CHECK-LARGE-CODE-MODEL-DAG: add x16, x16, __chkstk ; CHECK-LARGE-CODE-MODEL: blr x16 diff --git a/llvm/test/CodeGen/AArch64/win64_vararg.ll b/llvm/test/CodeGen/AArch64/win64_vararg.ll index 9cc9f50adb7..38da60b81a5 100644 --- a/llvm/test/CodeGen/AArch64/win64_vararg.ll +++ b/llvm/test/CodeGen/AArch64/win64_vararg.ll @@ -104,7 +104,7 @@ declare i64* @__local_stdio_printf_options() local_unnamed_addr #4 ; CHECK-LABEL: fp ; CHECK: str x21, [sp, #-96]! -; CHECK: stp x20, x19, [sp, #16] +; CHECK: stp x19, x20, [sp, #16] ; CHECK: stp x29, x30, [sp, #32] ; CHECK: add x29, sp, #32 ; CHECK: add x8, x29, #24 @@ -124,10 +124,10 @@ declare i64* @__local_stdio_printf_options() local_unnamed_addr #4 ; CHECK: mov x3, x19 ; CHECK: mov x4, xzr ; CHECK: bl __stdio_common_vsprintf -; CHECK: ldp x29, x30, [sp, #32] -; CHECK: ldp x20, x19, [sp, #16] ; CHECK: cmp w0, #0 ; CHECK: csinv w0, w0, wzr, ge +; CHECK: ldp x29, x30, [sp, #32] +; CHECK: ldp x19, x20, [sp, #16] ; CHECK: ldr x21, [sp], #96 ; CHECK: ret define i32 @fp(i8*, i64, i8*, ...) local_unnamed_addr #6 { @@ -151,8 +151,8 @@ attributes #6 = { "no-frame-pointer-elim"="true" } ; CHECK-LABEL: vla ; CHECK: str x23, [sp, #-112]! -; CHECK: stp x22, x21, [sp, #16] -; CHECK: stp x20, x19, [sp, #32] +; CHECK: stp x21, x22, [sp, #16] +; CHECK: stp x19, x20, [sp, #32] ; CHECK: stp x29, x30, [sp, #48] ; CHECK: add x29, sp, #48 ; CHECK: add x8, x29, #16 @@ -183,8 +183,8 @@ attributes #6 = { "no-frame-pointer-elim"="true" } ; CHECK: mov sp, [[REG2]] ; CHECK: sub sp, x29, #48 ; CHECK: ldp x29, x30, [sp, #48] -; CHECK: ldp x20, x19, [sp, #32] -; CHECK: ldp x22, x21, [sp, #16] +; CHECK: ldp x19, x20, [sp, #32] +; CHECK: ldp x21, x22, [sp, #16] ; CHECK: ldr x23, [sp], #112 ; CHECK: ret define void @vla(i32, i8*, ...) local_unnamed_addr { @@ -211,32 +211,34 @@ declare i8* @llvm.stacksave() declare void @llvm.stackrestore(i8*) ; CHECK-LABEL: snprintf -; CHECK: sub sp, sp, #96 -; CHECK: stp x21, x20, [sp, #16] -; CHECK: stp x19, x30, [sp, #32] -; CHECK: add x8, sp, #56 -; CHECK: mov x19, x2 -; CHECK: mov x20, x1 -; CHECK: mov x21, x0 -; CHECK: stp x6, x7, [sp, #80] -; CHECK: stp x4, x5, [sp, #64] -; CHECK: str x3, [sp, #56] -; CHECK: str x8, [sp, #8] -; CHECK: bl __local_stdio_printf_options -; CHECK: ldr x8, [x0] -; CHECK: add x5, sp, #56 -; CHECK: mov x1, x21 -; CHECK: mov x2, x20 -; CHECK: orr x0, x8, #0x2 -; CHECK: mov x3, x19 -; CHECK: mov x4, xzr -; CHECK: bl __stdio_common_vsprintf -; CHECK: ldp x19, x30, [sp, #32] -; CHECK: ldp x21, x20, [sp, #16] -; CHECK: cmp w0, #0 -; CHECK: csinv w0, w0, wzr, ge -; CHECK: add sp, sp, #96 -; CHECK: ret +; CHECK-DAG: sub sp, sp, #96 +; CHECK-DAG: str x21, [sp, #16] +; CHECK-DAG: stp x19, x20, [sp, #24] +; CHECK-DAG: str x30, [sp, #40] +; CHECK-DAG: add x8, sp, #56 +; CHECK-DAG: mov x19, x2 +; CHECK-DAG: mov x20, x1 +; CHECK-DAG: mov x21, x0 +; CHECK-DAG: stp x6, x7, [sp, #80] +; CHECK-DAG: stp x4, x5, [sp, #64] +; CHECK-DAG: str x3, [sp, #56] +; CHECK-DAG: str x8, [sp, #8] +; CHECK-DAG: bl __local_stdio_printf_options +; CHECK-DAG: ldr x8, [x0] +; CHECK-DAG: add x5, sp, #56 +; CHECK-DAG: mov x1, x21 +; CHECK-DAG: mov x2, x20 +; CHECK-DAG: orr x0, x8, #0x2 +; CHECK-DAG: mov x3, x19 +; CHECK-DAG: mov x4, xzr +; CHECK-DAG: bl __stdio_common_vsprintf +; CHECK-DAG: ldr x30, [sp, #40] +; CHECK-DAG: ldp x19, x20, [sp, #24] +; CHECK-DAG: ldr x21, [sp, #16] +; CHECK-DAG: cmp w0, #0 +; CHECK-DAG: csinv w0, w0, wzr, ge +; CHECK-DAG: add sp, sp, #96 +; CHECK-DAG: ret define i32 @snprintf(i8*, i64, i8*, ...) local_unnamed_addr #5 { %4 = alloca i8*, align 8 %5 = bitcast i8** %4 to i8* diff --git a/llvm/test/CodeGen/AArch64/wineh-frame0.mir b/llvm/test/CodeGen/AArch64/wineh-frame0.mir new file mode 100644 index 00000000000..b59627d7f31 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame0.mir @@ -0,0 +1,60 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Check save_regp_x, save_regp + +# CHECK: early-clobber $sp = frame-setup STPXpre killed $x27, killed $x28, $sp, -10 +# CHECK-NEXT: frame-setup SEH_SaveRegP_X 27, 28, -80 +# CHECK-NEXT: frame-setup STPXi killed $x25, killed $x26, $sp, 2 +# CHECK-NEXT: frame-setup SEH_SaveRegP 25, 26, 16 +# CHECK-NEXT: frame-setup STPXi killed $x23, killed $x24, $sp, 4 +# CHECK-NEXT: frame-setup SEH_SaveRegP 23, 24, 32 +# CHECK-NEXT: frame-setup STPXi killed $x21, killed $x22, $sp, 6 +# CHECK-NEXT: frame-setup SEH_SaveRegP 21, 22, 48 +# CHECK-NEXT: frame-setup STPXi killed $x19, killed $x20, $sp, 8 +# CHECK-NEXT: frame-setup SEH_SaveRegP 19, 20, 64 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $x19, $x20 = frame-destroy LDPXi $sp, 8 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 19, 20, 64 +# CHECK-NEXT: $x21, $x22 = frame-destroy LDPXi $sp, 6 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 21, 22, 48 +# CHECK-NEXT: $x23, $x24 = frame-destroy LDPXi $sp, 4 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 23, 24, 32 +# CHECK-NEXT: $x25, $x26 = frame-destroy LDPXi $sp, 2 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 25, 26, 16 +# CHECK-NEXT: early-clobber $sp, $x27, $x28 = frame-destroy LDPXpost $sp, 10 +# CHECK-NEXT: frame-destroy SEH_SaveRegP_X 27, 28, -80 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit $x0 + +... +--- +name: test +alignment: 2 +tracksRegLiveness: true +hasWinCFI: true +liveins: + - { reg: '$w0' } +frameInfo: + stackSize: 80 + maxAlignment: 8 + maxCallFrameSize: 0 + hasOpaqueSPAdjustment: true +stack: +body: | + bb.0.entry: + liveins: $x0, $x1, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20 + $x19 = ADDXrr $x0, killed $x1 + $x20 = ADDXrr $x19, killed $x0 + $x21 = ADDXrr $x20, killed $x19 + $x22 = ADDXrr $x21, killed $x20 + $x23 = ADDXrr $x22, killed $x21 + $x24 = ADDXrr $x23, killed $x22 + $x25 = ADDXrr $x24, killed $x23 + $x26 = ADDXrr $x25, killed $x24 + $x27 = ADDXrr $x26, killed $x25 + $x28 = ADDXrr $x27, killed $x26 + $x0 = COPY $x28 + RET_ReallyLR implicit $x0 + +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame1.mir b/llvm/test/CodeGen/AArch64/wineh-frame1.mir new file mode 100644 index 00000000000..deff40160b2 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame1.mir @@ -0,0 +1,94 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Check save_fregp_x, save_fregp + +# CHECK: early-clobber $sp = frame-setup STPDpre killed $d10, killed $d11, $sp, -14 +# CHECK-NEXT: frame-setup SEH_SaveFRegP_X 10, 11, -112 +# CHECK-NEXT: frame-setup STPDi killed $d8, killed $d9, $sp, 2 +# CHECK-NEXT: frame-setup SEH_SaveFRegP 8, 9, 16 +# CHECK-NEXT: frame-setup STPXi killed $x27, killed $x28, $sp, 4 +# CHECK-NEXT: frame-setup SEH_SaveRegP 27, 28, 32 +# CHECK-NEXT: frame-setup STPXi killed $x25, killed $x26, $sp, 6 +# CHECK-NEXT: frame-setup SEH_SaveRegP 25, 26, 48 +# CHECK-NEXT: frame-setup STPXi killed $x23, killed $x24, $sp, 8 +# CHECK-NEXT: frame-setup SEH_SaveRegP 23, 24, 64 +# CHECK-NEXT: frame-setup STPXi killed $x21, killed $x22, $sp, 10 +# CHECK-NEXT: frame-setup SEH_SaveRegP 21, 22, 80 +# CHECK-NEXT: frame-setup STPXi killed $x19, killed $x20, $sp, 12 +# CHECK-NEXT: frame-setup SEH_SaveRegP 19, 20, 96 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $x19, $x20 = frame-destroy LDPXi $sp, 12 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 19, 20, 96 +# CHECK-NEXT: $x21, $x22 = frame-destroy LDPXi $sp, 10 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 21, 22, 80 +# CHECK-NEXT: $x23, $x24 = frame-destroy LDPXi $sp, 8 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 23, 24, 64 +# CHECK-NEXT: $x25, $x26 = frame-destroy LDPXi $sp, 6 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 25, 26, 48 +# CHECK-NEXT: $x27, $x28 = frame-destroy LDPXi $sp, 4 +# CHECK-NEXT: frame-destroy SEH_SaveRegP 27, 28, 32 +# CHECK-NEXT: $d8, $d9 = frame-destroy LDPDi $sp, 2 +# CHECK-NEXT: frame-destroy SEH_SaveFRegP 8, 9, 16 +# CHECK-NEXT: early-clobber $sp, $d10, $d11 = frame-destroy LDPDpost $sp, 14 +# CHECK-NEXT: frame-destroy SEH_SaveFRegP_X 10, 11, -112 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit $x0 +... +--- +name: test +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: true +registers: +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 112 + offsetAdjustment: 0 + maxAlignment: 8 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + hasOpaqueSPAdjustment: true + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: +stack: +constants: +body: | + bb.0.entry: + liveins: $x0, $x1, $d0, $d1, $d10, $d11, $d8, $d9, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20 + + $x19 = ADDXrr $x0, killed $x1 + $d8 = FADDDrr killed $d0, $d1 + $d9 = FADDDrr $d8, $d1 + $d10 = FADDDrr $d9, $d8 + $d11 = FADDDrr killed $d9, $d10 + $x20 = ADDXrr $x19, killed $x0 + $x21 = ADDXrr $x20, killed $x19 + $x22 = ADDXrr $x21, killed $x20 + $x23 = ADDXrr $x22, killed $x21 + $x24 = ADDXrr $x23, killed $x22 + $x25 = ADDXrr $x24, killed $x23 + $x26 = ADDXrr $x25, killed $x24 + $x27 = ADDXrr $x26, killed $x25 + $x28 = ADDXrr $x27, killed $x26 + $x0 = COPY $d11 + $x0 = ADDXrr $x0, killed $x28 + RET_ReallyLR implicit $x0 + +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame2.mir b/llvm/test/CodeGen/AArch64/wineh-frame2.mir new file mode 100644 index 00000000000..ae2aaf7f27d --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame2.mir @@ -0,0 +1,72 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Check save_freg_x, save_frep, save_reg + +# CHECK: early-clobber $sp = frame-setup STRDpre killed $d12, $sp, -48 +# CHECK-NEXT: frame-setup SEH_SaveFReg_X 12, -48 +# CHECK-NEXT: frame-setup STPDi killed $d10, killed $d11, $sp, 1 +# CHECK-NEXT: frame-setup SEH_SaveFRegP 10, 11, 8 +# CHECK-NEXT: frame-setup STPDi killed $d8, killed $d9, $sp, 3 +# CHECK-NEXT: frame-setup SEH_SaveFRegP 8, 9, 24 +# CHECK-NEXT: frame-setup STRXui killed $x19, $sp, 5 +# CHECK-NEXT: frame-setup SEH_SaveReg 19, 40 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $x19 = frame-destroy LDRXui $sp, 5 +# CHECK-NEXT: frame-destroy SEH_SaveReg 19, 40 +# CHECK-NEXT: $d8, $d9 = frame-destroy LDPDi $sp, 3 +# CHECK-NEXT: frame-destroy SEH_SaveFRegP 8, 9, 24 +# CHECK-NEXT: $d10, $d11 = frame-destroy LDPDi $sp, 1 +# CHECK-NEXT: frame-destroy SEH_SaveFRegP 10, 11, 8 +# CHECK-NEXT: early-clobber $sp, $d12 = frame-destroy LDRDpost $sp, 48 +# CHECK-NEXT: frame-destroy SEH_SaveFReg_X 12, -48 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit $x0 +... +--- +name: test +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: true +registers: +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 112 + offsetAdjustment: 0 + maxAlignment: 8 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + hasOpaqueSPAdjustment: true + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: +stack: +constants: +body: | + bb.0.entry: + liveins: $x0, $x1, $d0, $d1, $d10, $d11, $d8, $d9 + $x19 = ADDXrr $x0, killed $x1 + $d8 = FADDDrr killed $d0, $d1 + $d9 = FADDDrr $d8, $d1 + $d10 = FADDDrr $d9, $d8 + $d11 = FADDDrr killed $d9, $d10 + $d12 = FADDDrr $d11, killed $d11 + $x0 = COPY $d12 + RET_ReallyLR implicit $x0 + +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame3.mir b/llvm/test/CodeGen/AArch64/wineh-frame3.mir new file mode 100644 index 00000000000..d6e927d4bd5 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame3.mir @@ -0,0 +1,59 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Check save_reg_x, save_reg + +# CHECK: early-clobber $sp = frame-setup STRXpre killed $x22, $sp, -16 +# CHECK-NEXT: frame-setup SEH_SaveReg_X 22, -16 +# CHECK-NEXT: frame-setup STRXui killed $x19, $sp, 1 +# CHECK-NEXT: frame-setup SEH_SaveReg 19, 8 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $x19 = frame-destroy LDRXui $sp, 1 +# CHECK-NEXT: frame-destroy SEH_SaveReg 19, 8 +# CHECK-NEXT: early-clobber $sp, $x22 = frame-destroy LDRXpost $sp, 16 +# CHECK-NEXT: frame-destroy SEH_SaveReg_X 22, -16 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit $x0 +... +--- +name: test +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: true +registers: +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 112 + offsetAdjustment: 0 + maxAlignment: 8 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + hasOpaqueSPAdjustment: true + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: +stack: +constants: +body: | + bb.0.entry: + liveins: $x0, $x1 + $x19 = ADDXrr $x0, killed $x1 + $x22 = ADDXrr killed $x19, $x0 + $x0 = COPY killed $x22 + RET_ReallyLR implicit $x0 +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame4.mir b/llvm/test/CodeGen/AArch64/wineh-frame4.mir new file mode 100644 index 00000000000..63a8dc67779 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame4.mir @@ -0,0 +1,59 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Check save_freg_x, save_freg + +# CHECK: early-clobber $sp = frame-setup STRDpre killed $d10, $sp, -16 +# CHECK-NEXT: frame-setup SEH_SaveFReg_X 10, -16 +# CHECK-NEXT: frame-setup STRDui killed $d8, $sp, 1 :: (store 8 into %stack.0) +# CHECK-NEXT: frame-setup SEH_SaveFReg 8, 8 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $d8 = frame-destroy LDRDui $sp, 1 :: (load 8 from %stack.0) +# CHECK-NEXT: frame-destroy SEH_SaveFReg 8, 8 +# CHECK-NEXT: early-clobber $sp, $d10 = frame-destroy LDRDpost $sp, 16 :: (load 8 from %stack.1) +# CHECK-NEXT: frame-destroy SEH_SaveFReg_X 10, -16 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit $x0 +... +--- +name: test +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: true +registers: +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 112 + offsetAdjustment: 0 + maxAlignment: 8 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + hasOpaqueSPAdjustment: true + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: +stack: +constants: +body: | + bb.0.entry: + liveins: $d0, $d1 + $d8 = FADDDrr $d0, killed $d1 + $d10 = FADDDrr killed $d8, $d0 + $x0 = COPY killed $d10 + RET_ReallyLR implicit $x0 +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame5.mir b/llvm/test/CodeGen/AArch64/wineh-frame5.mir new file mode 100644 index 00000000000..2a4eed4ca92 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame5.mir @@ -0,0 +1,135 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Check multiple epilogues, save_reg, save_reg_x. + +# CHECK-LABEL: bb.0.entry: +# CHECK: early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -32 +# CHECK-NEXT: frame-setup SEH_SaveReg_X 28, -32 +# CHECK-NEXT: frame-setup STRXui killed $x19, $sp, 1 +# CHECK-NEXT: frame-setup SEH_SaveReg 19, 8 +# CHECK-NEXT: frame-setup STRXui killed $lr, $sp, 2 +# CHECK-NEXT: frame-setup SEH_SaveReg 30, 16 +# CHECK-NEXT: $sp = frame-setup SUBXri $sp, 496, 0 +# CHECK-NEXT: frame-setup SEH_StackAlloc 496 +# CHECK-NEXT: frame-setup SEH_PrologEnd + +# CHECK-LABEL: bb.1.if.then: +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 496, 0 +# CHECK-NEXT: frame-destroy SEH_StackAlloc 496 +# CHECK-NEXT: $lr = frame-destroy LDRXui $sp, 2 +# CHECK-NEXT: frame-destroy SEH_SaveReg 30, 16 +# CHECK-NEXT: $x19 = frame-destroy LDRXui $sp, 1 +# CHECK-NEXT: frame-destroy SEH_SaveReg 19, 8 +# CHECK-NEXT: early-clobber $sp, $x28 = frame-destroy LDRXpost $sp, 32 +# CHECK-NEXT: frame-destroy SEH_SaveReg_X 28, -32 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp + + +--- | + target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" + target triple = "aarch64-unknown-windows-msvc19.11.0" + + define dso_local i32 @"?func@@YAHH@Z"(i32 %i) local_unnamed_addr #0 { + entry: + %B = alloca [123 x i32], align 4 + %call = tail call i32 @"?func2@@YAHXZ"() + %cmp = icmp sgt i32 %i, 2 + br i1 %cmp, label %if.then, label %if.else + + if.then: ; preds = %entry + %call1 = tail call i32 @"?func2@@YAHXZ"() + ret i32 %call1 + + if.else: ; preds = %entry + %0 = bitcast [123 x i32]* %B to i8* + call void @llvm.lifetime.start.p0i8(i64 492, i8* nonnull %0) #3 + %arraydecay7 = bitcast [123 x i32]* %B to i32* + %call2 = call i32 @"?func3@@YAHPEAH@Z"(i32* nonnull %arraydecay7) + call void @llvm.lifetime.end.p0i8(i64 492, i8* nonnull %0) #3 + ret i32 %call2 + } + + ; Function Attrs: argmemonly nounwind + declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 + + declare dso_local i32 @"?func2@@YAHXZ"() local_unnamed_addr #2 + + declare dso_local i32 @"?func3@@YAHPEAH@Z"(i32*) local_unnamed_addr #2 + + ; Function Attrs: argmemonly nounwind + declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 + + ; Function Attrs: nounwind + declare void @llvm.stackprotector(i8*, i8**) #3 + + attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #1 = { argmemonly nounwind } + attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #3 = { nounwind } + +... +--- +name: '?func@@YAHH@Z' +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +registers: +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 4 + adjustsStack: true + hasCalls: true + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 492 + savePoint: '' + restorePoint: '' +fixedStack: +stack: + - { id: 0, name: B, type: default, offset: 0, size: 492, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -492, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } +constants: +body: | + bb.0.entry: + successors: %bb.1(0x40000000), %bb.2(0x40000000) + liveins: $w0 + + renamable $w19 = COPY $w0 + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp + BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0 + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp + dead $wzr = SUBSWri killed renamable $w19, 3, 0, implicit-def $nzcv + Bcc 11, %bb.2, implicit killed $nzcv + B %bb.1 + + bb.1.if.then: + TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp + + bb.2.if.else: + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp + $x0 = ADDXri %stack.0.B, 0, 0 + BL @"?func3@@YAHPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit-def $sp, implicit-def $w0 + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp + RET_ReallyLR implicit $w0 + +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame6.mir b/llvm/test/CodeGen/AArch64/wineh-frame6.mir new file mode 100644 index 00000000000..b86422e8097 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame6.mir @@ -0,0 +1,150 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Test that stack probe results in Nop unwind codes in the prologue. Test +# save_fplr, save_reg_x and stack_alloc with multiple updates + +# CHECK: early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -2 +# CHECK-NEXT: frame-setup SEH_SaveFPLR_X -16 +# CHECK-NEXT: $fp = frame-setup ADDXri $sp, 0, 0 +# CHECK-NEXT: frame-setup SEH_SetFP +# CHECK-NEXT: $sp = frame-setup SUBXri $sp, 32, 0 +# CHECK-NEXT: frame-setup SEH_StackAlloc 32 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $sp = frame-destroy ADDXri $fp, 0, 0 +# CHECK-NEXT: frame-destroy SEH_SetFP +# CHECK-NEXT: early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2 +# CHECK-NEXT: frame-destroy SEH_SaveFPLR_X -16 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit killed $w0 +--- | + target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" + target triple = "aarch64-unknown-windows-msvc19.11.0" + + ; Function Attrs: noinline optnone + define dso_local i32 @"?func@@YAHHHHH@Z"(i32 %n, i32 %idx, i32 %b, i32 %c) #0 { + entry: + %c.addr = alloca i32, align 4 + %b.addr = alloca i32, align 4 + %idx.addr = alloca i32, align 4 + %n.addr = alloca i32, align 4 + %a = alloca i32*, align 8 + store i32 %c, i32* %c.addr, align 4 + store i32 %b, i32* %b.addr, align 4 + store i32 %idx, i32* %idx.addr, align 4 + store i32 %n, i32* %n.addr, align 4 + %0 = load i32, i32* %n.addr, align 4 + %conv = sext i32 %0 to i64 + %1 = alloca i8, i64 %conv, align 16 + %2 = bitcast i8* %1 to i32* + store i32* %2, i32** %a, align 8 + %3 = load i32*, i32** %a, align 8 + call void @"?init@@YAXPEAH@Z"(i32* %3) + ret i32 0 + } + + declare dso_local void @"?init@@YAXPEAH@Z"(i32*) #1 + + ; Function Attrs: nounwind + declare void @llvm.stackprotector(i8*, i8**) #2 + + attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #2 = { nounwind } + +... +--- +name: '?func@@YAHHHHH@Z' +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +registers: +liveins: + - { reg: '$w0', virtual-reg: '' } + - { reg: '$w1', virtual-reg: '' } + - { reg: '$w2', virtual-reg: '' } + - { reg: '$w3', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 8 + adjustsStack: true + hasCalls: true + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 24 + savePoint: '' + restorePoint: '' +fixedStack: +stack: + - { id: 0, name: c.addr, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -4, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 1, name: b.addr, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -8, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 2, name: idx.addr, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -12, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 3, name: n.addr, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -16, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 4, name: a, type: default, offset: 0, size: 8, alignment: 8, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -24, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 5, name: '', type: variable-sized, offset: 0, + alignment: 1, stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -24, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 6, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +constants: +body: | + bb.0.entry: + liveins: $w0, $w1, $w2, $w3 + + STRWui killed renamable $w3, %stack.0.c.addr, 0 :: (store 4 into %ir.c.addr) + STRWui killed renamable $w2, %stack.1.b.addr, 0 :: (store 4 into %ir.b.addr) + STRWui killed renamable $w1, %stack.2.idx.addr, 0 :: (store 4 into %ir.idx.addr) + STRWui killed renamable $w0, %stack.3.n.addr, 0 :: (store 4 into %ir.n.addr) + renamable $x8 = LDRSWui %stack.3.n.addr, 0 :: (dereferenceable load 4 from %ir.n.addr) + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp + renamable $x8 = nuw ADDXri killed renamable $x8, 15, 0 + renamable $x8 = UBFMXri killed renamable $x8, 4, 63 + $x15 = COPY renamable $x8 + STRXui killed $x8, %stack.6, 0 :: (store 8 into %stack.6) + BL &__chkstk, csr_aarch64_stackprobe_windows, implicit-def dead $lr, implicit $sp, implicit killed $x15 + renamable $x8 = COPY $sp + $x15 = LDRXui %stack.6, 0 :: (load 8 from %stack.6) + renamable $x8 = SUBSXrs killed renamable $x8, killed renamable $x15, 4, implicit-def dead $nzcv + $sp = COPY renamable $x8 + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp + STRXui killed renamable $x8, %stack.4.a, 0 :: (store 8 into %ir.a) + renamable $x0 = LDRXui %stack.4.a, 0 :: (dereferenceable load 8 from %ir.a) + ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp + BL @"?init@@YAXPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp + ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp + renamable $w1 = COPY $wzr + $w0 = COPY killed renamable $w1 + RET_ReallyLR implicit killed $w0 + +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame7.mir b/llvm/test/CodeGen/AArch64/wineh-frame7.mir new file mode 100644 index 00000000000..3e3e79eda63 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame7.mir @@ -0,0 +1,189 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Test that stack probe results in Nop unwind codes in the prologue. Test +# save_fplr, save_reg_x and stack_alloc with multiple updates. + +# CHECK: early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -32 +# CHECK-NEXT: frame-setup SEH_SaveReg_X 28, -32 +# CHECK-NEXT: frame-setup STPXi killed $fp, killed $lr, $sp, 2 +# CHECK-NEXT: frame-setup SEH_SaveFPLR 16 +# CHECK-NEXT: $x15 = frame-setup MOVZXi 56009, 0 +# CHECK-NEXT: frame-setup SEH_Nop +# CHECK-NEXT: $x15 = frame-setup MOVKXi $x15, 2, 16 +# CHECK-NEXT: frame-setup SEH_Nop +# CHECK-NEXT: frame-setup BL &__chkstk, implicit-def $lr, implicit $sp, implicit $x15 +# CHECK-NEXT: frame-setup SEH_Nop +# CHECK-NEXT: $sp = frame-setup SUBXrx64 killed $sp, killed $x15, 28 +# CHECK-NEXT: frame-setup SEH_StackAlloc 2993296 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 730, 12 +# CHECK-NEXT: frame-destroy SEH_StackAlloc 2990080 +# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 3216, 0 +# CHECK-NEXT: frame-destroy SEH_StackAlloc 3216 +# CHECK-NEXT: $fp, $lr = frame-destroy LDPXi $sp, 2 +# CHECK-NEXT: frame-destroy SEH_SaveFPLR 16 +# CHECK-NEXT: early-clobber $sp, $x28 = frame-destroy LDRXpost $sp, 32 +# CHECK-NEXT: frame-destroy SEH_SaveReg_X 28, -32 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit killed $w0 +--- | + target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" + target triple = "aarch64-unknown-windows-msvc19.11.0" + + ; Function Attrs: noinline optnone + define dso_local i32 @"?func@@YAHH@Z"(i32 %i) #0 { + entry: + %retval = alloca i32, align 4 + %i.addr = alloca i32, align 4 + %A = alloca [748193 x i32], align 4 + %a = alloca i32, align 4 + %B = alloca [123 x i32], align 4 + store i32 %i, i32* %i.addr, align 4 + %0 = load i32, i32* %i.addr, align 4 + %add = add nsw i32 %0, 2 + store i32 %add, i32* %a, align 4 + %call = call i32 @"?func2@@YAHXZ"() + %1 = load i32, i32* %i.addr, align 4 + %cmp = icmp sgt i32 %1, 2 + br i1 %cmp, label %if.then, label %if.else + + if.then: ; preds = %entry + %call1 = call i32 @"?func2@@YAHXZ"() + store i32 %call1, i32* %retval, align 4 + br label %return + + if.else: ; preds = %entry + %arraydecay = getelementptr inbounds [123 x i32], [123 x i32]* %B, i32 0, i32 0 + %call2 = call i32 @"?func3@@YAHPEAH@Z"(i32* %arraydecay) + store i32 %call2, i32* %retval, align 4 + br label %return + + return: ; preds = %if.else, %if.then + %2 = load i32, i32* %retval, align 4 + ret i32 %2 + } + + declare dso_local i32 @"?func2@@YAHXZ"() #1 + + declare dso_local i32 @"?func3@@YAHPEAH@Z"(i32*) #1 + + ; Function Attrs: nounwind + declare void @llvm.stackprotector(i8*, i8**) #2 + + attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #2 = { nounwind } + +... +--- +name: '?func@@YAHH@Z' +alignment: 2 +exposesReturnsTwice: false +legalized: true +regBankSelected: true +selected: true +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +registers: +liveins: +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 8 + adjustsStack: true + hasCalls: true + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 2993276 + savePoint: '' + restorePoint: '' +fixedStack: +stack: + - { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -4, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 1, name: i.addr, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -8, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 2, name: A, type: default, offset: 0, size: 2992772, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -2992780, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 3, name: a, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -2992784, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 4, name: B, type: default, offset: 0, size: 492, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -2993276, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 5, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } + - { id: 6, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } +constants: +body: | + bb.1.entry: + successors: %bb.2(0x40000000), %bb.3(0x40000000) + liveins: $w0 + + renamable $x8 = ADDXri %stack.1.i.addr, 0, 0 + renamable $w9 = MOVi32imm 2 + STRWui killed renamable $w0, renamable $x8, 0 :: (store 4 into %ir.i.addr) + renamable $w0 = LDRWui renamable $x8, 0 :: (load 4 from %ir.i.addr) + renamable $w0 = ADDWri killed renamable $w0, 2, 0 + STRWui killed renamable $w0, %stack.3.a, 0 :: (store 4 into %ir.a) + ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp + STRXui killed $x8, %stack.5, 0 :: (store 8 into %stack.5) + STRWui killed $w9, %stack.6, 0 :: (store 4 into %stack.6) + BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $w0 + ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp + $x8 = LDRXui %stack.5, 0 :: (load 8 from %stack.5) + renamable $w9 = LDRWui killed renamable $x8, 0 :: (load 4 from %ir.i.addr) + $w10 = LDRWui %stack.6, 0 :: (load 4 from %stack.6) + $wzr = SUBSWrr killed renamable $w9, killed renamable $w10, implicit-def $nzcv + renamable $w9 = CSINCWr $wzr, $wzr, 13, implicit $nzcv + TBNZW killed renamable $w9, 0, %bb.2 + B %bb.3 + + bb.2.if.then: + successors: %bb.4(0x80000000) + + ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp + BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $w0 + ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp + $x8 = LDRXui %stack.5, 0 :: (load 8 from %stack.5) + STRWui killed renamable $w0, killed renamable $x8, 1 :: (store 4 into %ir.retval) + B %bb.4 + + bb.3.if.else: + successors: %bb.4(0x80000000) + + renamable $x8 = ADDXri %stack.4.B, 0, 0 + ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp + $x0 = COPY killed renamable $x8 + BL @"?func3@@YAHPEAH@Z", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit killed $x0, implicit-def $w0 + ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp + $x8 = LDRXui %stack.5, 0 :: (load 8 from %stack.5) + STRWui killed renamable $w0, killed renamable $x8, 1 :: (store 4 into %ir.retval) + + bb.4.return: + $x8 = LDRXui %stack.5, 0 :: (load 8 from %stack.5) + renamable $w0 = LDRWui killed renamable $x8, 1 :: (load 4 from %ir.retval) + RET_ReallyLR implicit killed $w0 + +... diff --git a/llvm/test/CodeGen/AArch64/wineh-frame8.mir b/llvm/test/CodeGen/AArch64/wineh-frame8.mir new file mode 100644 index 00000000000..6fc7416d6d6 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/wineh-frame8.mir @@ -0,0 +1,88 @@ +# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \ +# RUN: -stop-after=prologepilog | FileCheck %s +# Test that the frame lowering emits correct SEH updates for the case without +# a stack frame (e.g. no callee saved registers, no frame pointer, just locals) + +# CHECK: $sp = frame-setup SUBXri $sp, 16, 0 +# CHECK-NEXT: frame-setup SEH_StackAlloc 16 +# CHECK-NEXT: frame-setup SEH_PrologEnd +# CHECK: frame-destroy SEH_EpilogStart +# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 16, 0 +# CHECK-NEXT: frame-destroy SEH_StackAlloc 16 +# CHECK-NEXT: frame-destroy SEH_EpilogEnd +# CHECK-NEXT: RET_ReallyLR implicit killed $w0 + +--- | + target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" + target triple = "aarch64-unknown-windows-msvc19.11.0" + + ; Function Attrs: noinline nounwind optnone uwtable + define dso_local i32 @"?func@@YAHH@Z"(i32 %a) #0 { + entry: + %a.addr = alloca i32, align 4 + %b = alloca i32, align 4 + store i32 %a, i32* %a.addr, align 4 + store i32 2, i32* %b, align 4 + %0 = load i32, i32* %b, align 4 + %1 = load i32, i32* %a.addr, align 4 + %add = add nsw i32 %0, %1 + ret i32 %add + } + + attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + +... +--- +name: '?func@@YAHH@Z' +alignment: 2 +exposesReturnsTwice: false +legalized: true +regBankSelected: true +selected: true +failedISel: false +tracksRegLiveness: true +registers: +liveins: +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 4 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 8 + savePoint: '' + restorePoint: '' +fixedStack: +stack: + - { id: 0, name: a.addr, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -4, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } + - { id: 1, name: b, type: default, offset: 0, size: 4, alignment: 4, + stack-id: 0, callee-saved-register: '', callee-saved-restored: true, + local-offset: -8, debug-info-variable: '', debug-info-expression: '', + debug-info-location: '' } +constants: +body: | + bb.1.entry: + liveins: $w0 + + renamable $w8 = MOVi32imm 2 + STRWui killed renamable $w0, %stack.0.a.addr, 0 :: (store 4 into %ir.a.addr) + STRWui killed renamable $w8, %stack.1.b, 0 :: (store 4 into %ir.b) + renamable $w8 = LDRWui %stack.1.b, 0 :: (load 4 from %ir.b) + renamable $w0 = LDRWui %stack.0.a.addr, 0 :: (load 4 from %ir.a.addr) + renamable $w0 = nsw ADDWrr killed renamable $w8, killed renamable $w0 + RET_ReallyLR implicit killed $w0 + +... |

