[llvm] 09e7965 - llvm-profgen: Fix use of stats to be under LLVM_ENABLE_STATS
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 18 09:47:21 PST 2022
Author: David Blaikie
Date: 2022-12-18T17:46:01Z
New Revision: 09e79659bf2aeb0a5bd8ad6a9a40734b42caaf8a
URL: https://github.com/llvm/llvm-project/commit/09e79659bf2aeb0a5bd8ad6a9a40734b42caaf8a
DIFF: https://github.com/llvm/llvm-project/commit/09e79659bf2aeb0a5bd8ad6a9a40734b42caaf8a.diff
LOG: llvm-profgen: Fix use of stats to be under LLVM_ENABLE_STATS
This caused a -Wunused-variable warning in a without-assert+with-stats
build (because the stats were included but their use was not).
Stat use is meant to be gated by LLVM_ENABLE_STATS which can be set
independently of assertions.
Added:
Modified:
llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
llvm/tools/llvm-profgen/MissingFrameInferrer.h
Removed:
################################################################################
diff --git a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
index 4a37945320215..4127fdc54bd18 100644
--- a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
+++ b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
@@ -269,7 +269,7 @@ bool MissingFrameInferrer::inferMissingFrames(
assert(UniquePath.back() == From && "broken path");
}
-#ifndef NDEBUG
+#if LLVM_ENABLE_STATS
if (NumPaths == 1) {
if (ReachableViaUniquePaths.insert({From, ToFRange->StartAddress}).second)
TailCallUniReachable++;
diff --git a/llvm/tools/llvm-profgen/MissingFrameInferrer.h b/llvm/tools/llvm-profgen/MissingFrameInferrer.h
index 3a50a64a2bfaa..4680a9a979ffa 100644
--- a/llvm/tools/llvm-profgen/MissingFrameInferrer.h
+++ b/llvm/tools/llvm-profgen/MissingFrameInferrer.h
@@ -12,6 +12,7 @@
#include "PerfReader.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
#include <unordered_map>
#include <unordered_set>
@@ -103,7 +104,7 @@ class MissingFrameInferrer {
uint32_t CurSearchingDepth = 0;
-#ifndef NDEBUG
+#if LLVM_ENABLE_STATS
DenseSet<std::pair<uint64_t, uint64_t>> ReachableViaUniquePaths;
DenseSet<std::pair<uint64_t, uint64_t>> Unreachables;
DenseSet<std::pair<uint64_t, uint64_t>> ReachableViaMultiPaths;
More information about the llvm-commits
mailing list