[LLVMdev] Is infinite empty loop dead code?

Shuxin Yang shuxin.llvm at gmail.com
Tue Nov 13 23:23:02 PST 2012

Hi, All:

     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.

    If it is safe to delete this loop, it would be lot easier to delete 
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.



More information about the llvm-dev mailing list