[llvm] [verify][swift] Allow passing swifterror to phi instructions (PR #138598)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 15:34:31 PDT 2025


https://github.com/MatzeB commented:

This has a quadratic runtime in number of PHIs! Better use a worklist algorithm

```
  SmallVector<Value*> PHIWorkList;
  for each call Parameter:
     if (swifterror && isPhi) PHIWorkList.push_back(parameter);
   
   while (!PHIWorkList.empty()) {
      Value* PHI = PHIWorkList.pop_back();
      for each operand in PHI.operands:
         Args.insert(opperand);
         if (added && isPhi(operand)) {
            PHIWorkList.append(operand);
         }
   }
   // ...
```

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


More information about the llvm-commits mailing list