[llvm] r177906 - Fix a bug in fast-math fadd/fsub simplification.

Duncan Sands baldrick at free.fr
Tue Mar 26 01:11:34 PDT 2013


Hi Shuxin,

On 25/03/13 21:43, Shuxin Yang wrote:
> Author: shuxin_yang
> Date: Mon Mar 25 15:43:41 2013
> New Revision: 177906
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177906&view=rev
> Log:
> Fix a bug in fast-math fadd/fsub simplification.
>
> The problem is that the code mistakenly took for granted that following constructor
> is able to create an APFloat from a *SIGNED* integer:
>
>    APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value)

maybe I didn't understand, but if "i" is your "int", can't you just do:
   APFloat(semantics, int64_t(i));
?

Maybe this works too (more robust against future changes in the definition
of integerPart):
   APFloat(semantics, (signed integerPart)i);

Ciao, Duncan.



More information about the llvm-commits mailing list