1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -passes=verify,iroutliner -no-ir-sim-branch-matching -ir-outlining-no-cost < %s | FileCheck %s 3 4; This test checks that catchpad instructions are not outlined even if they 5; in a similar section. Dealing with exception handling inside of an outlined 6; function would require a lot of handling that is not implemented yet. 7 8declare void @llvm.donothing() nounwind readnone 9 10define void @function1() personality i8 3 { 11; CHECK-LABEL: @function1( 12; CHECK-NEXT: entry: 13; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 14; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4 15; CHECK-NEXT: invoke void @llvm.donothing() 16; CHECK-NEXT: to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]] 17; CHECK: exception: 18; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catchpad1] unwind to caller 19; CHECK: catchpad1: 20; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [] 21; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]]) 22; CHECK-NEXT: br label [[NORMAL]] 23; CHECK: normal: 24; CHECK-NEXT: ret void 25; 26entry: 27 %a = alloca i32, align 4 28 %b = alloca i32, align 4 29 invoke void @llvm.donothing() to label %normal unwind label %exception 30exception: 31 %cs1 = catchswitch within none [label %catchpad1] unwind to caller 32catchpad1: 33 catchpad within %cs1 [] 34 store i32 2, ptr %a, align 4 35 store i32 3, ptr %b, align 4 36 br label %normal 37normal: 38 ret void 39} 40 41define void @function2() personality i8 3 { 42; CHECK-LABEL: @function2( 43; CHECK-NEXT: entry: 44; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 45; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4 46; CHECK-NEXT: invoke void @llvm.donothing() 47; CHECK-NEXT: to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]] 48; CHECK: exception: 49; CHECK-NEXT: [[CS1:%.*]] = catchswitch within none [label %catchpad1] unwind to caller 50; CHECK: catchpad1: 51; CHECK-NEXT: [[TMP0:%.*]] = catchpad within [[CS1]] [] 52; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]]) 53; CHECK-NEXT: br label [[NORMAL]] 54; CHECK: normal: 55; CHECK-NEXT: ret void 56; 57entry: 58 %a = alloca i32, align 4 59 %b = alloca i32, align 4 60 invoke void @llvm.donothing() to label %normal unwind label %exception 61exception: 62 %cs1 = catchswitch within none [label %catchpad1] unwind to caller 63catchpad1: 64 catchpad within %cs1 [] 65 store i32 2, ptr %a, align 4 66 store i32 3, ptr %b, align 4 67 br label %normal 68normal: 69 ret void 70} 71