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 landingpad 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: [[CLEANUP:%.*]] = landingpad i8
20 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]])
21 ; CHECK-NEXT: br label [[NORMAL]]
23 ; CHECK-NEXT: ret void
26 %a = alloca i32, align 4
27 %b = alloca i32, align 4
28 invoke void @llvm.donothing() to label %normal unwind label %exception
30 %cleanup = landingpad i8 cleanup
31 store i32 2, ptr %a, align 4
32 store i32 3, ptr %b, align 4
38 define void @function2() personality i8 3 {
39 ; CHECK-LABEL: @function2(
41 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
42 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
43 ; CHECK-NEXT: invoke void @llvm.donothing()
44 ; CHECK-NEXT: to label [[NORMAL:%.*]] unwind label [[EXCEPTION:%.*]]
46 ; CHECK-NEXT: [[CLEANUP:%.*]] = landingpad i8
48 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]])
49 ; CHECK-NEXT: br label [[NORMAL]]
51 ; CHECK-NEXT: ret void
54 %a = alloca i32, align 4
55 %b = alloca i32, align 4
56 invoke void @llvm.donothing() to label %normal unwind label %exception
58 %cleanup = landingpad i8 cleanup
59 store i32 2, ptr %a, align 4
60 store i32 3, ptr %b, align 4