xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/tail-merge-wineh.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Started from this code:
4*9880d681SAndroid Build Coastguard Worker; void f() {
5*9880d681SAndroid Build Coastguard Worker;   try {
6*9880d681SAndroid Build Coastguard Worker;     try {
7*9880d681SAndroid Build Coastguard Worker;       throw 42;
8*9880d681SAndroid Build Coastguard Worker;     } catch (int) {
9*9880d681SAndroid Build Coastguard Worker;     }
10*9880d681SAndroid Build Coastguard Worker;     try {
11*9880d681SAndroid Build Coastguard Worker;       throw 42;
12*9880d681SAndroid Build Coastguard Worker;     } catch (int) {
13*9880d681SAndroid Build Coastguard Worker;     }
14*9880d681SAndroid Build Coastguard Worker;   } catch (int) {
15*9880d681SAndroid Build Coastguard Worker;   }
16*9880d681SAndroid Build Coastguard Worker; }
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; Don't tail merge the calls.
19*9880d681SAndroid Build Coastguard Worker; CHECK: calll __CxxThrowException@8
20*9880d681SAndroid Build Coastguard Worker; CHECK: calll __CxxThrowException@8
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; ModuleID = 'cppeh-pingpong.cpp'
23*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
24*9880d681SAndroid Build Coastguard Workertarget triple = "i686-pc-windows-msvc"
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker%rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
27*9880d681SAndroid Build Coastguard Worker%eh.CatchableType = type { i32, i8*, i32, i32, i32, i32, i8* }
28*9880d681SAndroid Build Coastguard Worker%eh.CatchableTypeArray.1 = type { i32, [1 x %eh.CatchableType*] }
29*9880d681SAndroid Build Coastguard Worker%eh.ThrowInfo = type { i32, i8*, i8*, i8* }
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker$"\01??_R0H@8" = comdat any
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker$"_CT??_R0H@84" = comdat any
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker$_CTA1H = comdat any
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Worker$_TI1H = comdat any
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker@"\01??_7type_info@@6B@" = external constant i8*
40*9880d681SAndroid Build Coastguard Worker@"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
41*9880d681SAndroid Build Coastguard Worker@"_CT??_R0H@84" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 1, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*), i32 0, i32 -1, i32 0, i32 4, i8* null }, section ".xdata", comdat
42*9880d681SAndroid Build Coastguard Worker@_CTA1H = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.1 { i32 1, [1 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0H@84"] }, section ".xdata", comdat
43*9880d681SAndroid Build Coastguard Worker@_TI1H = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1H to i8*) }, section ".xdata", comdat
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workerdefine void @"\01?f@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
46*9880d681SAndroid Build Coastguard Workerentry:
47*9880d681SAndroid Build Coastguard Worker  %i = alloca i32, align 4
48*9880d681SAndroid Build Coastguard Worker  %tmp = alloca i32, align 4
49*9880d681SAndroid Build Coastguard Worker  %tmp1 = alloca i32, align 4
50*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %i, align 4
51*9880d681SAndroid Build Coastguard Worker  store i32 42, i32* %tmp, align 4
52*9880d681SAndroid Build Coastguard Worker  %0 = bitcast i32* %tmp to i8*
53*9880d681SAndroid Build Coastguard Worker  invoke void @_CxxThrowException(i8* %0, %eh.ThrowInfo* @_TI1H) #1
54*9880d681SAndroid Build Coastguard Worker          to label %unreachable unwind label %catch.dispatch
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Workercatch.dispatch:                                   ; preds = %entry
57*9880d681SAndroid Build Coastguard Worker  %cs1 = catchswitch within none [label %catch] unwind label %catch.dispatch.7
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workercatch:                                            ; preds = %catch.dispatch
60*9880d681SAndroid Build Coastguard Worker  %1 = catchpad within %cs1 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
61*9880d681SAndroid Build Coastguard Worker  catchret from %1 to label %catchret.dest
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Workercatchret.dest:                                    ; preds = %catch
64*9880d681SAndroid Build Coastguard Worker  br label %try.cont
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Workertry.cont:                                         ; preds = %catchret.dest
67*9880d681SAndroid Build Coastguard Worker  store i32 42, i32* %tmp1, align 4
68*9880d681SAndroid Build Coastguard Worker  %2 = bitcast i32* %tmp1 to i8*
69*9880d681SAndroid Build Coastguard Worker  invoke void @_CxxThrowException(i8* %2, %eh.ThrowInfo* @_TI1H) #1
70*9880d681SAndroid Build Coastguard Worker          to label %unreachable unwind label %catch.dispatch.2
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Workercatch.dispatch.2:                                 ; preds = %try.cont
73*9880d681SAndroid Build Coastguard Worker  %cs2 = catchswitch within none [label %catch.4] unwind label %catch.dispatch.7
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Workercatch.4:                                          ; preds = %catch.dispatch.2
76*9880d681SAndroid Build Coastguard Worker  %3 = catchpad within %cs2 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
77*9880d681SAndroid Build Coastguard Worker  catchret from %3 to label %catchret.dest.5
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Workercatchret.dest.5:                                  ; preds = %catch.4
80*9880d681SAndroid Build Coastguard Worker  br label %try.cont.6
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Workertry.cont.6:                                       ; preds = %catchret.dest.5
83*9880d681SAndroid Build Coastguard Worker  br label %try.cont.11
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Workercatch.dispatch.7:
86*9880d681SAndroid Build Coastguard Worker  %cs3 = catchswitch within none [label %catch.9] unwind to caller
87*9880d681SAndroid Build Coastguard Worker
88*9880d681SAndroid Build Coastguard Workercatch.9:                                          ; preds = %catch.dispatch.7
89*9880d681SAndroid Build Coastguard Worker  %4 = catchpad within %cs3 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null]
90*9880d681SAndroid Build Coastguard Worker  catchret from %4 to label %catchret.dest.10
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Workercatchret.dest.10:                                 ; preds = %catch.9
93*9880d681SAndroid Build Coastguard Worker  br label %try.cont.11
94*9880d681SAndroid Build Coastguard Worker
95*9880d681SAndroid Build Coastguard Workertry.cont.11:                                      ; preds = %catchret.dest.10, %try.cont.6
96*9880d681SAndroid Build Coastguard Worker  ret void
97*9880d681SAndroid Build Coastguard Worker
98*9880d681SAndroid Build Coastguard Workerunreachable:                                      ; preds = %try.cont, %entry
99*9880d681SAndroid Build Coastguard Worker  unreachable
100*9880d681SAndroid Build Coastguard Worker}
101*9880d681SAndroid Build Coastguard Worker
102*9880d681SAndroid Build Coastguard Workerdeclare x86_stdcallcc void @_CxxThrowException(i8*, %eh.ThrowInfo*)
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
105*9880d681SAndroid Build Coastguard Worker
106*9880d681SAndroid Build Coastguard Workerattributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
107*9880d681SAndroid Build Coastguard Workerattributes #1 = { noreturn }
108