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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 08:26:28 PDT 2026


================
@@ -57,11 +57,18 @@ 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();
+    unsigned Instance = ++PassCounter[{Fn, PassName}];
+
+    std::string NumberedPassName =
+        Instance == 1 ? PassName.str()
+                      : (PassName + "@" + Twine(Instance)).str();
+
----------------
fhahn wrote:

Yes this is the minimum we need to do I think, to avoid issues with ThinLTO (different threads trying modify/grow the dense map) by default.

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


More information about the llvm-commits mailing list