65 lines · plain
1; RUN: llc < %s -mtriple=x86_64-pc-mingw32 | FileCheck %s -check-prefix=WIN642 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 ptr @personality {9 10 invoke void @bar()11 to label %normal12 unwind label %catch13 14normal:15 ret void16 17catch:18 %1 = landingpad { ptr, i32 } cleanup19 resume { ptr, i32 } %120}21; WIN64-LABEL: foo1:22; WIN64: .seh_proc foo123; WIN64: callq bar24; WIN64: nop25; WIN64: addq ${{[0-9]+}}, %rsp26; WIN64: retq27; Check for 'int3' after noreturn call.28; WIN64: callq _Unwind_Resume29; WIN64-NEXT: int330 31 32; Check it still works when blocks are reordered.33@something = global i32 034define void @foo2(i1 zeroext %cond ) {35 br i1 %cond, label %a, label %b, !prof !036a:37 call void @bar()38 br label %done39b:40 call void @baz()41 store i32 0, ptr @something42 br label %done43done:44 ret void45}46!0 = !{!"branch_weights", i32 100, i32 0}47; WIN64-LABEL: foo2:48; WIN64: callq bar49; WIN64: nop50; WIN64: addq ${{[0-9]+}}, %rsp51; WIN64: retq52 53 54; Check nop is not emitted when call is not adjacent to epilogue.55define i32 @foo3() {56 call void @bar()57 ret i32 058}59; WIN64-LABEL: foo3:60; WIN64: callq bar61; WIN64: xorl62; WIN64-NOT: nop63; WIN64: addq ${{[0-9]+}}, %rsp64; WIN64: retq65