[llvm] [VPlan] Speed up VPSlotTracker by using ModuleSlotTracker (PR #139881)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 07:15:27 PDT 2025


================
@@ -1441,7 +1441,23 @@ void VPSlotTracker::assignName(const VPValue *V) {
   std::string Name;
   if (UV) {
     raw_string_ostream S(Name);
-    UV->printAsOperand(S, false);
+    if (MST) {
+      UV->printAsOperand(S, false, *MST);
----------------
david-arm wrote:

Perhaps it might be easier to have just two case if you rewrite like this:

```
  if (!isa<Instruction>(UV) || UV->hasName())
    UV->printAsOperand(S, false);
  else
    UV->printAsOperand(S, false, getModuleTracker(cast<Instruction>(UV)));
```

where a new helper function `getModuleTracker` can do the logic to lazily construct the module tracker. What do you think?

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


More information about the llvm-commits mailing list