[llvm] [Support] Assert that DomTree nodes share parent (PR #101198)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 14:27:52 PDT 2024


Meinersbur wrote:

The OpenMP outlining is the only functionality that writes outside the current function. However, this is not the only violation of the pass manager constraints (legacy/NPM). The other is that it does not preserve analyses such as (Post-)DominatorTree, LoopInfo and RegionInfo after finishing the CodeGen pass, but claims that it would. The reason is that invalidating any of those analysis would also invalidate its own analysis ScopInfo, making processing any other SCoP in the function impossible. 

Instead, I would suggest to make Polly a module-level pass and that pass call Polly's components itself. The "giant comment" claims that it is not possible, but that's not entirely true: Polly is free to create its own pass manager instance and requesting analyses from it. That is true with the legacy as well as the NPM and Polly does so already with the PollyCanonicalize pass.

However, all is not directly related with Polly's assertion failures due to this patch. The problem is that `removeSubFuncFromDomTree` is called AFTER the outlining, i.e. the DT nodes are already in the new function when we should ensure do so before the outlining such that DT never sees a BB that is not in the function that it was originally called on. Also, `ParallelLoopGenerator::createSub` must instantiate its own DominatorTree instead of reusing the existing one. I don't even think it needs one other than to satistfy interfaces that pass `DT` by reference.

I will prepare a patch.

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


More information about the llvm-commits mailing list