451 lines · plain
1# RUN: split-file %s %t2 3# If we force "best effort" mode, then we won't see any errors, but we won't use4# v2.5# BESTEFFORT-NOT: SEH_UnwindVersion6# BESTEFFORT-NOT: SEH_UnwindV2Start7 8;--- alloc_no_dealloc.mir9# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \10# RUN: %t/alloc_no_dealloc.mir -run-pass=x86-wineh-unwindv2 2>&1 | \11# RUN: FileCheck %s --check-prefix=ALLOC-NO-DEALLOC12# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/alloc_no_dealloc.mir \13# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \14# RUN: FileCheck %s --check-prefix=BESTEFFORT15# ALLOC-NO-DEALLOC: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'alloc_no_dealloc':16# ALLOC-NO-DEALLOC-SAME: The prolog made a stack allocation, but the epilog did not deallocate it17 18--- |19 define dso_local void @alloc_no_dealloc() local_unnamed_addr {20 entry:21 ret void22 }23 !llvm.module.flags = !{!0}24 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}25...26---27name: alloc_no_dealloc28body: |29 bb.0.entry:30 $rsp = frame-setup SUB64ri32 $rsp, 40, implicit-def dead $eflags31 frame-setup SEH_StackAlloc 4032 frame-setup SEH_EndPrologue33 SEH_BeginEpilogue34 SEH_EndEpilogue35 RET6436...37 38;--- missed_push.mir39# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - %t/missed_push.mir \40# RUN: -run-pass=x86-wineh-unwindv2 2>&1 | FileCheck %s \41# RUN: --check-prefix=MISSED-PUSH42# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/missed_push.mir \43# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \44# RUN: FileCheck %s --check-prefix=BESTEFFORT45# MISSED-PUSH: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'missed_push':46# MISSED-PUSH-SAME: The prolog pushed more registers than the epilog popped47 48--- |49 define dso_local void @missed_push() local_unnamed_addr {50 entry:51 ret void52 }53 !llvm.module.flags = !{!0}54 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}55...56---57name: missed_push58body: |59 bb.0.entry:60 frame-setup PUSH64r killed $rsi, implicit-def $rsp, implicit $rsp61 frame-setup SEH_PushReg 6062 frame-setup PUSH64r killed $rdi, implicit-def $rsp, implicit $rsp63 frame-setup SEH_PushReg 5564 frame-setup SEH_EndPrologue65 SEH_BeginEpilogue66 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp67 SEH_EndEpilogue68 RET6469...70 71;--- dealloc_no_alloc.mir72# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \73# RUN: %t/dealloc_no_alloc.mir -run-pass=x86-wineh-unwindv2 2>&1 | \74# RUN: FileCheck %s --check-prefix=DEALLOC-NO-ALLOC75# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/dealloc_no_alloc.mir \76# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \77# RUN: FileCheck %s --check-prefix=BESTEFFORT78# DEALLOC-NO-ALLOC: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'dealloc_no_alloc':79# DEALLOC-NO-ALLOC-SAME: The epilog is deallocating a stack allocation, but the prolog did not allocate one80 81--- |82 define dso_local void @dealloc_no_alloc() local_unnamed_addr {83 entry:84 ret void85 }86 !llvm.module.flags = !{!0}87 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}88...89---90name: dealloc_no_alloc91body: |92 bb.0.entry:93 frame-setup SEH_EndPrologue94 SEH_BeginEpilogue95 $rsp = frame-destroy ADD64ri32 $rsp, 40, implicit-def dead $eflags96 SEH_EndEpilogue97 RET6498...99 100;--- dealloc_after_epilog.mir101# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \102# RUN: %t/dealloc_after_epilog.mir -run-pass=x86-wineh-unwindv2 2>&1 | \103# RUN: FileCheck %s --check-prefix=DEALLOC-AFTER-EPILOG104# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - \105# RUN: %t/dealloc_after_epilog.mir -run-pass=x86-wineh-unwindv2 \106# RUN: -x86-wineh-unwindv2-force-mode=1 | FileCheck %s \107# RUN: --check-prefix=BESTEFFORT108# DEALLOC-AFTER-EPILOG: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'dealloc_after_epilog':109# DEALLOC-AFTER-EPILOG-SAME: Unexpected lea or add instruction after the epilog110 111--- |112 define dso_local void @dealloc_after_epilog() local_unnamed_addr {113 entry:114 ret void115 }116 !llvm.module.flags = !{!0}117 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}118...119---120name: dealloc_after_epilog121body: |122 bb.0.entry:123 frame-setup SEH_EndPrologue124 SEH_BeginEpilogue125 SEH_EndEpilogue126 $rsp = frame-destroy ADD64ri32 $rsp, 40, implicit-def dead $eflags127 RET64128...129 130;--- pop_before_dealloc.mir131# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \132# RUN: %t/pop_before_dealloc.mir -run-pass=x86-wineh-unwindv2 2>&1 | \133# RUN: FileCheck %s --check-prefix=POP-BEFORE-DEALLOC134# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/pop_before_dealloc.mir \135# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \136# RUN: FileCheck %s --check-prefix=BESTEFFORT137# POP-BEFORE-DEALLOC: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'pop_before_dealloc':138# POP-BEFORE-DEALLOC-SAME: Cannot pop registers before the stack allocation has been deallocated139 140--- |141 define dso_local void @pop_before_dealloc() local_unnamed_addr {142 entry:143 ret void144 }145 !llvm.module.flags = !{!0}146 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}147...148---149name: pop_before_dealloc150body: |151 bb.0.entry:152 frame-setup PUSH64r killed $rdi, implicit-def $rsp, implicit $rsp153 frame-setup SEH_PushReg 55154 $rsp = frame-setup SUB64ri32 $rsp, 40, implicit-def dead $eflags155 frame-setup SEH_StackAlloc 40156 frame-setup SEH_EndPrologue157 SEH_BeginEpilogue158 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp159 $rsp = frame-destroy ADD64ri32 $rsp, 40, implicit-def dead $eflags160 SEH_EndEpilogue161 RET64162...163 164;--- mov_no_setframe.mir165# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \166# RUN: %t/mov_no_setframe.mir -run-pass=x86-wineh-unwindv2 2>&1 | \167# RUN: FileCheck %s --check-prefix=MOV-NO-SETFRAME168# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/mov_no_setframe.mir \169# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \170# RUN: FileCheck %s --check-prefix=BESTEFFORT171# MOV-NO-SETFRAME: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'mov_no_setframe':172# MOV-NO-SETFRAME-SAME: The epilog is setting frame back, but prolog did not set it173 174--- |175 define dso_local void @mov_no_setframe() local_unnamed_addr {176 entry:177 ret void178 }179 !llvm.module.flags = !{!0}180 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}181...182---183name: mov_no_setframe184body: |185 bb.0.entry:186 frame-setup SEH_EndPrologue187 SEH_BeginEpilogue188 $rsp = MOV64rr $rbp189 SEH_EndEpilogue190 RET64191...192 193;--- mov_after_epilog.mir194# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \195# RUN: %t/mov_after_epilog.mir -run-pass=x86-wineh-unwindv2 2>&1 | \196# RUN: FileCheck %s --check-prefix=MOV-AFTER-EPILOG197# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - \198# RUN: %t/mov_after_epilog.mir -run-pass=x86-wineh-unwindv2 \199# RUN: -x86-wineh-unwindv2-force-mode=1 | FileCheck %s \200# RUN: --check-prefix=BESTEFFORT201# MOV-AFTER-EPILOG: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'mov_after_epilog':202# MOV-AFTER-EPILOG-SAME: Unexpected mov instruction after the epilog203 204--- |205 define dso_local void @mov_after_epilog() local_unnamed_addr {206 entry:207 ret void208 }209 !llvm.module.flags = !{!0}210 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}211...212---213name: mov_after_epilog214body: |215 bb.0.entry:216 $rbp = MOV64rr $rsp217 frame-setup SEH_SetFrame 52, 0218 frame-setup SEH_EndPrologue219 SEH_BeginEpilogue220 SEH_EndEpilogue221 $rsp = MOV64rr $rbp222 RET64223...224 225;--- pop_before_mov.mir226# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \227# RUN: %t/pop_before_mov.mir -run-pass=x86-wineh-unwindv2 2>&1 | \228# RUN: FileCheck %s --check-prefix=POP-BEFORE-MOV229# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/pop_before_mov.mir \230# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \231# RUN: FileCheck %s --check-prefix=BESTEFFORT232# POP-BEFORE-MOV: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'pop_before_mov':233# POP-BEFORE-MOV-SAME: The epilog is setting the frame back after popping registers234 235--- |236 define dso_local void @pop_before_mov() local_unnamed_addr {237 entry:238 ret void239 }240 !llvm.module.flags = !{!0}241 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}242...243---244name: pop_before_mov245body: |246 bb.0.entry:247 frame-setup PUSH64r killed $rdi, implicit-def $rsp, implicit $rsp248 frame-setup SEH_PushReg 55249 $rbp = MOV64rr $rsp250 frame-setup SEH_SetFrame 52, 0251 frame-setup SEH_EndPrologue252 SEH_BeginEpilogue253 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp254 $rsp = MOV64rr $rbp255 SEH_EndEpilogue256 RET64257...258 259;--- mov_after_dealloc.mir260# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \261# RUN: %t/mov_after_dealloc.mir -run-pass=x86-wineh-unwindv2 2>&1 | \262# RUN: FileCheck %s --check-prefix=MOV-AFTER-DEALLOC263# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/mov_after_dealloc.mir \264# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \265# RUN: FileCheck %s --check-prefix=BESTEFFORT266# MOV-AFTER-DEALLOC: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'mov_after_dealloc':267# MOV-AFTER-DEALLOC-SAME: Cannot set the frame back after the stack allocation has been deallocated268 269--- |270 define dso_local void @mov_after_dealloc() local_unnamed_addr {271 entry:272 ret void273 }274 !llvm.module.flags = !{!0}275 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}276...277---278name: mov_after_dealloc279body: |280 bb.0.entry:281 $rbp = MOV64rr $rsp282 frame-setup SEH_SetFrame 52, 0283 $rsp = frame-setup SUB64ri32 $rsp, 40, implicit-def dead $eflags284 frame-setup SEH_StackAlloc 40285 frame-setup SEH_EndPrologue286 SEH_BeginEpilogue287 $rsp = frame-destroy ADD64ri32 $rsp, 40, implicit-def dead $eflags288 $rsp = MOV64rr $rbp289 SEH_EndEpilogue290 RET64291...292 293;--- too_many_pops.mir294# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - %t/too_many_pops.mir \295# RUN: -run-pass=x86-wineh-unwindv2 2>&1 | FileCheck %s \296# RUN: --check-prefix=TOO-MANY-POPS297# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/too_many_pops.mir \298# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \299# RUN: FileCheck %s --check-prefix=BESTEFFORT300# TOO-MANY-POPS: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'too_many_pops':301# TOO-MANY-POPS-SAME: The epilog is popping more registers than the prolog pushed302 303--- |304 define dso_local void @too_many_pops() local_unnamed_addr {305 entry:306 ret void307 }308 !llvm.module.flags = !{!0}309 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}310...311---312name: too_many_pops313body: |314 bb.0.entry:315 frame-setup PUSH64r killed $rdi, implicit-def $rsp, implicit $rsp316 frame-setup SEH_PushReg 55317 frame-setup SEH_EndPrologue318 SEH_BeginEpilogue319 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp320 $rsi = frame-destroy POP64r implicit-def $rsp, implicit $rsp321 SEH_EndEpilogue322 RET64323...324 325;--- pop_in_wrong_order.mir326# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \327# RUN: %t/pop_in_wrong_order.mir -run-pass=x86-wineh-unwindv2 2>&1 | \328# RUN: FileCheck %s --check-prefix=POP-WRONG-ORDER329# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/pop_in_wrong_order.mir \330# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \331# RUN: FileCheck %s --check-prefix=BESTEFFORT332# POP-WRONG-ORDER: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'pop_in_wrong_order':333# POP-WRONG-ORDER-SAME: The epilog is popping a registers in a different order than the prolog pushed them334 335--- |336 define dso_local void @pop_in_wrong_order() local_unnamed_addr {337 entry:338 ret void339 }340 !llvm.module.flags = !{!0}341 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}342...343---344name: pop_in_wrong_order345body: |346 bb.0.entry:347 frame-setup PUSH64r killed $rdi, implicit-def $rsp, implicit $rsp348 frame-setup SEH_PushReg 55349 frame-setup PUSH64r killed $rsi, implicit-def $rsp, implicit $rsp350 frame-setup SEH_PushReg 60351 frame-setup SEH_EndPrologue352 SEH_BeginEpilogue353 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp354 $rsi = frame-destroy POP64r implicit-def $rsp, implicit $rsp355 SEH_EndEpilogue356 RET64357...358 359;--- pop_after_epilog.mir360# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \361# RUN: %t/pop_after_epilog.mir -run-pass=x86-wineh-unwindv2 2>&1 | \362# RUN: FileCheck %s --check-prefix=POP-AFTER-EPILOG363# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/pop_after_epilog.mir \364# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \365# RUN: FileCheck %s --check-prefix=BESTEFFORT366# POP-AFTER-EPILOG: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'pop_after_epilog':367# POP-AFTER-EPILOG-SAME: Registers are being popped after the epilog368 369--- |370 define dso_local void @pop_after_epilog() local_unnamed_addr {371 entry:372 ret void373 }374 !llvm.module.flags = !{!0}375 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}376...377---378name: pop_after_epilog379body: |380 bb.0.entry:381 frame-setup SEH_EndPrologue382 SEH_BeginEpilogue383 SEH_EndEpilogue384 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp385 RET64386...387 388;--- instr_after_epilog.mir389# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \390# RUN: %t/instr_after_epilog.mir -run-pass=x86-wineh-unwindv2 2>&1 | \391# RUN: FileCheck %s --check-prefix=INSTR-AFTER-END392# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/instr_after_epilog.mir \393# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \394# RUN: FileCheck %s --check-prefix=BESTEFFORT395# INSTR-AFTER-END: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'instr_after_epilog':396# INSTR-AFTER-END-SAME: Unexpected instruction in or after the epilog397 398--- |399 define dso_local void @instr_after_epilog() local_unnamed_addr {400 entry:401 ret void402 }403 !llvm.module.flags = !{!0}404 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}405...406---407name: instr_after_epilog408body: |409 bb.0.entry:410 frame-setup SEH_EndPrologue411 SEH_BeginEpilogue412 SEH_EndEpilogue413 $ecx = MOV32rr killed $eax414 RET64415...416 417;--- dealloc_pop_dealloc.mir418# RUN: not --crash llc -mtriple=x86_64-pc-windows-msvc -o - \419# RUN: %t/dealloc_pop_dealloc.mir -run-pass=x86-wineh-unwindv2 2>&1 | \420# RUN: FileCheck %s --check-prefix=DEALLOC-POP-DEALLOC421# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %t/dealloc_pop_dealloc.mir \422# RUN: -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-force-mode=1 | \423# RUN: FileCheck %s --check-prefix=BESTEFFORT424# DEALLOC-POP-DEALLOC: LLVM ERROR: Windows x64 Unwind v2 is required, but LLVM has generated incompatible code in function 'dealloc_pop_dealloc':425# DEALLOC-POP-DEALLOC-SAME: The epilog is deallocating a stack allocation after popping registers426 427--- |428 define dso_local void @dealloc_pop_dealloc() local_unnamed_addr {429 entry:430 ret void431 }432 !llvm.module.flags = !{!0}433 !0 = !{i32 1, !"winx64-eh-unwindv2", i32 2}434...435---436name: dealloc_pop_dealloc437body: |438 bb.0.entry:439 frame-setup PUSH64r killed $rdi, implicit-def $rsp, implicit $rsp440 frame-setup SEH_PushReg 55441 $rsp = frame-setup SUB64ri32 $rsp, 40, implicit-def dead $eflags442 frame-setup SEH_StackAlloc 40443 frame-setup SEH_EndPrologue444 SEH_BeginEpilogue445 $rsp = frame-destroy ADD64ri32 $rsp, 20, implicit-def dead $eflags446 $rdi = frame-destroy POP64r implicit-def $rsp, implicit $rsp447 $rsp = frame-destroy ADD64ri32 $rsp, 20, implicit-def dead $eflags448 SEH_EndEpilogue449 RET64450...451