[llvm] [BOLT] [Profile] Fix type mismatch error (PR #73016)
Ho Cheung via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 21 09:00:51 PST 2023
https://github.com/gz83 created https://github.com/llvm/llvm-project/pull/73016
issue: https://github.com/llvm/llvm-project/issues/73006
@maksfb
>From 4fe93d76976d05b80e22df2971d755aa23e98730 Mon Sep 17 00:00:00 2001
From: Ho Cheung <uioptt24 at gmail.com>
Date: Wed, 22 Nov 2023 00:45:57 +0800
Subject: [PATCH] [BOLT] [Profile] Fix type mismatch error
issue: https://github.com/llvm/llvm-project/issues/73006
---
bolt/lib/Profile/YAMLProfileReader.cpp | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index 06cad69754816fd..21e28a94fb4a3a2 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -13,8 +13,11 @@
#include "bolt/Profile/ProfileYAMLMapping.h"
#include "bolt/Utils/Utils.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringMap.h"
#include "llvm/Support/CommandLine.h"
+#include <vector>
+
using namespace llvm;
namespace opts {
@@ -31,7 +34,7 @@ static llvm::cl::opt<bool>
llvm::cl::opt<bool> ProfileUseDFS("profile-use-dfs",
cl::desc("use DFS order for YAML profile"),
cl::Hidden, cl::cat(BoltOptCategory));
-}
+} // namespace opts
namespace llvm {
namespace bolt {
@@ -354,7 +357,15 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
matchProfileToFunction(YamlBF, Function);
}
- for (auto &[CommonName, LTOProfiles]: LTOCommonNameMap) {
+ using BinaryFunctionProfileVector =
+ std::vector<llvm::yaml::bolt::BinaryFunctionProfile *,
+ std::allocator<llvm::yaml::bolt::BinaryFunctionProfile *>>;
+
+ llvm::StringMap<BinaryFunctionProfileVector> LTOCommonNameMap;
+
+ for (auto &pair : LTOCommonNameMap) {
+ llvm::StringRef CommonName = pair.first();
+ BinaryFunctionProfileVector <OProfiles = pair.second;
if (!LTOCommonNameFunctionMap.contains(CommonName))
continue;
std::unordered_set<BinaryFunction *> &Functions =
More information about the llvm-commits
mailing list