69 lines · plain
1; RUN: llc < %s | FileCheck %s2 3; In PR44697, the register allocator inserted loads into the __except block4; before the instructions that restore EBP and ESP back to what they should be.5; Make sure they are the first instructions in the __except block.6 7; ModuleID = 't.cpp'8source_filename = "t.cpp"9target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"10target triple = "i386-pc-windows-msvc19.24.28315"11 12declare ptr @llvm.frameaddress.p0(i32 immarg)13declare ptr @llvm.eh.recoverfp(ptr, ptr)14declare ptr @llvm.localrecover(ptr, ptr, i32 immarg)15declare dso_local i32 @_except_handler3(...)16declare void @llvm.localescape(...)17 18define dso_local zeroext i1 @invokewrapper(19 ptr nocapture %Fn,20 i1 zeroext %DumpStackAndCleanup,21 ptr nocapture dereferenceable(4) %RetCode)22 personality ptr @_except_handler3 {23entry:24 %__exception_code = alloca i32, align 425 call void (...) @llvm.localescape(ptr nonnull %__exception_code)26 invoke void %Fn()27 to label %return unwind label %catch.dispatch28 29catch.dispatch: ; preds = %entry30 %0 = catchswitch within none [label %__except.ret] unwind to caller31 32__except.ret: ; preds = %catch.dispatch33 %1 = catchpad within %0 [ptr @filter]34 catchret from %1 to label %__except35 36__except: ; preds = %__except.ret37 %2 = load i32, ptr %__exception_code, align 438 store i32 %2, ptr %RetCode, align 439 br label %return40 41return: ; preds = %entry, %__except42 %retval.0 = phi i1 [ false, %__except ], [ true, %entry ]43 ret i1 %retval.044}45 46; CHECK-LABEL: _invokewrapper: # @invokewrapper47; CHECK: calll *8(%ebp)48; CHECK: LBB0_2: # %return49 50; CHECK: LBB0_1: # %__except.ret51; CHECK-NEXT: $ehgcr_0_1:52; CHECK-NEXT: movl -24(%ebp), %esp53; CHECK-NEXT: addl $12, %ebp54 55; Function Attrs: nofree nounwind56define internal i32 @filter() {57entry:58 %0 = tail call ptr @llvm.frameaddress.p0(i32 1)59 %1 = tail call ptr @llvm.eh.recoverfp(ptr @invokewrapper, ptr %0)60 %2 = tail call ptr @llvm.localrecover(ptr @invokewrapper, ptr %1, i32 0)61 %3 = getelementptr inbounds i8, ptr %0, i32 -2062 %4 = load ptr, ptr %3, align 463 %5 = getelementptr inbounds { ptr, ptr }, ptr %4, i32 0, i32 064 %6 = load ptr, ptr %5, align 465 %7 = load i32, ptr %6, align 466 store i32 %7, ptr %2, align 467 ret i32 168}69