[LLVMdev] Unnecessary i16 -> i32 type promotion

Anton Korobeynikov anton at korobeynikov.info
Sun Jul 19 14:20:07 PDT 2009

Hello, Marc

> If I have an '&' operator inside an 'if' statement, LLVM seems to
> always promote a 16 bit integer type to a 32 bit integer type.  I
> don't want this to happen because my back-end only supports 16 bit
> types.  Why is this happening?
Because 1 is a 32-bit constant

> Where might this be happening, so I can fix it?
Is you 'int' type 16 or 32 bit? If 16 bit - you cannot use the IR in
question, since it was generated for the 32-bit target. Otherwise - you
cannot do anything - these are C language rules.

>  It doesn't seem to happen with the '|' operator, only '&'.
Right, because this effectively clears top 16 bit.

With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.

More information about the llvm-dev mailing list