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