brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.4 KiB · b97bccd Raw
226 lines · plain
1# RUN: llc -start-before=x86-avoid-trailing-call %s -o - | FileCheck %s2 3# If there is a trailing unreachable block, make sure it is non-empty.4 5# Manually modified the IR of the following C++ to share one unreachable block,6# as clang does for the real C++ throw:7# void __declspec(noreturn) mythrow();8# int multi_throw(bool c1, bool c2, bool c3) {9#   try {10#     if (c1)11#       mythrow();12#     if (c2)13#       mythrow();14#     if (c3)15#       mythrow();16#   } catch (...) {17#     return 1;18#   }19#   return 0;20# }21 22# CHECK-LABEL: "?multi_throw@@YAH_N00@Z": # @"?multi_throw@@YAH_N00@Z"23# CHECK: retq24# CHECK: .LBB{{.*}} # %if.then25# CHECK: callq mythrow26# CHECK: .LBB{{.*}} # %if.then427# CHECK: callq mythrow28# CHECK: .LBB{{.*}} # %if.then829# CHECK: callq mythrow30# CHECK: .LBB{{.*}} # %unreachable31# CHECK-NEXT: int332# CHECK: .seh_endproc33# CHECK: # %catch34 35--- |36  ; ModuleID = '../llvm/test/CodeGen/X86/win64-eh-empty-block-2.ll'37  source_filename = "t.cpp"38  target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"39  target triple = "x86_64-unknown-windows-msvc19.11.0"40 41  ; Function Attrs: uwtable42  define dso_local i32 @"?multi_throw@@YAH_N00@Z"(i1 zeroext %c1, i1 zeroext %c2, i1 zeroext %c3) local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 {43  entry:44    br i1 %c1, label %if.then, label %if.end45 46  if.then:                                          ; preds = %entry47    invoke void @mythrow()48            to label %unreachable unwind label %catch.dispatch49 50  unreachable:                                      ; preds = %if.then8, %if.then4, %if.then51    unreachable52 53  if.end:                                           ; preds = %entry54    br i1 %c2, label %if.then4, label %if.end655 56  if.then4:                                         ; preds = %if.end57    invoke void @mythrow()58            to label %unreachable unwind label %catch.dispatch59 60  if.end6:                                          ; preds = %if.end61    br i1 %c3, label %if.then8, label %return62 63  if.then8:                                         ; preds = %if.end664    invoke void @mythrow()65            to label %unreachable unwind label %catch.dispatch66 67  catch.dispatch:                                   ; preds = %if.then8, %if.then4, %if.then68    %0 = catchswitch within none [label %catch] unwind to caller69 70  catch:                                            ; preds = %catch.dispatch71    %1 = catchpad within %0 [ptr null, i32 64, ptr null]72    catchret from %1 to label %return73 74  return:                                           ; preds = %catch, %if.end675    %retval.0 = phi i32 [ 1, %catch ], [ 0, %if.end6 ]76    ret i32 %retval.077  }78 79  declare dso_local void @mythrow()80 81  declare dso_local i32 @__CxxFrameHandler3(...)82 83  attributes #0 = { uwtable }84 85  !llvm.module.flags = !{!0, !1}86 87  !0 = !{i32 1, !"wchar_size", i32 2}88  !1 = !{i32 7, !"PIC Level", i32 2}89 90...91---92name:            '?multi_throw@@YAH_N00@Z'93alignment:       1694exposesReturnsTwice: false95legalized:       false96regBankSelected: false97selected:        false98failedISel:      false99tracksRegLiveness: true100hasWinCFI:       true101registers:       []102liveins:103  - { reg: '$cl', virtual-reg: '' }104  - { reg: '$dl', virtual-reg: '' }105  - { reg: '$r8b', virtual-reg: '' }106frameInfo:107  isFrameAddressTaken: false108  isReturnAddressTaken: false109  hasStackMap:     false110  hasPatchPoint:   false111  stackSize:       56112  offsetAdjustment: -56113  maxAlignment:    8114  adjustsStack:    true115  hasCalls:        true116  stackProtector:  ''117  maxCallFrameSize: 32118  cvBytesOfCalleeSavedRegisters: 0119  hasOpaqueSPAdjustment: true120  hasVAStart:      false121  hasMustTailInVarArgFunc: false122  localFrameSize:  0123  savePoint:       []124  restorePoint:    []125fixedStack:126  - { id: 0, type: default, offset: -24, size: 8, alignment: 8, stack-id: default,127      isImmutable: false, isAliased: false, callee-saved-register: '',128      callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '',129      debug-info-location: '' }130  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,131      callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '',132      debug-info-expression: '', debug-info-location: '' }133stack:134  - { id: 0, name: '', type: spill-slot, offset: -28, size: 4, alignment: 4,135      stack-id: default, callee-saved-register: '', callee-saved-restored: true,136      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }137callSites:       []138constants:       []139machineFunctionInfo: {}140body:             |141  bb.0.entry:142    successors: %bb.1(0x00000001), %bb.3(0x7fffffff)143    liveins: $cl, $dl, $r8b144 145    frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp146    frame-setup SEH_PushReg 50147    $rsp = frame-setup SUB64ri8 $rsp, 48, implicit-def dead $eflags148    frame-setup SEH_StackAlloc 48149    $rbp = LEA64r $rsp, 1, $noreg, 48, $noreg150    frame-setup SEH_SetFrame 50, 48151    frame-setup SEH_EndPrologue152    MOV64mi32 $rbp, 1, $noreg, -8, $noreg, -2 :: (store (s64) into %fixed-stack.0)153    TEST8rr killed renamable $cl, renamable $cl, implicit-def $eflags154    JCC_1 %bb.1, 5, implicit $eflags155 156  bb.3.if.end:157    successors: %bb.4(0x00000001), %bb.5(0x7fffffff)158    liveins: $dl, $r8b159 160    TEST8rr killed renamable $dl, renamable $dl, implicit-def $eflags161    JCC_1 %bb.4, 5, implicit $eflags162 163  bb.5.if.end6:164    successors: %bb.6(0x00000001), %bb.8(0x7fffffff)165    liveins: $r8b166 167    MOV32mi $rbp, 1, $noreg, -12, $noreg, 0 :: (store (s32) into %stack.0)168    TEST8rr killed renamable $r8b, renamable $r8b, implicit-def $eflags169    JCC_1 %bb.6, 5, implicit $eflags170 171  bb.8.return (machine-block-address-taken):172    $eax = MOV32rm $rbp, 1, $noreg, -12, $noreg :: (load (s32) from %stack.0)173    SEH_BeginEpilogue174    $rsp = frame-destroy ADD64ri8 $rsp, 48, implicit-def dead $eflags175    $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp176    SEH_EndEpilogue177    RET64 $eax178 179  bb.1.if.then:180    successors: %bb.2(0x7ffff800), %bb.7(0x00000800)181 182    EH_LABEL <mcsymbol .Leh1>183    CALL64pcrel32 @mythrow, csr_win64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp184    EH_LABEL <mcsymbol .Leh2>185    JMP_1 %bb.2186 187  bb.4.if.then4:188    successors: %bb.2(0x7ffff800), %bb.7(0x00000800)189 190    EH_LABEL <mcsymbol .Leh3>191    CALL64pcrel32 @mythrow, csr_win64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp192    EH_LABEL <mcsymbol .Leh4>193    JMP_1 %bb.2194 195  bb.6.if.then8:196    successors: %bb.2(0x7ffff800), %bb.7(0x00000800)197 198    EH_LABEL <mcsymbol .Leh5>199    CALL64pcrel32 @mythrow, csr_win64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp200    EH_LABEL <mcsymbol .Leh6>201 202  bb.2.unreachable:203    successors:204 205 206  bb.7.catch (landing-pad, ehfunclet-entry):207    successors: %bb.8(0x80000000)208    liveins: $rdx209 210    frame-setup MOV64mr killed $rsp, 1, $noreg, 16, $noreg, $rdx211    frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp212    frame-setup SEH_PushReg 50213    $rsp = frame-setup SUB64ri8 $rsp, 32, implicit-def dead $eflags214    frame-setup SEH_StackAlloc 32215    $rbp = LEA64r $rdx, 1, $noreg, 48, $noreg216    frame-setup SEH_EndPrologue217    MOV32mi $rbp, 1, $noreg, -12, $noreg, 1 :: (store (s32) into %stack.0)218    $rax = LEA64r $rip, 0, $noreg, %bb.8, $noreg219    SEH_BeginEpilogue220    $rsp = frame-destroy ADD64ri8 $rsp, 32, implicit-def dead $eflags221    $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp222    SEH_EndEpilogue223    CATCHRET %bb.8, %bb.0224 225...226