[llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE

Duncan Sands baldrick at free.fr
Wed Jun 10 12:02:32 PDT 2009


Hi Mikael,

> I found out that
> 
> void function(value)
> float value; {}
> 
> generated following bitcode
> 
> define void @function(double %value1)
> 
> In IRC channel this was though to be correct for platforms where 
> DOUBLE_TYPE_SIZE is bigger than float size e.g. x86. However in our 
> tce-llvm-gcc cross-compiler DOUBLE_TYPE_SIZE is set to be 32 bits as 
> FLOAT_TYPE_SIZE. So in this case correct bitcode should have been
> 
> define void @function(float %value1)
> 
> So here's patch attached for fixing the problem.

I think something like this would be better:

if (type == float_type_node)
   LLVMTy = ConvertType(double_type_node);


That's because float_type_node and double_type_node correspond
to the C float/double types, while LLVM's FloatTy and DoubleTy
need not: they correspond to a particular size.  You might need
to look at the main type variant though.

Ciao,

Duncan.



More information about the llvm-commits mailing list