5

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?

Kostya
  • 1,072
  • 11
  • 24

1 Answers1

1

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.

Chandler Carruth
  • 3,011
  • 1
  • 18
  • 26
  • LLVM doesn't even seem have a mechanism for SSA construction alone. The "mem2reg" pass combines SSA construction with some other optimizations, at least copy propagation, perhaps even local value numbering. So, for someone studying SSA and its construction, LLVM is not the best choice. – pfalcon Jul 28 '19 at 19:59