Handling multiple exits in StructurizeCFG

Hi,

I noticed a TODO in AMDGPUUnifyDivergentExitNodes at llvm-project/AMDGPUUnifyDivergentExitNodes.cpp at 115c7beda74f3cfaf83b91d14bc97a39bff4cf19 · llvm/llvm-project · GitHub. StructurizeCFG still does not seem to be handling SEME regions so I wonder if it is being worked on or if it’s undesirable to do so.

Cheers,
Anshil

Ideally we would not use Region/RegionPass for the structurizer. Long term we should have a MIR based wave transform to replace the convoluted series of IR passes we currently use for control flow.

@bogner mentioned they have an out of tree structurizer, and @ruiling was recently looking at writing a new one as well

The algorithm used in the current structurizer is unspecified; it was not described formally. So in general, it is a difficult task to even try to improve the structurizer, and usually discouraged. We would definitely prefer to move the AMDGPU to something better (either in terms of results, or just being well-defined).