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

**URL:** <https://discourse.julialang.org/t/how-to-get-julia-ssa-form-ir-with-phi-nodes/79897>\
**Category:** Internals & Design\
**Created:** [April 23, 2022, 3:19pm UTC](https://discourse.julialang.org/t/how-to-get-julia-ssa-form-ir-with-phi-nodes/79897 "2022-04-23T15:19:52Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [May 11, 2022, 5:49pm UTC](https://discourse.julialang.org/t/how-to-get-julia-ssa-form-ir-with-phi-nodes/79897/21 "2022-05-11T17:49:48Z")

</div>

Examples of the above: [add entry point to construct an OpaqueClosure from pre-optimized IRCode by JeffBezanson · Pull Request #44197 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/44197/files#diff-1765273a7f67ffefdf18109921b6cf81d4e698ec214de9c0a01ec3c66402e4a2R247-R256), [IRTools.jl/utils.jl at 215bf1b61811bb5ee2379731f3251eb652d59c32 · FluxML/IRTools.jl · GitHub](https://github.com/FluxML/IRTools.jl/blob/215bf1b61811bb5ee2379731f3251eb652d59c32/src/reflection/utils.jl#L139). 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.

---

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [May 11, 2022, 9:52pm UTC](https://discourse.julialang.org/t/how-to-get-julia-ssa-form-ir-with-phi-nodes/79897/22 "2022-05-11T21:52:19Z")

</div>

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](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

[Previous page](https://discourse.julialang.org/t/how-to-get-julia-ssa-form-ir-with-phi-nodes/79897.md?page=1)
