[llvm] [ctx_prof] CtxProfAnalysis (PR #102084)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 09:08:06 PDT 2024
================
@@ -0,0 +1,55 @@
+//===- CtxProfAnalysis.h - maintain contextual profile info -*- C++ ---*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+#ifndef LLVM_ANALYSIS_CTXPROFANALYSIS_H
+#define LLVM_ANALYSIS_CTXPROFANALYSIS_H
+
+#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/ProfileData/PGOCtxProfReader.h"
+#include <map>
+
+namespace llvm {
+class CtxProfAnalysis : public AnalysisInfoMixin<CtxProfAnalysis> {
+ StringRef Profile;
+
+public:
+ static AnalysisKey Key;
+ explicit CtxProfAnalysis(StringRef Profile) : Profile(Profile) {};
+
+ class Result {
+ std::optional<PGOContextualProfile::CallTargetMapTy> Profiles;
+
+ public:
+ explicit Result(PGOContextualProfile::CallTargetMapTy &&Profiles)
+ : Profiles(std::move(Profiles)) {}
+ Result() = default;
+ Result(const Result &) = delete;
+ Result(Result &&) = default;
+
+ operator bool() const { return !!Profiles; }
----------------
mtrofin wrote:
yup
https://github.com/llvm/llvm-project/pull/102084
More information about the llvm-commits
mailing list