mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 18:06:05 +00:00

It seems preferable to avoid this optimization under -O0, and we're not set up to emit speculative references to vtables at -O0 in general anyway. For #64088.
16 lines
946 B
C++
16 lines
946 B
C++
// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -O1 -emit-llvm -std=c++11 -o - | FileCheck %s --check-prefixes=CHECK,EXACT
|
|
// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -O0 -emit-llvm -std=c++11 -o - | FileCheck %s --check-prefixes=CHECK,INEXACT
|
|
// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -O1 -fvisibility=hidden -emit-llvm -std=c++11 -o - | FileCheck %s --check-prefixes=CHECK,INEXACT
|
|
// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -O1 -fapple-kext -emit-llvm -std=c++11 -o - | FileCheck %s --check-prefixes=CHECK,INEXACT
|
|
// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -O1 -fno-assume-unique-vtables -emit-llvm -std=c++11 -o - | FileCheck %s --check-prefixes=CHECK,INEXACT
|
|
|
|
struct A { virtual ~A(); };
|
|
struct B final : A { };
|
|
|
|
// CHECK-LABEL: @_Z5exactP1A
|
|
B *exact(A *a) {
|
|
// INEXACT: call {{.*}} @__dynamic_cast
|
|
// EXACT-NOT: call {{.*}} @__dynamic_cast
|
|
return dynamic_cast<B*>(a);
|
|
}
|