1; RUN: llc < %s -mtriple=x86_64-pc-mingw32 | FileCheck %s -check-prefix=WIN64 2 3declare void @bar() 4declare void @baz() 5declare i32 @personality(...) 6 7; Check for 'nop' between the last call and the epilogue. 8define void @foo1() personality i32 (...)* @personality { 9 10 invoke void @bar() 11 to label %normal 12 unwind label %catch 13 14normal: 15 ret void 16 17catch: 18 %1 = landingpad { i8*, i32 } cleanup 19 resume { i8*, i32 } %1 20} 21; WIN64-LABEL: foo1: 22; WIN64: .seh_proc foo1 23; WIN64: callq bar 24; WIN64: nop 25; WIN64: addq ${{[0-9]+}}, %rsp 26; WIN64: retq 27; Check for 'int3' after noreturn call. 28; WIN64: callq _Unwind_Resume 29; WIN64-NEXT: int3 30 31 32; Check it still works when blocks are reordered. 33@something = global i32 0 34define void @foo2(i1 zeroext %cond ) { 35 br i1 %cond, label %a, label %b, !prof !0 36a: 37 call void @bar() 38 br label %done 39b: 40 call void @baz() 41 store i32 0, i32* @something 42 br label %done 43done: 44 ret void 45} 46!0 = !{!"branch_weights", i32 100, i32 0} 47; WIN64-LABEL: foo2: 48; WIN64: callq bar 49; WIN64: nop 50; WIN64: addq ${{[0-9]+}}, %rsp 51; WIN64: retq 52 53 54; Check nop is not emitted when call is not adjacent to epilogue. 55define i32 @foo3() { 56 call void @bar() 57 ret i32 0 58} 59; WIN64-LABEL: foo3: 60; WIN64: callq bar 61; WIN64: xorl 62; WIN64-NOT: nop 63; WIN64: addq ${{[0-9]+}}, %rsp 64; WIN64: retq 65