[llvm-commits] CVS: llvm-www/OpenProjects.html
me22
me22.ca at gmail.com
Tue Jun 16 13:58:44 PDT 2009
2009/6/16 Rafael Espindola <espindola at google.com>
>
> > + <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".
>
Well arguably just this is enough to be reduced to "return 1":
int test(char *f) {
*f;
return f ? 1 : 0;
}
But I agree, it probably should be made more obvious. Why not just
this, though?:
int test(char c) {
if (c)
__builtin_unreachable ();
return !c;
}
~ Scott
More information about the llvm-commits
mailing list