<meta charset="utf-8">Oh I see. Thanks!<br><br><div class="gmail_quote">On Tue, Mar 29, 2011 at 1:37 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@cs.uiuc.edu">criswell@cs.uiuc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 3/29/11 12:26 PM, George Baah wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
  When I run the following command<br>
llvm-gcc -03 -emit-llvm test.cpp -c -o test.bc or llvm-gcc -emit-llvm test.cpp -c -o test.bc<br>
<br>
on the program test.cpp, the IR representation is not in SSA form.<br>
I do not see any phi functions.<br>
</blockquote>
<br></div>
Actually, it is in SSA form (or more precisely, the virtual registers are in SSA form; LLVM only puts virtual registers into SSA form).  However, all program variables are code-generated to alloca instructions and then accessed using load and store instructions.<br>

<br>
To lift stack-allocated variables into virtual registers (essentially putting them into SSA form), run the mem2reg pass (opt -mem2reg test.bc -f -o test.opt.bc).  This will take non-address taken alloca's, convert them into virtual registers, and introduce phi-nodes where needed.<br>

<br>
-- John T.<div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
program: test.cpp<br>
int main(int argc, char **argv)<br>
{<br>
  int a[2],i,j;<br>
  for(i=0;i<2;i++)<br>
  {<br>
    a[i] = i;<br>
  }<br>
  return a[1];<br>
}<br>
<br>
Any clarifications will be greatly appreciated. Thanks.<br>
<br>
George<br>
</blockquote>
<br>
</div></div></blockquote></div><br>