aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshaw young <58664393+shawbyoung@users.noreply.github.com>2024-05-21 13:26:57 -0700
committerGitHub <noreply@github.com>2024-05-21 13:26:57 -0700
commit9f2313829fd210f9923375e93bc11fe9685c26d5 (patch)
treeeb104d9ba3ef0037fcf278c597102ff531898f7d
parent3eb7711e929f9b7ffaa0049a56ad70c4d99e4917 (diff)
downloadllvm-9f2313829fd210f9923375e93bc11fe9685c26d5.zip
llvm-9f2313829fd210f9923375e93bc11fe9685c26d5.tar.gz
llvm-9f2313829fd210f9923375e93bc11fe9685c26d5.tar.bz2
[BOLT] Add NamedRegionTimer to inferStaleProfile (#92621)
-rw-r--r--bolt/lib/Profile/StaleProfileMatching.cpp6
-rw-r--r--bolt/lib/Rewrite/RewriteInstance.cpp7
2 files changed, 9 insertions, 4 deletions
diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp
index 016962f..712d9a1 100644
--- a/bolt/lib/Profile/StaleProfileMatching.cpp
+++ b/bolt/lib/Profile/StaleProfileMatching.cpp
@@ -30,6 +30,7 @@
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Timer.h"
#include "llvm/Support/xxhash.h"
#include "llvm/Transforms/Utils/SampleProfileInference.h"
@@ -42,6 +43,7 @@ using namespace llvm;
namespace opts {
+extern cl::opt<bool> TimeRewrite;
extern cl::OptionCategory BoltOptCategory;
cl::opt<bool>
@@ -705,6 +707,10 @@ void assignProfile(BinaryFunction &BF,
bool YAMLProfileReader::inferStaleProfile(
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
+
+ NamedRegionTimer T("inferStaleProfile", "stale profile inference", "rewrite",
+ "Rewrite passes", opts::TimeRewrite);
+
if (!BF.hasCFG())
return false;
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 6e1021a..2559c9b 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -235,10 +235,9 @@ UseGnuStack("use-gnu-stack",
cl::ZeroOrMore,
cl::cat(BoltCategory));
-static cl::opt<bool>
- TimeRewrite("time-rewrite",
- cl::desc("print time spent in rewriting passes"), cl::Hidden,
- cl::cat(BoltCategory));
+cl::opt<bool> TimeRewrite("time-rewrite",
+ cl::desc("print time spent in rewriting passes"),
+ cl::Hidden, cl::cat(BoltCategory));
static cl::opt<bool>
SequentialDisassembly("sequential-disassembly",