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
4 ; This test checks that cleanuppad 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.
8 declare void @llvm.donothing() nounwind readnone
10 define void @function1() personality i8 3 {
11 ; CHECK-LABEL: @function1(
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:%.*]]
18 ; CHECK-NEXT: [[CLEAN:%.*]] = cleanuppad within none []
19 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]])
20 ; CHECK-NEXT: br label [[NORMAL]]
22 ; CHECK-NEXT: ret void
25 %a = alloca i32, align 4
26 %b = alloca i32, align 4
27 invoke void @llvm.donothing() to label %normal unwind label %exception
29 %clean = cleanuppad within none []
30 store i32 2, ptr %a, align 4
31 store i32 3, ptr %b, align 4
37 define void @function2() personality i8 3 {
38 ; CHECK-LABEL: @function2(
40 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
41 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
42 ; CHECK-NEXT: invoke void @llvm.donothing()
43 ; CHECK-NEXT: to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]]
45 ; CHECK-NEXT: [[CLEAN:%.*]] = cleanuppad within none []
46 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]])
47 ; CHECK-NEXT: br label [[NORMAL]]
49 ; CHECK-NEXT: ret void
52 %a = alloca i32, align 4
53 %b = alloca i32, align 4
54 invoke void @llvm.donothing() to label %normal unwind label %exception
56 %clean = cleanuppad within none []
57 store i32 2, ptr %a, align 4
58 store i32 3, ptr %b, align 4