73 lines · plain
1; RUN: llc -regalloc=greedy -mtriple=x86_64-pc-windows-msvc < %s -o - | FileCheck %s2 3; This test checks for proper handling of a condition where the greedy register4; allocator encounters a very short interval that contains no uses but does5; contain an EH pad unwind edge, which requires spilling. Previously the6; register allocator marked a interval like this as unspillable, resulting in7; a compilation failure.8 9 10; The following checks that the value %p is reloaded within the catch handler.11; CHECK-LABEL: "?catch$8@?0?test@4HA":12; CHECK: .seh_endprologue13; CHECK: movq -16(%rbp), %rax14; CHECK: movb $0, (%rax)15 16define ptr @test(ptr %a) personality ptr @__CxxFrameHandler3 {17entry:18 %call = call i32 @f()19 br i1 undef, label %if.end, label %if.else20 21if.else: ; preds = %entry22 br i1 undef, label %cond.false.i, label %if.else.else23 24if.else.else: ; preds = %if.else25 br i1 undef, label %cond.true.i, label %cond.false.i26 27cond.true.i: ; preds = %if.else.else28 br label %invoke.cont29 30cond.false.i: ; preds = %if.else.else, %if.else31 %call.i = invoke i32 @f()32 to label %invoke.cont unwind label %catch.dispatch33 34catch.dispatch: ; preds = %cond.false.i35 %tmp0 = catchswitch within none [label %catch] unwind label %ehcleanup36 37catch: ; preds = %catch.dispatch38 %tmp1 = catchpad within %tmp0 [ptr null, i32 64, ptr null]39 store i8 0, ptr %a, align 840 invoke void @_CxxThrowException(ptr null, ptr null) [ "funclet"(token %tmp1) ]41 to label %noexc unwind label %ehcleanup42 43noexc: ; preds = %catch44 unreachable45 46invoke.cont: ; preds = %cond.false.i, %cond.true.i47 %cond.i = phi i32 [ %call, %cond.true.i ], [ %call.i, %cond.false.i ]48 %cmp = icmp eq i32 %cond.i, -149 %tmp3 = select i1 %cmp, i32 4, i32 050 br label %if.end51 52if.end: ; preds = %invoke.cont, %entry53 %state.0 = phi i32 [ %tmp3, %invoke.cont ], [ 4, %entry ]54 invoke void @g(ptr %a, i32 %state.0)55 to label %invoke.cont.1 unwind label %ehcleanup56 57invoke.cont.1: ; preds = %if.end58 ret ptr %a59 60ehcleanup: ; preds = %if.end, %catch, %catch.dispatch61 %tmp4 = cleanuppad within none []62 cleanupret from %tmp4 unwind to caller63}64 65%eh.ThrowInfo = type { i32, i32, i32, i32 }66 67declare i32 @__CxxFrameHandler3(...)68 69declare void @_CxxThrowException(ptr, ptr)70 71declare i32 @f()72declare void @g(ptr, i32)73