[LLVMdev] Does LLVM optimize variable to constant value in the compiling time?
Robert Sandra
robert.sandra0712 at gmail.com
Fri Feb 22 13:41:08 PST 2013
By optimization, do you mean enable the optimization whiling building llvm
or use optimization flag while using clang command to get the bitcode file?
In my case, I disable the optimization when I built llvm, and I use the
following command to get the bitcode:
clang -O0 -emit-llvm hello.c -c -o hello.bc
To run the pass:
opt -load ../../../Debug+Asserts/lib/Hello.so -hello < hello.bc > /dev/null
The llvm version I am using is 3.3svn.
Thanks.
On Fri, Feb 22, 2013 at 4:25 PM, Caldarale, Charles R <
Chuck.Caldarale at unisys.com> wrote:
> > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> > On Behalf Of Robert Sandra
> > Subject: [LLVMdev] Does LLVM optimize variable to constant value in the
> compiling time?
>
> > Considering the following codes:
>
> > int x = 21;
> > if(x > 20) {
> > p = &C;
> > } else {
> > p = &E;
> > }
>
> > I looked into the bitcode that LLVM generates, it still considers the
> 'else'
> > branch, which will be never reached during the runtime.
>
> What version of LLVM? What happens if you enable optimization?
>
> - Chuck
>
>
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130222/ce91adf8/attachment.html>
More information about the llvm-dev
mailing list