How to get Julia SSA-form IR (with Phi nodes)?

Examples of the above: add entry point to construct an OpaqueClosure from pre-optimized IRCode by JeffBezanson · Pull Request #44197 · JuliaLang/julia · GitHub, IRTools.jl/utils.jl at 215bf1b61811bb5ee2379731f3251eb652d59c32 · FluxML/IRTools.jl · GitHub. This is not a value judgement of whether it should be done outside of Base, but it absolutely is being done in the wild underneath unsuspecting production code.

here is an example of how we do it in GPUCompiler style in 1.6: https://github.com/QuantumBFS/YaoCompiler.jl/tree/master/src/codegen I haven’t got time to update it to latest GPUCompiler, but I think the latest GPUCompiler doesn’t need these patches anymore