1 | // RUN: %clang_cc1 -emit-llvm %s -std=c++11 -o - -fno-rtti \ |
2 | // RUN: -fprofile-instrument=clang -fcoverage-mapping -disable-llvm-passes \ |
3 | // RUN: -triple=x86_64-windows-msvc | FileCheck %s --check-prefix=MSVC |
4 | // RUN: %clang_cc1 -emit-llvm %s -std=c++11 -o - -fno-rtti \ |
5 | // RUN: -fprofile-instrument=clang -fcoverage-mapping -disable-llvm-passes \ |
6 | // RUN: -triple=x86_64-linux-gnu | FileCheck %s --check-prefix=LINUX |
7 | |
8 | // Check that clang doesn't emit counters or __profn_ variables for deleting |
9 | // destructor variants in both C++ ABIs. |
10 | |
11 | struct ABC { |
12 | virtual ~ABC() = default; |
13 | virtual void pure() = 0; |
14 | }; |
15 | struct DerivedABC : ABC { |
16 | ~DerivedABC() override = default; |
17 | void pure() override {} |
18 | }; |
19 | DerivedABC *useABCVTable() { return new DerivedABC(); } |
20 | |
21 | // MSVC-NOT: @"__profn_??_G{{.*}}" = |
22 | // MSVC: @"__profn_??1DerivedABC@@{{.*}}" = |
23 | // MSVC-NOT: @"__profn_??_G{{.*}}" = |
24 | // MSVC: @"__profn_??1ABC@@{{.*}}" = |
25 | // MSVC-NOT: @"__profn_??_G{{.*}}" = |
26 | |
27 | // MSVC-LABEL: define linkonce_odr dso_local i8* @"??_GDerivedABC@@UEAAPEAXI@Z"(%struct.DerivedABC* %this, {{.*}}) |
28 | // MSVC-NOT: call void @llvm.instrprof.increment({{.*}}) |
29 | // MSVC: call void @"??1DerivedABC@@UEAA@XZ"({{.*}}) |
30 | // MSVC: ret void |
31 | |
32 | // MSVC-LABEL: define linkonce_odr dso_local i8* @"??_GABC@@UEAAPEAXI@Z"(%struct.ABC* %this, {{.*}}) |
33 | // MSVC-NOT: call void @llvm.instrprof.increment({{.*}}) |
34 | // MSVC: call void @llvm.trap() |
35 | // MSVC-NEXT: unreachable |
36 | |
37 | // MSVC-LABEL: define linkonce_odr dso_local void @"??1DerivedABC@@UEAA@XZ"({{.*}}) |
38 | // MSVC: call void @llvm.instrprof.increment({{.*}}) |
39 | // MSVC: call void @"??1ABC@@UEAA@XZ"({{.*}}) |
40 | // MSVC: ret void |
41 | |
42 | // MSVC-LABEL: define linkonce_odr dso_local void @"??1ABC@@UEAA@XZ"({{.*}}) |
43 | // MSVC: call void @llvm.instrprof.increment({{.*}}) |
44 | // MSVC: ret void |
45 | |
46 | |
47 | // D2 is the base, D1 and D0 are deleting and complete dtors. |
48 | |
49 | // LINUX-NOT: @__profn_{{.*D[01]Ev}} = |
50 | // LINUX: @__profn__ZN10DerivedABCD2Ev = |
51 | // LINUX-NOT: @__profn_{{.*D[01]Ev}} = |
52 | // LINUX: @__profn__ZN3ABCD2Ev = |
53 | // LINUX-NOT: @__profn_{{.*D[01]Ev}} = |
54 | |
55 | // LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD1Ev(%struct.DerivedABC* %this) |
56 | // LINUX-NOT: call void @llvm.instrprof.increment({{.*}}) |
57 | // LINUX: call void @_ZN10DerivedABCD2Ev({{.*}}) |
58 | // LINUX: ret void |
59 | |
60 | // LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD0Ev(%struct.DerivedABC* %this) |
61 | // LINUX-NOT: call void @llvm.instrprof.increment({{.*}}) |
62 | // LINUX: call void @_ZN10DerivedABCD1Ev({{.*}}) |
63 | // LINUX: call void @_ZdlPv({{.*}}) |
64 | // LINUX: ret void |
65 | |
66 | // LINUX-LABEL: define linkonce_odr void @_ZN3ABCD1Ev(%struct.ABC* %this) |
67 | // LINUX-NOT: call void @llvm.instrprof.increment({{.*}}) |
68 | // LINUX: call void @llvm.trap() |
69 | // LINUX-NEXT: unreachable |
70 | |
71 | // LINUX-LABEL: define linkonce_odr void @_ZN3ABCD0Ev(%struct.ABC* %this) |
72 | // LINUX-NOT: call void @llvm.instrprof.increment({{.*}}) |
73 | // LINUX: call void @llvm.trap() |
74 | // LINUX-NEXT: unreachable |
75 | |
76 | // LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD2Ev(%struct.DerivedABC* %this) |
77 | // LINUX: call void @llvm.instrprof.increment({{.*}}) |
78 | // LINUX: call void @_ZN3ABCD2Ev({{.*}}) |
79 | // LINUX: ret void |
80 | |
81 | // LINUX-LABEL: define linkonce_odr void @_ZN3ABCD2Ev(%struct.ABC* %this) |
82 | // LINUX: call void @llvm.instrprof.increment({{.*}}) |
83 | // LINUX: ret void |
84 | |