1# Assembly generated from building the following C++ code with the following 2# command using trunk clang. Then, basic block at .LBB1_7 was moved before the 3# landing pad. 4# 5# clang --target=x86_64-linux -O2 -fPIC -fno-inline exceptions-failed-split.cpp 6# 7# #include <stdio.h> 8# #include <stdint.h> 9# 10# void bar(int a) { 11# if (a > 2 && a % 2) 12# throw new int(); 13# } 14# 15# uint64_t throw_test(int argc, char **argv) { 16# uint64_t rv = 0; 17# 18# if (argc == 99) 19# return 0; 20# 21# uint64_t limit = (argc >= 2 ? 10 : 5000); 22# for (uint64_t i = 0; i < limit; ++i) { 23# rv += i; 24# try { 25# bar(argc); 26# } catch (...) { 27# } 28# } 29# 30# if (argc == 5) 31# return 0; 32# 33# if (argc == 7) 34# return 0; 35# 36# if (argc >= 103 && argc <= 203) 37# return 0; 38# 39# if (*argv == 0) 40# return 0; 41# 42# if (argc >= 13 && argc <= 23) 43# return 0; 44# 45# return rv; 46# } 47# 48# int main(int argc, char **argv) { 49# return !throw_test(argc, argv); 50# } 51 52 .text 53 .file "exceptions-failed-split.cpp" 54 .globl _Z3bari # -- Begin function _Z3bari 55 .p2align 4, 0x90 56 .type _Z3bari,@function 57_Z3bari: # @_Z3bari 58.Lfunc_begin0: 59 .cfi_startproc 60 .cfi_personality 155, DW.ref.__gxx_personality_v0 61 .cfi_lsda 27, .Lexception0 62# %bb.0: # %entry 63 pushq %r14 64 .cfi_def_cfa_offset 16 65 pushq %rbx 66 .cfi_def_cfa_offset 24 67 pushq %rax 68 .cfi_def_cfa_offset 32 69 .cfi_offset %rbx, -24 70 .cfi_offset %r14, -16 71 cmpl $3, %edi 72 jl .LBB0_5 73# %bb.1: # %entry 74 andl $1, %edi 75 jne .LBB0_2 76.LBB0_5: # %if.end 77 addq $8, %rsp 78 .cfi_def_cfa_offset 24 79 popq %rbx 80 .cfi_def_cfa_offset 16 81 popq %r14 82 .cfi_def_cfa_offset 8 83 retq 84.LBB0_2: # %if.then 85 .cfi_def_cfa_offset 32 86 movl $8, %edi 87 callq __cxa_allocate_exception@PLT 88 movq %rax, %rbx 89.Ltmp0: 90 movl $4, %edi 91 callq _Znwm@PLT 92.Ltmp1: 93# %bb.3: # %invoke.cont 94 movl $0, (%rax) 95 movq %rax, (%rbx) 96 movq _ZTIPi@GOTPCREL(%rip), %rsi 97 movq %rbx, %rdi 98 xorl %edx, %edx 99 callq __cxa_throw@PLT 100.LBB0_4: # %lpad 101.Ltmp2: 102 movq %rax, %r14 103 movq %rbx, %rdi 104 callq __cxa_free_exception@PLT 105 movq %r14, %rdi 106 callq _Unwind_Resume@PLT 107.Lfunc_end0: 108 .size _Z3bari, .Lfunc_end0-_Z3bari 109 .cfi_endproc 110 .section .gcc_except_table,"a",@progbits 111 .p2align 2 112GCC_except_table0: 113.Lexception0: 114 .byte 255 # @LPStart Encoding = omit 115 .byte 255 # @TType Encoding = omit 116 .byte 1 # Call site Encoding = uleb128 117 .uleb128 .Lcst_end0-.Lcst_begin0 118.Lcst_begin0: 119 .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << 120 .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0 121 .byte 0 # has no landing pad 122 .byte 0 # On action: cleanup 123 .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 << 124 .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1 125 .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2 126 .byte 0 # On action: cleanup 127 .uleb128 .Ltmp1-.Lfunc_begin0 # >> Call Site 3 << 128 .uleb128 .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0 129 .byte 0 # has no landing pad 130 .byte 0 # On action: cleanup 131.Lcst_end0: 132 .p2align 2 133 # -- End function 134 .text 135 .globl _Z10throw_testiPPc # -- Begin function _Z10throw_testiPPc 136 .p2align 4, 0x90 137 .type _Z10throw_testiPPc,@function 138_Z10throw_testiPPc: # @_Z10throw_testiPPc 139.Lfunc_begin1: 140 .cfi_startproc 141 .cfi_personality 155, DW.ref.__gxx_personality_v0 142 .cfi_lsda 27, .Lexception1 143# %bb.0: # %entry 144 pushq %r15 145 .cfi_def_cfa_offset 16 146 pushq %r14 147 .cfi_def_cfa_offset 24 148 pushq %r13 149 .cfi_def_cfa_offset 32 150 pushq %r12 151 .cfi_def_cfa_offset 40 152 pushq %rbx 153 .cfi_def_cfa_offset 48 154 .cfi_offset %rbx, -48 155 .cfi_offset %r12, -40 156 .cfi_offset %r13, -32 157 .cfi_offset %r14, -24 158 .cfi_offset %r15, -16 159 cmpl $99, %edi 160 je .LBB1_7 161# %bb.2: # %if.end 162 movq %rsi, %r15 163 movl %edi, %r14d 164 cmpl $2, %edi 165 movl $10, %eax 166 movl $5000, %r12d # imm = 0x1388 167 cmovgeq %rax, %r12 168 xorl %r13d, %r13d 169 xorl %ebx, %ebx 170 .p2align 4, 0x90 171.LBB1_3: # %for.body 172 # =>This Inner Loop Header: Depth=1 173.Ltmp3: 174 movl %r14d, %edi 175 callq _Z3bari@PLT 176.Ltmp4: 177.LBB1_4: # %for.inc 178 # in Loop: Header=BB1_3 Depth=1 179 addq %rbx, %r13 180 incq %rbx 181 cmpq %rbx, %r12 182 jne .LBB1_3 183 jmp .LBB1_6 184.LBB1_7: 185 xorl %r13d, %r13d 186 jmp .LBB1_8 187.LBB1_5: # %lpad 188 # in Loop: Header=BB1_3 Depth=1 189.Ltmp5: 190 movq %rax, %rdi 191 callq __cxa_begin_catch@PLT 192 callq __cxa_end_catch@PLT 193 jmp .LBB1_4 194.LBB1_6: # %for.cond.cleanup 195 movl %r14d, %eax 196 orl $2, %eax 197 cmpl $7, %eax 198 jne .LBB1_9 199 jmp .LBB1_7 200.LBB1_8: # %cleanup21 201 movq %r13, %rax 202 popq %rbx 203 .cfi_def_cfa_offset 40 204 popq %r12 205 .cfi_def_cfa_offset 32 206 popq %r13 207 .cfi_def_cfa_offset 24 208 popq %r14 209 .cfi_def_cfa_offset 16 210 popq %r15 211 .cfi_def_cfa_offset 8 212 retq 213.LBB1_9: # %if.end8 214 .cfi_def_cfa_offset 48 215 leal -103(%r14), %eax 216 cmpl $101, %eax 217 jb .LBB1_7 218# %bb.11: # %if.end12 219 cmpq $0, (%r15) 220 je .LBB1_7 221# %bb.12: # %if.end15 222 addl $-13, %r14d 223 xorl %eax, %eax 224 cmpl $11, %r14d 225 cmovbq %rax, %r13 226 jmp .LBB1_8 227.Lfunc_end1: 228 .size _Z10throw_testiPPc, .Lfunc_end1-_Z10throw_testiPPc 229 .cfi_endproc 230 .section .gcc_except_table,"a",@progbits 231 .p2align 2 232GCC_except_table1: 233.Lexception1: 234 .byte 255 # @LPStart Encoding = omit 235 .byte 155 # @TType Encoding = indirect pcrel sdata4 236 .uleb128 .Lttbase0-.Lttbaseref0 237.Lttbaseref0: 238 .byte 1 # Call site Encoding = uleb128 239 .uleb128 .Lcst_end1-.Lcst_begin1 240.Lcst_begin1: 241 .uleb128 .Ltmp3-.Lfunc_begin1 # >> Call Site 1 << 242 .uleb128 .Ltmp4-.Ltmp3 # Call between .Ltmp3 and .Ltmp4 243 .uleb128 .Ltmp5-.Lfunc_begin1 # jumps to .Ltmp5 244 .byte 1 # On action: 1 245 .uleb128 .Ltmp4-.Lfunc_begin1 # >> Call Site 2 << 246 .uleb128 .Lfunc_end1-.Ltmp4 # Call between .Ltmp4 and .Lfunc_end1 247 .byte 0 # has no landing pad 248 .byte 0 # On action: cleanup 249.Lcst_end1: 250 .byte 1 # >> Action Record 1 << 251 # Catch TypeInfo 1 252 .byte 0 # No further actions 253 .p2align 2 254 # >> Catch TypeInfos << 255 .long 0 # TypeInfo 1 256.Lttbase0: 257 .p2align 2 258 # -- End function 259 .text 260 .globl main # -- Begin function main 261 .p2align 4, 0x90 262 .type main,@function 263main: # @main 264 .cfi_startproc 265# %bb.0: # %entry 266 pushq %rax 267 .cfi_def_cfa_offset 16 268 callq _Z10throw_testiPPc@PLT 269 xorl %ecx, %ecx 270 testq %rax, %rax 271 sete %cl 272 movl %ecx, %eax 273 popq %rcx 274 .cfi_def_cfa_offset 8 275 retq 276.Lfunc_end2: 277 .size main, .Lfunc_end2-main 278 .cfi_endproc 279 # -- End function 280 .hidden DW.ref.__gxx_personality_v0 281 .weak DW.ref.__gxx_personality_v0 282 .section .data.DW.ref.__gxx_personality_v0,"aGw",@progbits,DW.ref.__gxx_personality_v0,comdat 283 .p2align 3 284 .type DW.ref.__gxx_personality_v0,@object 285 .size DW.ref.__gxx_personality_v0, 8 286DW.ref.__gxx_personality_v0: 287 .quad __gxx_personality_v0 288 .ident "clang version 15.0.0" 289 .section ".note.GNU-stack","",@progbits 290 .addrsig 291 .addrsig_sym __gxx_personality_v0 292 .addrsig_sym _Unwind_Resume 293 .addrsig_sym _ZTIPi 294