[llvm-dev] how to simplify FP ops with an undef operand?

Kaylor, Andrew via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 1 14:52:26 PST 2018


Other than finding someone to volunteer for the work required, is there a reason not to add a NaN the IR? I can already ask a ConstantFP if it is a NaN. Why not make that easier to represent?

-----Original Message-----
From: Nuno Lopes [mailto:nunoplopes at sapo.pt] 
Sent: Thursday, March 01, 2018 2:31 PM
To: David Majnemer <david.majnemer at gmail.com>
Cc: Kaylor, Andrew <andrew.kaylor at intel.com>; Friedman, Eli <efriedma at codeaurora.org>; Sanjay Patel <spatel at rotateright.com>; llvm-dev <llvm-dev at lists.llvm.org>; Stephen Canon <scanon at apple.com>; John Regehr <regehr at cs.utah.edu>; Sanjoy Das <sanjoy at playingwithpointers.com>; Matt Arsenault <arsenm2 at gmail.com>; Kreitzer, David L <david.l.kreitzer at intel.com>
Subject: Re: how to simplify FP ops with an undef operand?

>> On Thu, Mar 1, 2018 at 2:08 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>> We can do "add %x, undef" => "undef" because for any value of %x, we 
>> can always find a value that when added to %x produces any value in 
>> the domain of integers.
>>
>> This is not the case with floats since with some inputs, e.g., NaNs, 
>> we are not able to produce some values in the domain (e.g., there's 
>> no value of %x that makes "fadd NaN, %x" return 42.0).
>>
>> In summary, since there's no NaN constant in the IR
>
> Isn't "float 0x7FF8000000000000" a NaN constant?

Ok, my bad, you can use the binary value directly. There are several NaN values, but I guess we could canonicalize on one of them.

Nuno 



More information about the llvm-dev mailing list