summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ProfileSummaryInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis/ProfileSummaryInfo.h')
-rw-r--r--include/llvm/Analysis/ProfileSummaryInfo.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ProfileSummaryInfo.h b/include/llvm/Analysis/ProfileSummaryInfo.h
index c5f97083af4d0..6aaabe1d18890 100644
--- a/include/llvm/Analysis/ProfileSummaryInfo.h
+++ b/include/llvm/Analysis/ProfileSummaryInfo.h
@@ -55,6 +55,21 @@ public:
ProfileSummaryInfo(ProfileSummaryInfo &&Arg)
: M(Arg.M), Summary(std::move(Arg.Summary)) {}
+ /// \brief Returns true if profile summary is available.
+ bool hasProfileSummary() { return computeSummary(); }
+
+ /// \brief Returns true if module \c M has sample profile.
+ bool hasSampleProfile() {
+ return hasProfileSummary() &&
+ Summary->getKind() == ProfileSummary::PSK_Sample;
+ }
+
+ /// \brief Returns true if module \c M has instrumentation profile.
+ bool hasInstrumentationProfile() {
+ return hasProfileSummary() &&
+ Summary->getKind() == ProfileSummary::PSK_Instr;
+ }
+
/// Handle the invalidation of this information.
///
/// When used as a result of \c ProfileSummaryAnalysis this method will be