[LLVMdev] Is infinite empty loop dead code?
Shuxin Yang
shuxin.llvm at gmail.com
Wed Nov 14 00:22:33 PST 2012
I do some google, I cannot find the answer...
I check C std, I cannot find answer either.
Delete infinite empty loop is boring, but if C/C++ lawyers could tell it
is safe to to so,
it would obviate the need to prove a non-countable loop infinite or not
before
DCE can delete it.
That is the answer I'm waiting for to delete a disgusting dead
non-countable loop in my way.
On 11/14/2012 12:14 AM, Duncan Sands wrote:
> 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
>
> _______________________________________________
> 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