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 i8*
5 define i32 @_Z3foob(i1 zeroext %0) #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
6 %2 = alloca i32, align 4
7 %3 = alloca i8, align 1
10 %6 = alloca i8, align 1
12 store i8 %7, i8* %3, align 1
13 %8 = load i8, i8* %3, align 1
14 %9 = trunc i8 %8 to i1
15 br i1 %9, label %10, label %11
18 store i32 1, i32* %2, align 4
22 %12 = call i8* @__cxa_allocate_exception(i64 1) #2
23 %13 = load i8, i8* %3, align 1
24 %14 = trunc i8 %13 to i1
25 %15 = zext i1 %14 to i8
26 store i8 %15, i8* %12, align 16
27 invoke void @__cxa_throw(i8* %12, i8* bitcast (i8** @_ZTIb to i8*), i8* null) #3
28 to label %38 unwind label %16
31 %17 = landingpad { i8*, i32 }
32 catch i8* bitcast (i8** @_ZTIb to i8*)
33 %18 = extractvalue { i8*, i32 } %17, 0
34 store i8* %18, i8** %4, align 8
35 %19 = extractvalue { i8*, i32 } %17, 1
36 store i32 %19, i32* %5, align 4
40 %21 = load i32, i32* %5, align 4
41 %22 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIb to i8*)) #2
42 %23 = icmp eq i32 %21, %22
43 br i1 %23, label %24, label %33
46 %25 = load i8*, i8** %4, align 8
47 %26 = call i8* @__cxa_begin_catch(i8* %25) #2
48 %27 = load i8, i8* %26, align 1
49 %28 = trunc i8 %27 to i1
50 %29 = zext i1 %28 to i8
51 store i8 %29, i8* %6, align 1
52 call void @__cxa_end_catch() #2
56 store i32 0, i32* %2, align 4
59 31: ; preds = %30, %10
60 %32 = load i32, i32* %2, align 4
64 %34 = load i8*, i8** %4, align 8
65 %35 = load i32, i32* %5, align 4
66 %36 = insertvalue { i8*, i32 } undef, i8* %34, 0
67 %37 = insertvalue { i8*, i32 } %36, i32 %35, 1
68 resume { i8*, i32 } %37
73 declare i8* @__cxa_allocate_exception(i64)
74 declare void @__cxa_throw(i8*, i8*, i8*)
75 declare i32 @__gxx_personality_v0(...)
76 ; Function Attrs: nounwind readnone
77 declare i32 @llvm.eh.typeid.for(i8*) #1
78 declare i8* @__cxa_begin_catch(i8*)
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