Generating SSA using llvm

Dear all,

I have been trying to generate SSA form using llvm. Note that I have subjected the following program (prog1.c) to llvm.

int fact(int b);
int main()
int a, b;
a = 6;
if(a > 5)
b = 7;
b = 5;
return 0;
Also I have executed the following commands.
clang -S -emit-llvm prog1.c -o prog1.ll
clang -c -emit-llvm prog1.c -o prog1.bc
opt -mem2reg prog1.bc -o prog1.opt.bc
llvm-dis prog1.opt.bc

The last step generates prog1.opt.ll. I did not find any difference between prog1.ll and prog1.opt.ll other than the names of the files.

Kindly help me in generating SSA using llvm.


You need to pass -Xclang -disable-O0-optnone By default clang adds an optnone function attribute at -O0. Most passes exist immediately if they see that attribute.