| 1 |
// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -fextend-variable-liveness -fcxx-exceptions -fexceptions -o - | FileCheck %s |
| 2 |
// This test checks that the fake uses can be generated in exception handling |
| 3 |
// blocks and that we can emit fake uses for the __int128 data type. |
| 4 |
|
| 5 |
extern int bar(); |
| 6 |
|
| 7 |
/// Try block: fake use ends at try-block scope. |
| 8 |
// [[BAR_VAL::%[a-zA-Z0-9\.]+]] = invoke{{.*}} i32 @_Z3barv() |
| 9 |
// store i32 %[[BAR_VAL]], ptr [[K_ALLOC_VAL:%[a-zA-Z0-9\.]+]], align 4 |
| 10 |
// [[K_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr [[K_ALLOC_VAL]], align 4 |
| 11 |
// call void (...) @llvm.fake.use(i32 [[K_FAKE_USE]]) #2 |
| 12 |
// br label |
| 13 |
|
| 14 |
/// Catch block: fetching the caught value... |
| 15 |
// CHECK: [[CATCH_PTR:%[a-zA-Z0-9\.]+]] = call ptr @__cxa_begin_catch( |
| 16 |
// CHECK: [[L_VAL:%[a-zA-Z0-9\.]+]] = load i32, ptr [[CATCH_PTR]], align 4 |
| 17 |
|
| 18 |
/// Storing to allocas... |
| 19 |
// CHECK-DAG: store i32 8, ptr [[M_ALLOC_VAL:%[a-zA-Z0-9\.]+]] |
| 20 |
// CHECK-DAG: store i32 [[L_VAL]], ptr [[L_ALLOC_VAL:%[a-zA-Z0-9\.]+]], align 4 |
| 21 |
|
| 22 |
/// Load into fake uses - expect M to precede L. |
| 23 |
// CHECK: [[M_FAKE_VAL:%[a-zA-Z0-9\.]+]] = load i32, ptr [[M_ALLOC_VAL]] |
| 24 |
// CHECK: call void (...) @llvm.fake.use(i32 [[M_FAKE_VAL]]) |
| 25 |
// CHECK: [[L_FAKE_VAL:%[a-zA-Z0-9\.]+]] = load i32, ptr [[L_ALLOC_VAL]] |
| 26 |
// CHECK: call void (...) @llvm.fake.use(i32 [[L_FAKE_VAL]]) |
| 27 |
void foo() { |
| 28 |
try { |
| 29 |
int k = bar(); |
| 30 |
} catch (int l) { |
| 31 |
/// The catch block contains a fake use for the local within its scope. |
| 32 |
int m = 8; |
| 33 |
} |
| 34 |
} |