Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / windows-itanium-exceptions.cpp
blobe8326b5bf579a6c9df007ad73157c1d3e0ad4c8c
1 // RUN: %clang_cc1 -emit-llvm -triple thumbv7-windows-itanium -fexceptions -fcxx-exceptions %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fexceptions -fcxx-exceptions %s -o - | FileCheck %s
3 // REQUIRES: asserts
5 void except() {
6 throw 32;
9 void attempt() {
10 try { except(); } catch (...) { }
13 // CHECK: @_ZTIi = external dso_local constant ptr
15 // CHECK: define {{.*}}void @_Z6exceptv() {{.*}} {
16 // CHECK: %exception = call {{.*}}ptr @__cxa_allocate_exception(i32 4)
17 // CHECK: store i32 32, ptr %exception
18 // CHECK: call {{.*}}void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
19 // CHECK: unreachable
20 // CHECK: }
22 // CHECK: define {{.*}}void @_Z7attemptv()
23 // CHECK-SAME: personality ptr @__gxx_personality_v0
24 // CHECK: %exn.slot = alloca ptr
25 // CHECK: %ehselector.slot = alloca i32
26 // CHECK: invoke {{.*}}void @_Z6exceptv()
27 // CHECK: to label %invoke.cont unwind label %lpad
28 // CHECK: invoke.cont:
29 // CHECK: br label %try.cont
30 // CHECK: lpad:
31 // CHECK: %0 = landingpad { ptr, i32 }
32 // CHECK: catch ptr null
33 // CHECK: %1 = extractvalue { ptr, i32 } %0, 0
34 // CHECK: store ptr %1, ptr %exn.slot
35 // CHECK: %2 = extractvalue { ptr, i32 } %0, 1
36 // CHECK: store i32 %2, ptr %ehselector.slot
37 // CHECK: br label %catch
38 // CHECK: catch:
39 // CHECK: %exn = load ptr, ptr %exn.slot
40 // CHECK: %3 = call {{.*}}ptr @__cxa_begin_catch(ptr %{{2|exn}})
41 // CHECK: call {{.*}}void @__cxa_end_catch()
42 // CHECK: br label %try.cont
43 // CHECK: try.cont:
44 // CHECK: ret void
45 // CHECK: }