Author: Roman Lebedev Date: 2020-11-30T12:27:16+03:00 New Revision: b0e9b7c59fc49559e78b58a84e45f0ea2d931761
URL: https://github.com/llvm/llvm-project/commit/b0e9b7c59fc49559e78b58a84e45f0ea2d931761 DIFF: https://github.com/llvm/llvm-project/commit/b0e9b7c59fc49559e78b58a84e45f0ea2d931761.diff LOG: [NFC][SimplifyCFG] Add STATISTIC() to the FoldValueComparisonIntoPredecessors() 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 55ce05987bfd..35bef13ffaae 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(NumFoldValueComparisonIntoPredecessors, + "Number of value comparisons folded into predecessor basic blocks"); STATISTIC(NumFoldBranchToCommonDest, "Number of branches folded into predecessor basic block"); STATISTIC( @@ -1046,8 +1048,14 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI, BasicBlock *BB = TI->getParent(); Value *CV = isValueEqualityComparison(TI); // CondVal assert(CV && "Not a comparison?"); + bool Changed = false; + auto _ = make_scope_exit([&]() { + if (Changed) + ++NumFoldValueComparisonIntoPredecessors; + }); + SmallVector<BasicBlock *, 16> Preds(pred_begin(BB), pred_end(BB)); while (!Preds.empty()) { BasicBlock *Pred = Preds.pop_back_val(); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits