[LLVMdev] 16bit loads being promoted to 32bit?

Duncan Sands baldrick at free.fr
Fri Feb 13 01:22:28 PST 2009


Hi,

> This function should read from a memory location from input and write to
> result with a promotion from i16 to i32, which seems simple enough. The
> problem that I am having is somewhere along the line the 16bit load is
> being promoted to a 32bit load and then the lower 16 bits are being sign
> extended away with a shl 16 followed by a shr 16. 

most likely it is being turned into an i32 extending load (extended
from i16).  You have to read the SDag node dumps carefully to notice
this.  Being an extending load means that only 16 bits will actually
be loaded (only two bytes of memory touched), but the result will be
an i32.  Hard to say anything more without details.

Ciao,

Duncan.



More information about the llvm-dev mailing list