I am emitting llvm bit code using
llvm-gcc -c -emit-llvm -O0 -o test.bc test.c
and then optimizing it with
opt -O3 -print-module test.bc
in order to obtain a dump of generated IR.
The resulting code has Phi nodes and is perhaps in SSA form. I want
to undo the SSA form while retaining all the other optimizations. Is
mem2reg the right optimization to be added after -O3, i.e.,
opt -O3 -mem2reg -print-module test.bc
will print the llvm in non-SSA form with no Phi nodes.