Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "minimal" SSA from LLVM

Tags:

llvm

llvm-ir

ssa

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?

like image 963
Kostya Avatar asked Nov 09 '22 07:11

Kostya


1 Answers

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.

like image 126
Chandler Carruth Avatar answered Dec 17 '22 14:12

Chandler Carruth