brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · c3a29f5 Raw
35 lines · cpp
1// RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -fextend-variable-liveness -fcxx-exceptions -fexceptions -o - | FileCheck %s2// This test checks that the fake uses can be generated in exception handling3// blocks and that we can emit fake uses for the __int128 data type.4 5extern 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 410// [[K_FAKE_USE:%[a-zA-Z0-9\.]+]] = load i32, ptr [[K_ALLOC_VAL]], align 411// call void (...) @llvm.fake.use(i32 [[K_FAKE_USE]]) #212// br label13 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 417 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 421 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]])27void 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}35