Elaborating slightly - The mem2reg pass hoists values from memory into registers. It was responsible for adding %a_addr.0 and the PHI node which defines it.<div><br></div><div>- Lang. <br><br><div class="gmail_quote">On Thu, Sep 23, 2010 at 11:44 PM, Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Maarten,<div><span style="font-family:'Times New Roman';font-size:medium"><pre style="word-wrap:break-word;white-space:pre-wrap">
<span style="font-family:arial;white-space:normal;font-size:small">If you look at the start of basic block 2 (<font face="'courier new', monospace">bb2</font>) you'll see the following instruction:</span></pre>

</span></div><div><span style="font-family:'Times New Roman';font-size:medium"><pre style="word-wrap:break-word;white-space:pre-wrap"> %a_addr.0 = phi i32 [ 1, %bb ], [ 0, %bb1 ]     ; <i32> [#uses=1]</pre>

</span><div>This is an SSA phi node which assigns a value of either 1 or 0 to %a_addr.0 depending on whether control reached the PHI node from basic block bb, or bb1.</div><div><br></div><div>- Lang.</div><br><div class="gmail_quote">
<div><div></div><div class="h5">
On Thu, Sep 23, 2010 at 11:26 PM, maarten faddegon <span dir="ltr"><<a href="mailto:m.faddegon@student.tudelft.nl" target="_blank">m.faddegon@student.tudelft.nl</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div class="h5">
Hi,<br>
<br>
I am studying SSA and some time ago I asked on this list how to see the<br>
phi nodes in the llvm ir output. I learned then to use this command:<br>
opt -mem2reg test.ll -S > test_mem2reg.ll<br>
<br>
However, if you look at the output (attached to this message) there is<br>
something I do not understand. At the end of the function @f at line 18,<br>
the function returns the variable %a_addr.0. However, this variable is<br>
never defined or set. The variable %a is. Is "_addr.0"  a way to get the<br>
address of a variable? I could not find anything about this in in LLVM<br>
language reference manual.<br>
Where does this variable come from?<br>
<br>
<br>
thanks,<br>
<font color="#888888">  Maarten Faddegon<br>
</font><br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>