summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenPGO.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-02-24 01:15:19 +0000
committerVedant Kumar <vsk@apple.com>2017-02-24 01:15:19 +0000
commit7f809b2fbd0c3a0fee44e3805955a1b0c76f3ce1 (patch)
treeef1505d7c247c6e46721fc520b3de6b6e814c6ad /clang/lib/CodeGen/CodeGenPGO.cpp
parentd75fd0988d1e8f2393363ebdd31fc0325a4ba82a (diff)
downloadbcm5719-llvm-7f809b2fbd0c3a0fee44e3805955a1b0c76f3ce1.tar.gz
bcm5719-llvm-7f809b2fbd0c3a0fee44e3805955a1b0c76f3ce1.zip
[profiling] PR31992: Don't skip interesting non-base constructors
Fix the fact that we don't assign profile counters to constructors in classes with virtual bases, or constructors with variadic parameters. Differential Revision: https://reviews.llvm.org/D30131 llvm-svn: 296062
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 3d3a0cce2aa..530ee9b4e9e 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -626,10 +626,14 @@ void CodeGenPGO::assignRegionCounters(GlobalDecl GD, llvm::Function *Fn) {
// Constructors and destructors may be represented by several functions in IR.
// If so, instrument only base variant, others are implemented by delegation
// to the base one, it would be counted twice otherwise.
- if (CGM.getTarget().getCXXABI().hasConstructorVariants() &&
- ((isa<CXXConstructorDecl>(D) && GD.getCtorType() != Ctor_Base) ||
- (isa<CXXDestructorDecl>(D) && GD.getDtorType() != Dtor_Base))) {
- return;
+ if (CGM.getTarget().getCXXABI().hasConstructorVariants()) {
+ if (isa<CXXDestructorDecl>(D) && GD.getDtorType() != Dtor_Base)
+ return;
+
+ if (const auto *CCD = dyn_cast<CXXConstructorDecl>(D))
+ if (GD.getCtorType() != Ctor_Base &&
+ CodeGenFunction::IsConstructorDelegationValid(CCD))
+ return;
}
CGM.ClearUnusedCoverageMapping(D);
setFuncName(Fn);
OpenPOWER on IntegriCloud