[LLVMdev] Is infinite empty loop dead code?

Duncan Sands baldrick at free.fr
Wed Nov 14 00:14:47 PST 2012


Hi Shuxin,

>      Is it legal to delete empty infinite loop like this : "while(1) {}"?
> It is interesting that both llvm and gcc keep the loop, however Open64 delete it.

this is an endless source of discussion.  I suggest you read the GCC and LLVM
mailing list archives if you want to find out more about it.

Ciao, Duncan.

>     If it is safe to delete this loop, it would be lot easier to delete non-obvious
> dead loop like following as compiler doesn't need to prove if the loop in question
> is infinite or not. Currently llvm is not able to delete such dead loop.
>
>     while (a) { a = whatever } ; // no use of <a> after this point.
>
> Thanks
>
> Shuxin
>
>
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list