[llvm-commits] CVS: llvm-www/OpenProjects.html

Chris Lattner clattner at apple.com
Tue Jun 16 10:32:02 PDT 2009


On Jun 16, 2009, at 4:35 AM, Rafael Espindola wrote:

>> +  <li><a href="http://nondot.org/sabre/LLVMNotes/BuiltinUnreachable.txt 
>> ">Value
>> +      assertions</a> (also <a href="http://llvm.org/PR810">PR810</ 
>> a>).</li>
>>  </ol>
>
> The example
>
>   int test(char *f) {
>     if (*f)
>       __builtin_unreachable ();
>     return f ? 1 : 0;
>   }
>
>
> should probably be
>
>   int test(char *f) {
>     if (*f)
>       __builtin_unreachable ();
>     return *f ? 0 : 1;
>   }
>
> for it to be reduced to "return 1".

That should also be simplified as well.  the testcase in the example  
works because you know that "if *f is 0, that f is not null".

-Chris



More information about the llvm-commits mailing list