[llvm] Fix issue with running the same PassManager twice (PR #92823)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 16:25:06 PDT 2024
modiking wrote:
> this isn't the right solution. if we're calling `ModuleInlinerWrapperPass::run()` more than once, we're going to keep adding random passes/sub-pass managers to `MPM` and running those.
>
> we really shouldn't be creating and running pass managers within a `run()`. could you see if we could somehow make it so we do all the pass management once? will probably involve modifying `PassBuilderPipelines.cpp`
Yeah it really is strange that a `pass` contains pass managers. I don't have too much context here but reading through what MIWP does it seems to be a `pass manager` in every aspect expect being a `PassManager`. It looks like a distinction is that MIWP executes a `PassManager` at pass runtime which depending on it's internal state:
```
if (MaxDevirtIterations == 0)
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(PM)));
else
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
createDevirtSCCRepeatedPass(std::move(PM), MaxDevirtIterations)));
```
But given `MaxDevirtIterations` is `const` this isn't really a runtime decision. It seems like MIWP can be replaced with a regular MPM and the decision above be made at pipeline construction. Is that the direction you're suggesting?
https://github.com/llvm/llvm-project/pull/92823
More information about the llvm-commits
mailing list