[LLVMdev] Does LLVM optimize variable to constant value in the compiling time?
Dmitri Gribenko
gribozavr at gmail.com
Fri Feb 22 13:26:19 PST 2013
On Fri, Feb 22, 2013 at 11:16 PM, Robert Sandra
<robert.sandra0712 at gmail.com> wrote:
> 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.
Did you turn on the optimization?
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the llvm-dev
mailing list