[llvm] [VPlan][UTC] Number VPlan passes' instances in printing/filtering (PR #211424)

Andrei Elovikov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 10:59:02 PDT 2026


================
@@ -57,11 +57,28 @@ struct VPlanTransforms {
   static decltype(auto) runPass(StringRef PassName, PassTy &&Pass, VPlan &Plan,
                                 ArgsTy &&...Args) {
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+    static DenseMap<std::pair<Function *, StringRef /* Pass */>, unsigned>
+        PassCounter;
+    Function *Fn = Plan.getScalarHeader()->getIRBasicBlock()->getParent();
+    // Computing these is expensive, so only do it if any VPlan printing has
+    // been requested.
+    unsigned Instance;
+    std::string NumberedPassName;
+
+    if ([](auto &...Options) {
+          return (((Options.getNumOccurrences() > 0) || ...));
----------------
eas wrote:

> Do we need a template here or could we just do ArrayRef + any_of which may be easier to read?

I tried but couldn't make it work.

> It probably won't make a big difference, but think for boolean options getNumOccurrences would return true for -vplan-print-after-all=false

Argh, true... Still, I think handling that case isn't worth the extra verbosity required.

https://github.com/llvm/llvm-project/pull/211424


More information about the llvm-commits mailing list