By optimization, do you mean enable the optimization whiling building llvm or use optimization flag while using clang command to get the bitcode file?<div><br></div><div>In my case, I disable the optimization when I built llvm, and I use the following command to get the bitcode:</div>
<div><br></div><div><p style="margin:0px;font-size:13px;font-family:Consolas;background-color:rgb(248,248,248)">clang -O0 -emit-llvm hello.c -c -o hello.bc</p></div><div><br></div><div>To run the pass:</div><div><br></div>
<div><p style="margin:0px;font-size:13px;font-family:Consolas;background-color:rgb(248,248,248)">opt -load ../../../Debug+Asserts/lib/Hello.so -hello < hello.bc > /dev/null</p></div><div><br></div><div>The llvm version I am using is 3.3svn.</div>
<div><br></div><div>Thanks.<br><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 4:25 PM, Caldarale, Charles R <span dir="ltr"><<a href="mailto:Chuck.Caldarale@unisys.com" target="_blank">Chuck.Caldarale@unisys.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> From: <a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a>]<br>

> On Behalf Of Robert Sandra<br>
> Subject: [LLVMdev] Does LLVM optimize variable to constant value in the compiling time?<br>
<div><div class="h5"><br>
> Considering the following codes:<br>
<br>
> int x = 21; <br>
> if(x > 20) { <br>
>    p = &C; <br>
> } else { <br>
>    p = &E; <br>
> }<br>
<br>
> I looked into the bitcode that LLVM generates, it still considers the 'else'<br>
> branch, which will be never reached during the runtime.<br>
<br>
</div></div>What version of LLVM?  What happens if you enable optimization?<br>
<br>
 - Chuck<br>
<br>
<br>
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.<br>

<br>
</blockquote></div><br></div>