[LLVMdev] InstCombine "pessimizes" trunc i8 to i1?

Jochen Wilhelmy j.wilhelmy at arcor.de
Fri Dec 30 06:21:17 PST 2011


Am 29.12.2011 19:52, schrieb Reid Kleckner:
> I think Chris is saying that the and is necessary because with your i1 
> trunc you're ignoring all of the high bits.  The and implements that. 
>  If you don't want this behavior, don't generate the trunc in the 
> first place and just compare the full width to zero.
But if a backend sees trunc from i8 to i1 it should know about the and, 
therefore I think replacing it by and is not
a target independent transformation. I'm not saying the and is wrong, I 
just think InstCombine is the wrong place
if InstCombine is supposed to be target independent (which is my 
assumption that is possibly wrong).
By the way i8 and trunc come from clang as clang represents a bool as i8 
in memory. of course it would
be a nice feature if I could tell clang to always use i1 for bool, this 
would also remove the problem.
Is this possible?

-Jochen




More information about the llvm-dev mailing list