1 ; RUN: opt -S -winehprepare < %s | FileCheck %s
3 ; Check that things work when the mid-level optimizer inlines the finally
6 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-pc-windows-msvc"
10 declare void @may_crash()
11 declare i32 @__C_specific_handler(...)
13 define void @use_finally() {
15 invoke void @may_crash()
16 to label %invoke.cont unwind label %lpad
18 invoke.cont: ; preds = %entry
19 %call.i = tail call i32 @puts(i8* null)
22 lpad: ; preds = %entry
23 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
25 %call.i2 = tail call i32 @puts(i8* null)
26 resume { i8*, i32 } %0
29 ; CHECK-LABEL: define void @use_finally()
30 ; CHECK: invoke void @may_crash()
34 ; CHECK-NEXT: call i8* (...) @llvm.eh.actions(i32 0, void (i8*, i8*)* @use_finally.cleanup)
35 ; CHECK-NEXT: indirectbr i8* %recover, []