[NFC][SimplifyCFG] Add statistic to FoldBranchToCommonDest() fold

This commit is contained in:
Roman Lebedev 2020-11-26 14:58:28 +03:00
parent 433d0a30c6
commit 65db7d38e0
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0

View File

@ -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;