29 lines · cpp
1// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s2// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s -O2 | opt - -S -passes=globalopt -o - | FileCheck %s --check-prefix=O13// RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s | FileCheck %s4// RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s -O2 | opt - -S -passes=globalopt -o - | FileCheck %s --check-prefix=O15 6// Check that GlobalOpt can eliminate static constructors for simple implicit7// constructors. This is a targeted integration test to make sure that LLVM's8// optimizers are able to process Clang's IR. GlobalOpt in particular is9// sensitive to the casts we emit.10 11// CHECK: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] 12// CHECK: [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_ctor_globalopt.cpp, ptr null }]13 14// CHECK-LABEL: define internal {{.*}}void @_GLOBAL__sub_I_ctor_globalopt.cpp()15// CHECK: call {{.*}}void @16// CHECK-NOT: call{{ }}17 18// O1: @llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer19 20struct A {21 virtual void f();22 int a;23};24struct B : virtual A {25 virtual void g();26 int b;27};28B b;29