[PATCH][X86] Unsafe copysign xform in DAGCombiner

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 10:33:49 PDT 2016


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

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list