272 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple x86_64-unknown-unknown -exception-model sjlj -verify-machineinstrs=0 -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s --check-prefix=NUM3; RUN: llc -mtriple x86_64-unknown-unknown -exception-model sjlj -verify-machineinstrs=0 -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s --check-prefix=SJLJ4 5@_ZTIi = external dso_local constant ptr6@_ZTIc = external dso_local constant ptr7 8; Function Attrs: noinline norecurse optnone uwtable9define dso_local i32 @main() #0 personality ptr @__gxx_personality_sj0 {10; NUM-LABEL: main:11; NUM: # %bb.0: # %entry12; NUM-NEXT: endbr6413; NUM-NEXT: pushq %rbp14; NUM-NEXT: movq %rsp, %rbp15; NUM-NEXT: pushq %r1516; NUM-NEXT: pushq %r1417; NUM-NEXT: pushq %r1318; NUM-NEXT: pushq %r1219; NUM-NEXT: pushq %rbx20; NUM-NEXT: subq $120, %rsp21; NUM-NEXT: movl $0, -44(%rbp)22; NUM-NEXT: movq $__gxx_personality_sj0, -120(%rbp)23; NUM-NEXT: movq $GCC_except_table0, -112(%rbp)24; NUM-NEXT: movq %rbp, -104(%rbp)25; NUM-NEXT: movq %rsp, -88(%rbp)26; NUM-NEXT: movq $.LBB0_9, -96(%rbp)27; NUM-NEXT: leaq -152(%rbp), %rdi28; NUM-NEXT: callq _Unwind_SjLj_Register@PLT29; NUM-NEXT: movl $1, -144(%rbp)30; NUM-NEXT: .Ltmp0:31; NUM-NEXT: callq _Z3foov32; NUM-NEXT: .Ltmp1:33; NUM-NEXT: # %bb.1: # %invoke.cont34; NUM-NEXT: movl $1, -44(%rbp)35; NUM-NEXT: .LBB0_7: # %return36; NUM-NEXT: movl -44(%rbp), %ebx37; NUM-NEXT: leaq -152(%rbp), %rdi38; NUM-NEXT: callq _Unwind_SjLj_Unregister@PLT39; NUM-NEXT: movl %ebx, %eax40; NUM-NEXT: addq $120, %rsp41; NUM-NEXT: popq %rbx42; NUM-NEXT: popq %r1243; NUM-NEXT: popq %r1344; NUM-NEXT: popq %r1445; NUM-NEXT: popq %r1546; NUM-NEXT: popq %rbp47; NUM-NEXT: retq48; NUM-NEXT: .LBB0_9:49; NUM-NEXT: endbr6450; NUM-NEXT: movl -144(%rbp), %eax51; NUM-NEXT: cmpl $1, %eax52; NUM-NEXT: jb .LBB0_1053; NUM-NEXT: # %bb.11:54; NUM-NEXT: ud255; NUM-NEXT: .LBB0_10:56; NUM-NEXT: leaq .LJTI0_0(%rip), %rcx57; NUM-NEXT: jmpq *(%rcx,%rax,8)58; NUM-NEXT: .LBB0_2: # %lpad59; NUM-NEXT: .Ltmp2:60; NUM-NEXT: endbr6461; NUM-NEXT: movl -140(%rbp), %ecx62; NUM-NEXT: movl -136(%rbp), %eax63; NUM-NEXT: movq %rcx, -56(%rbp)64; NUM-NEXT: movl %eax, -64(%rbp)65; NUM-NEXT: cmpl $2, %eax66; NUM-NEXT: jne .LBB0_467; NUM-NEXT: # %bb.3: # %catch368; NUM-NEXT: movq -56(%rbp), %rdi69; NUM-NEXT: movl $-1, -144(%rbp)70; NUM-NEXT: callq __cxa_begin_catch71; NUM-NEXT: movl (%rax), %eax72; NUM-NEXT: movl %eax, -60(%rbp)73; NUM-NEXT: xorl %ecx, %ecx74; NUM-NEXT: cmpl $5, %eax75; NUM-NEXT: jmp .LBB0_676; NUM-NEXT: .LBB0_4: # %catch.fallthrough77; NUM-NEXT: cmpl $1, %eax78; NUM-NEXT: jne .LBB0_879; NUM-NEXT: # %bb.5: # %catch80; NUM-NEXT: movq -56(%rbp), %rdi81; NUM-NEXT: movl $-1, -144(%rbp)82; NUM-NEXT: callq __cxa_begin_catch83; NUM-NEXT: movzbl (%rax), %eax84; NUM-NEXT: movb %al, -45(%rbp)85; NUM-NEXT: xorl %ecx, %ecx86; NUM-NEXT: cmpb $3, %al87; NUM-NEXT: .LBB0_6: # %return88; NUM-NEXT: setne %cl89; NUM-NEXT: movl %ecx, -44(%rbp)90; NUM-NEXT: movl $-1, -144(%rbp)91; NUM-NEXT: callq __cxa_end_catch92; NUM-NEXT: jmp .LBB0_793; NUM-NEXT: .LBB0_8: # %eh.resume94; NUM-NEXT: movl $-1, -144(%rbp)95;96; SJLJ-LABEL: main:97; SJLJ: # %bb.0: # %entry98; SJLJ-NEXT: endbr6499; SJLJ-NEXT: pushq %rbp100; SJLJ-NEXT: movq %rsp, %rbp101; SJLJ-NEXT: pushq %r15102; SJLJ-NEXT: pushq %r14103; SJLJ-NEXT: pushq %r13104; SJLJ-NEXT: pushq %r12105; SJLJ-NEXT: pushq %rbx106; SJLJ-NEXT: subq $120, %rsp107; SJLJ-NEXT: movl $0, -44(%rbp)108; SJLJ-NEXT: movq $__gxx_personality_sj0, -120(%rbp)109; SJLJ-NEXT: movq $GCC_except_table0, -112(%rbp)110; SJLJ-NEXT: movq %rbp, -104(%rbp)111; SJLJ-NEXT: movq %rsp, -88(%rbp)112; SJLJ-NEXT: movq $.LBB0_9, -96(%rbp)113; SJLJ-NEXT: leaq -152(%rbp), %rdi114; SJLJ-NEXT: callq _Unwind_SjLj_Register@PLT115; SJLJ-NEXT: movl $1, -144(%rbp)116; SJLJ-NEXT: .Ltmp0:117; SJLJ-NEXT: callq _Z3foov118; SJLJ-NEXT: .Ltmp1:119; SJLJ-NEXT: # %bb.1: # %invoke.cont120; SJLJ-NEXT: movl $1, -44(%rbp)121; SJLJ-NEXT: .LBB0_7: # %return122; SJLJ-NEXT: movl -44(%rbp), %ebx123; SJLJ-NEXT: leaq -152(%rbp), %rdi124; SJLJ-NEXT: callq _Unwind_SjLj_Unregister@PLT125; SJLJ-NEXT: movl %ebx, %eax126; SJLJ-NEXT: addq $120, %rsp127; SJLJ-NEXT: popq %rbx128; SJLJ-NEXT: popq %r12129; SJLJ-NEXT: popq %r13130; SJLJ-NEXT: popq %r14131; SJLJ-NEXT: popq %r15132; SJLJ-NEXT: popq %rbp133; SJLJ-NEXT: retq134; SJLJ-NEXT: .LBB0_9:135; SJLJ-NEXT: endbr64136; SJLJ-NEXT: movl -144(%rbp), %eax137; SJLJ-NEXT: cmpl $1, %eax138; SJLJ-NEXT: jb .LBB0_10139; SJLJ-NEXT: # %bb.11:140; SJLJ-NEXT: ud2141; SJLJ-NEXT: .LBB0_10:142; SJLJ-NEXT: leaq .LJTI0_0(%rip), %rcx143; SJLJ-NEXT: jmpq *(%rcx,%rax,8)144; SJLJ-NEXT: .LBB0_2: # %lpad145; SJLJ-NEXT: .Ltmp2:146; SJLJ-NEXT: endbr64147; SJLJ-NEXT: movl -140(%rbp), %ecx148; SJLJ-NEXT: movl -136(%rbp), %eax149; SJLJ-NEXT: movq %rcx, -56(%rbp)150; SJLJ-NEXT: movl %eax, -64(%rbp)151; SJLJ-NEXT: cmpl $2, %eax152; SJLJ-NEXT: jne .LBB0_4153; SJLJ-NEXT: # %bb.3: # %catch3154; SJLJ-NEXT: movq -56(%rbp), %rdi155; SJLJ-NEXT: movl $-1, -144(%rbp)156; SJLJ-NEXT: callq __cxa_begin_catch157; SJLJ-NEXT: movl (%rax), %eax158; SJLJ-NEXT: movl %eax, -60(%rbp)159; SJLJ-NEXT: xorl %ecx, %ecx160; SJLJ-NEXT: cmpl $5, %eax161; SJLJ-NEXT: jmp .LBB0_6162; SJLJ-NEXT: .LBB0_4: # %catch.fallthrough163; SJLJ-NEXT: cmpl $1, %eax164; SJLJ-NEXT: jne .LBB0_8165; SJLJ-NEXT: # %bb.5: # %catch166; SJLJ-NEXT: movq -56(%rbp), %rdi167; SJLJ-NEXT: movl $-1, -144(%rbp)168; SJLJ-NEXT: callq __cxa_begin_catch169; SJLJ-NEXT: movzbl (%rax), %eax170; SJLJ-NEXT: movb %al, -45(%rbp)171; SJLJ-NEXT: xorl %ecx, %ecx172; SJLJ-NEXT: cmpb $3, %al173; SJLJ-NEXT: .LBB0_6: # %return174; SJLJ-NEXT: setne %cl175; SJLJ-NEXT: movl %ecx, -44(%rbp)176; SJLJ-NEXT: movl $-1, -144(%rbp)177; SJLJ-NEXT: callq __cxa_end_catch178; SJLJ-NEXT: jmp .LBB0_7179; SJLJ-NEXT: .LBB0_8: # %eh.resume180; SJLJ-NEXT: movl $-1, -144(%rbp)181entry:182 %retval = alloca i32, align 4183 %exn.slot = alloca ptr184 %ehselector.slot = alloca i32185 %x = alloca i8, align 1186 %x4 = alloca i32, align 4187 store i32 0, ptr %retval, align 4188 invoke void @_Z3foov()189 to label %invoke.cont unwind label %lpad190 191invoke.cont: ; preds = %entry192 br label %try.cont193 194lpad: ; preds = %entry195 %0 = landingpad { ptr, i32 }196 catch ptr @_ZTIi197 catch ptr @_ZTIc198 %1 = extractvalue { ptr, i32 } %0, 0199 store ptr %1, ptr %exn.slot, align 8200 %2 = extractvalue { ptr, i32 } %0, 1201 store i32 %2, ptr %ehselector.slot, align 4202 br label %catch.dispatch203 204catch.dispatch: ; preds = %lpad205 %sel = load i32, ptr %ehselector.slot, align 4206 %3 = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) #3207 %matches = icmp eq i32 %sel, %3208 br i1 %matches, label %catch3, label %catch.fallthrough209 210catch3: ; preds = %catch.dispatch211 %exn5 = load ptr, ptr %exn.slot, align 8212 %4 = call ptr @__cxa_begin_catch(ptr %exn5) #3213 %5 = load i32, ptr %4, align 4214 store i32 %5, ptr %x4, align 4215 %6 = load i32, ptr %x4, align 4216 %cmp6 = icmp ne i32 %6, 5217 %conv7 = zext i1 %cmp6 to i32218 store i32 %conv7, ptr %retval, align 4219 call void @__cxa_end_catch() #3220 br label %return221 222catch.fallthrough: ; preds = %catch.dispatch223 %7 = call i32 @llvm.eh.typeid.for(ptr @_ZTIc) #3224 %matches1 = icmp eq i32 %sel, %7225 br i1 %matches1, label %catch, label %eh.resume226 227catch: ; preds = %catch.fallthrough228 %exn = load ptr, ptr %exn.slot, align 8229 %8 = call ptr @__cxa_begin_catch(ptr %exn) #3230 %9 = load i8, ptr %8, align 1231 store i8 %9, ptr %x, align 1232 %10 = load i8, ptr %x, align 1233 %conv = sext i8 %10 to i32234 %cmp = icmp ne i32 %conv, 3235 %conv2 = zext i1 %cmp to i32236 store i32 %conv2, ptr %retval, align 4237 call void @__cxa_end_catch() #3238 br label %return239 240try.cont: ; preds = %invoke.cont241 store i32 1, ptr %retval, align 4242 br label %return243 244return: ; preds = %try.cont, %catch3, %catch245 %11 = load i32, ptr %retval, align 4246 ret i32 %11247 248eh.resume: ; preds = %catch.fallthrough249 %exn8 = load ptr, ptr %exn.slot, align 8250 %sel9 = load i32, ptr %ehselector.slot, align 4251 %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn8, 0252 %lpad.val10 = insertvalue { ptr, i32 } %lpad.val, i32 %sel9, 1253 resume { ptr, i32 } %lpad.val10254}255 256declare dso_local void @_Z3foov() #1257 258declare dso_local i32 @__gxx_personality_sj0(...)259 260; Function Attrs: nounwind readnone261declare i32 @llvm.eh.typeid.for(ptr) #2262 263declare dso_local ptr @__cxa_begin_catch(ptr)264 265declare dso_local void @__cxa_end_catch()266 267!llvm.module.flags = !{!0, !1, !2}268 269!0 = !{i32 1, !"wchar_size", i32 4}270!1 = !{i32 8, !"cf-protection-return", i32 1}271!2 = !{i32 8, !"cf-protection-branch", i32 1}272