294 lines · plain
1# Assembly generated from building the following C++ code with the following2# command using trunk clang. Then, basic block at .LBB1_7 was moved before the3# landing pad.4#5# clang --target=x86_64-linux -O2 -fPIC -fno-inline exceptions-failed-split.cpp6#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 .text53 .file "exceptions-failed-split.cpp"54 .globl _Z3bari # -- Begin function _Z3bari55 .p2align 4, 0x9056 .type _Z3bari,@function57_Z3bari: # @_Z3bari58.Lfunc_begin0:59 .cfi_startproc60 .cfi_personality 155, DW.ref.__gxx_personality_v061 .cfi_lsda 27, .Lexception062# %bb.0: # %entry63 pushq %r1464 .cfi_def_cfa_offset 1665 pushq %rbx66 .cfi_def_cfa_offset 2467 pushq %rax68 .cfi_def_cfa_offset 3269 .cfi_offset %rbx, -2470 .cfi_offset %r14, -1671 cmpl $3, %edi72 jl .LBB0_573# %bb.1: # %entry74 andl $1, %edi75 jne .LBB0_276.LBB0_5: # %if.end77 addq $8, %rsp78 .cfi_def_cfa_offset 2479 popq %rbx80 .cfi_def_cfa_offset 1681 popq %r1482 .cfi_def_cfa_offset 883 retq84.LBB0_2: # %if.then85 .cfi_def_cfa_offset 3286 movl $8, %edi87 callq __cxa_allocate_exception@PLT88 movq %rax, %rbx89.Ltmp0:90 movl $4, %edi91 callq _Znwm@PLT92.Ltmp1:93# %bb.3: # %invoke.cont94 movl $0, (%rax)95 movq %rax, (%rbx)96 movq _ZTIPi@GOTPCREL(%rip), %rsi97 movq %rbx, %rdi98 xorl %edx, %edx99 callq __cxa_throw@PLT100.LBB0_4: # %lpad101.Ltmp2:102 movq %rax, %r14103 movq %rbx, %rdi104 callq __cxa_free_exception@PLT105 movq %r14, %rdi106 callq _Unwind_Resume@PLT107.Lfunc_end0:108 .size _Z3bari, .Lfunc_end0-_Z3bari109 .cfi_endproc110 .section .gcc_except_table,"a",@progbits111 .p2align 2112GCC_except_table0:113.Lexception0:114 .byte 255 # @LPStart Encoding = omit115 .byte 255 # @TType Encoding = omit116 .byte 1 # Call site Encoding = uleb128117 .uleb128 .Lcst_end0-.Lcst_begin0118.Lcst_begin0:119 .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<120 .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0121 .byte 0 # has no landing pad122 .byte 0 # On action: cleanup123 .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<124 .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1125 .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2126 .byte 0 # On action: cleanup127 .uleb128 .Ltmp1-.Lfunc_begin0 # >> Call Site 3 <<128 .uleb128 .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0129 .byte 0 # has no landing pad130 .byte 0 # On action: cleanup131.Lcst_end0:132 .p2align 2133 # -- End function134 .text135 .globl _Z10throw_testiPPc # -- Begin function _Z10throw_testiPPc136 .p2align 4, 0x90137 .type _Z10throw_testiPPc,@function138_Z10throw_testiPPc: # @_Z10throw_testiPPc139.Lfunc_begin1:140 .cfi_startproc141 .cfi_personality 155, DW.ref.__gxx_personality_v0142 .cfi_lsda 27, .Lexception1143# %bb.0: # %entry144 pushq %r15145 .cfi_def_cfa_offset 16146 pushq %r14147 .cfi_def_cfa_offset 24148 pushq %r13149 .cfi_def_cfa_offset 32150 pushq %r12151 .cfi_def_cfa_offset 40152 pushq %rbx153 .cfi_def_cfa_offset 48154 .cfi_offset %rbx, -48155 .cfi_offset %r12, -40156 .cfi_offset %r13, -32157 .cfi_offset %r14, -24158 .cfi_offset %r15, -16159 cmpl $99, %edi160 je .LBB1_7161# %bb.2: # %if.end162 movq %rsi, %r15163 movl %edi, %r14d164 cmpl $2, %edi165 movl $10, %eax166 movl $5000, %r12d # imm = 0x1388167 cmovgeq %rax, %r12168 xorl %r13d, %r13d169 xorl %ebx, %ebx170 .p2align 4, 0x90171.LBB1_3: # %for.body172 # =>This Inner Loop Header: Depth=1173.Ltmp3:174 movl %r14d, %edi175 callq _Z3bari@PLT176.Ltmp4:177.LBB1_4: # %for.inc178 # in Loop: Header=BB1_3 Depth=1179 addq %rbx, %r13180 incq %rbx181 cmpq %rbx, %r12182 jne .LBB1_3183 jmp .LBB1_6184.LBB1_7:185 xorl %r13d, %r13d186 jmp .LBB1_8187.LBB1_5: # %lpad188 # in Loop: Header=BB1_3 Depth=1189.Ltmp5:190 movq %rax, %rdi191 callq __cxa_begin_catch@PLT192 callq __cxa_end_catch@PLT193 jmp .LBB1_4194.LBB1_6: # %for.cond.cleanup195 movl %r14d, %eax196 orl $2, %eax197 cmpl $7, %eax198 jne .LBB1_9199 jmp .LBB1_7200.LBB1_8: # %cleanup21201 movq %r13, %rax202 popq %rbx203 .cfi_def_cfa_offset 40204 popq %r12205 .cfi_def_cfa_offset 32206 popq %r13207 .cfi_def_cfa_offset 24208 popq %r14209 .cfi_def_cfa_offset 16210 popq %r15211 .cfi_def_cfa_offset 8212 retq213.LBB1_9: # %if.end8214 .cfi_def_cfa_offset 48215 leal -103(%r14), %eax216 cmpl $101, %eax217 jb .LBB1_7218# %bb.11: # %if.end12219 cmpq $0, (%r15)220 je .LBB1_7221# %bb.12: # %if.end15222 addl $-13, %r14d223 xorl %eax, %eax224 cmpl $11, %r14d225 cmovbq %rax, %r13226 jmp .LBB1_8227.Lfunc_end1:228 .size _Z10throw_testiPPc, .Lfunc_end1-_Z10throw_testiPPc229 .cfi_endproc230 .section .gcc_except_table,"a",@progbits231 .p2align 2232GCC_except_table1:233.Lexception1:234 .byte 255 # @LPStart Encoding = omit235 .byte 155 # @TType Encoding = indirect pcrel sdata4236 .uleb128 .Lttbase0-.Lttbaseref0237.Lttbaseref0:238 .byte 1 # Call site Encoding = uleb128239 .uleb128 .Lcst_end1-.Lcst_begin1240.Lcst_begin1:241 .uleb128 .Ltmp3-.Lfunc_begin1 # >> Call Site 1 <<242 .uleb128 .Ltmp4-.Ltmp3 # Call between .Ltmp3 and .Ltmp4243 .uleb128 .Ltmp5-.Lfunc_begin1 # jumps to .Ltmp5244 .byte 1 # On action: 1245 .uleb128 .Ltmp4-.Lfunc_begin1 # >> Call Site 2 <<246 .uleb128 .Lfunc_end1-.Ltmp4 # Call between .Ltmp4 and .Lfunc_end1247 .byte 0 # has no landing pad248 .byte 0 # On action: cleanup249.Lcst_end1:250 .byte 1 # >> Action Record 1 <<251 # Catch TypeInfo 1252 .byte 0 # No further actions253 .p2align 2254 # >> Catch TypeInfos <<255 .long 0 # TypeInfo 1256.Lttbase0:257 .p2align 2258 # -- End function259 .text260 .globl main # -- Begin function main261 .p2align 4, 0x90262 .type main,@function263main: # @main264 .cfi_startproc265# %bb.0: # %entry266 pushq %rax267 .cfi_def_cfa_offset 16268 callq _Z10throw_testiPPc@PLT269 xorl %ecx, %ecx270 testq %rax, %rax271 sete %cl272 movl %ecx, %eax273 popq %rcx274 .cfi_def_cfa_offset 8275 retq276.Lfunc_end2:277 .size main, .Lfunc_end2-main278 .cfi_endproc279 # -- End function280 .hidden DW.ref.__gxx_personality_v0281 .weak DW.ref.__gxx_personality_v0282 .section .data.DW.ref.__gxx_personality_v0,"aGw",@progbits,DW.ref.__gxx_personality_v0,comdat283 .p2align 3284 .type DW.ref.__gxx_personality_v0,@object285 .size DW.ref.__gxx_personality_v0, 8286DW.ref.__gxx_personality_v0:287 .quad __gxx_personality_v0288 .ident "clang version 15.0.0"289 .section ".note.GNU-stack","",@progbits290 .addrsig291 .addrsig_sym __gxx_personality_v0292 .addrsig_sym _Unwind_Resume293 .addrsig_sym _ZTIPi294