llvmllvm-irssa

Getting "minimal" SSA from LLVM


The LLVM's opt -S -mem2reg pass produces the so-called "pruned" SSA -- the form that has all the dead phi functions removed. I would like to keep those phi instructions in the IR, obtaining the "minimal" SSA, but I'm failing to find an easy way to do it.

Am I doomed to implement the whole SSA construction algorithm from scratch or there is a way to do it with existing tools?


Solution

  • LLVM doesn't have any support for forming anything other than pruned SSA form, and it's unlikely to grow such a mechanism. We quite literally don't even do the work to synthesize this information when doing phi placement.