[PATCH] Fold fcmp in cases where value is provably non-negative.

Arch D. Robison arch.robison at intel.com
Wed Jan 14 11:37:34 PST 2015


Hi reames, hfinkel,

This patch folds fcmp in some cases of interest in Julia.  The patch adds a function CannotBeOrderedLessThanZero that returns true if a value is provably not less than zero.  I.e. the function returns true if the value is provably -0, +0, positive, or a NaN.  The patch extends InstructionSimplify.cpp to fold instances of fcmp where:

  -  the predicate is olt or uge
  -  the first operand is provably not less than zero
  -  the second operand is zero

The motivation for handling these cases optimizing away domain checks for sqrt in Julia for common idioms such as sqrt(x*x+y*y)..  

- Arch

http://reviews.llvm.org/D6972

Files:
  include/llvm/Analysis/ValueTracking.h
  lib/Analysis/InstructionSimplify.cpp
  lib/Analysis/ValueTracking.cpp
  test/Transforms/InstSimplify/floating-point-compare.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6972.18159.patch
Type: text/x-patch
Size: 5928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150114/fa17a9a2/attachment.bin>


More information about the llvm-commits mailing list