[LLVMdev] InstCombine "pessimizes" trunc i8 to i1?
Chris Lattner
clattner at apple.com
Fri Dec 30 10:11:29 PST 2011
Sure, since that would be a different ABI, you would want to define your own clang target. You probably want this for other reasons anyway (calling conventions).
-Chris
On Dec 30, 2011, at 6:21 AM, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:
> 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