1 ; Check if landing pads are kept in a separate eh section
2 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=i386-unknown-linux-gnu -function-sections -basic-block-sections=all -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
4 @_ZTIb = external dso_local constant ptr
5 define i32 @_Z3foob(i1 zeroext %0) #0 personality ptr @__gxx_personality_v0 {
6 %2 = alloca i32, align 4
7 %3 = alloca i8, align 1
10 %6 = alloca i8, align 1
12 store i8 %7, ptr %3, align 1
13 %8 = load i8, ptr %3, align 1
14 %9 = trunc i8 %8 to i1
15 br i1 %9, label %10, label %11
18 store i32 1, ptr %2, align 4
22 %12 = call ptr @__cxa_allocate_exception(i64 1) #2
23 %13 = load i8, ptr %3, align 1
24 %14 = trunc i8 %13 to i1
25 %15 = zext i1 %14 to i8
26 store i8 %15, ptr %12, align 16
27 invoke void @__cxa_throw(ptr %12, ptr @_ZTIb, ptr null) #3
28 to label %38 unwind label %16
31 %17 = landingpad { ptr, i32 }
33 %18 = extractvalue { ptr, i32 } %17, 0
34 store ptr %18, ptr %4, align 8
35 %19 = extractvalue { ptr, i32 } %17, 1
36 store i32 %19, ptr %5, align 4
40 %21 = load i32, ptr %5, align 4
41 %22 = call i32 @llvm.eh.typeid.for(ptr @_ZTIb) #2
42 %23 = icmp eq i32 %21, %22
43 br i1 %23, label %24, label %33
46 %25 = load ptr, ptr %4, align 8
47 %26 = call ptr @__cxa_begin_catch(ptr %25) #2
48 %27 = load i8, ptr %26, align 1
49 %28 = trunc i8 %27 to i1
50 %29 = zext i1 %28 to i8
51 store i8 %29, ptr %6, align 1
52 call void @__cxa_end_catch() #2
56 store i32 0, ptr %2, align 4
59 31: ; preds = %30, %10
60 %32 = load i32, ptr %2, align 4
64 %34 = load ptr, ptr %4, align 8
65 %35 = load i32, ptr %5, align 4
66 %36 = insertvalue { ptr, i32 } undef, ptr %34, 0
67 %37 = insertvalue { ptr, i32 } %36, i32 %35, 1
68 resume { ptr, i32 } %37
73 declare ptr @__cxa_allocate_exception(i64)
74 declare void @__cxa_throw(ptr, ptr, ptr)
75 declare i32 @__gxx_personality_v0(...)
76 ; Function Attrs: nounwind readnone
77 declare i32 @llvm.eh.typeid.for(ptr) #1
78 declare ptr @__cxa_begin_catch(ptr)
79 declare void @__cxa_end_catch()
81 ;LINUX-SECTIONS: .section .text._Z3foob,"ax",@progbits
82 ;LINUX-SECTIONS: _Z3foob:
83 ;LINUX-SECTIONS: .section .text._Z3foob._Z3foob.__part.{{[0-9]+}},"ax",@progbits
84 ;LINUX-SECTIONS-LABEL: _Z3foob.__part.{{[0-9]+}}:
85 ;LINUX-SECTIONS: calll __cxa_begin_catch