[PATCH][X86] Unsafe copysign xform in DAGCombiner

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 10:52:35 PDT 2016


> On Sep 9, 2016, at 10:33, Friedman, Eli via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> On 9/9/2016 9:25 AM, Cameron McInally via llvm-commits wrote:
>> Hey guys,
>> 
>> There's a copysign xform in the DAGCombiner that replaces safe FP code
>> with unsafe code. Attached is a patch to guard this xform.
>> 
>> The issue here (see test case) is the first copysign is removed before
>> the cvt is performed. If the input to the cvt is unordered, it will
>> raise an exception. The purpose of the first copysign is to create a
>> safe value (i.e. 1.0 or -1.0) to feed the cvt.
> 
> By "exception", you mean a floating-point exception?  LLVM generally assumes that floating-point exceptions are masked and ignored; see https://llvm.org/bugs/show_bug.cgi?id=8100, https://llvm.org/bugs/show_bug.cgi?id=18673, etc.  I think there's also been some discussion on llvmdev recently.
> 
> -Eli


There is a TLI.hasFloatingPointExceptions you can check

-Matt


More information about the llvm-commits mailing list