[llvm] 65db7d3 - [NFC][SimplifyCFG] Add statistic to `FoldBranchToCommonDest()` fold
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 26 11:52:07 PST 2020
Author: Roman Lebedev
Date: 2020-11-26T22:51:21+03:00
New Revision: 65db7d38e0502db7b5753e974e630fd1663cb65b
URL: https://github.com/llvm/llvm-project/commit/65db7d38e0502db7b5753e974e630fd1663cb65b
DIFF: https://github.com/llvm/llvm-project/commit/65db7d38e0502db7b5753e974e630fd1663cb65b.diff
LOG: [NFC][SimplifyCFG] Add statistic to `FoldBranchToCommonDest()` fold
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 7aeeee4188ed..0f4c1b4038e5 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -159,6 +159,8 @@ STATISTIC(
NumLookupTablesHoles,
"Number of switch instructions turned into lookup tables (holes checked)");
STATISTIC(NumTableCmpReuses, "Number of reused switch table lookup compares");
+STATISTIC(NumFoldBranchToCommonDest,
+ "Number of branches folded into predecessor basic block");
STATISTIC(
NumHoistCommonCode,
"Number of common instruction 'blocks' hoisted up to the begin block");
@@ -2710,6 +2712,12 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, MemorySSAUpdater *MSSAU,
const unsigned PredCount = pred_size(BB);
bool Changed = false;
+
+ auto _ = make_scope_exit([&]() {
+ if (Changed)
+ ++NumFoldBranchToCommonDest;
+ });
+
TargetTransformInfo::TargetCostKind CostKind =
BB->getParent()->hasMinSize() ? TargetTransformInfo::TCK_CodeSize
: TargetTransformInfo::TCK_SizeAndLatency;
More information about the llvm-commits
mailing list