[PATCH] D11146: [ValueTracking] Add support for floating-point minnum and maxnum

James Molloy james.molloy at arm.com
Wed Jul 15 08:13:47 PDT 2015


jmolloy added reviewers: t.p.northover, majnemer.
jmolloy updated this revision to Diff 29783.
jmolloy added a comment.

Hi,

It's a good thing this hasn't started being reviewed yet - I've just rewritten a bunch of it because I realised the previous implementation wasn't sufficient.

The previous version was only matching C99-style fminf/fmaxf; if one operand is NaN, it must return the other operand. However, idiomatic C is the opposite - "a < b ? a : b" would return NaN (due to ordered comparisons).

So now matchSelectPattern detects floating point mins and maxes regardless of its behaviour under NaN, and returns an extra enum value informing the user what its NaN behaviour is.

If the user (such as InstCombine) wants to rewrite the min/max, they have to use the correct ordered/unordered predicates in their FCMP, so it also returns the orderedness required (if any).

Adding extra reviewers too to widen the review net a bit and because I've been unfairly loading Hal recently!


Repository:
  rL LLVM

http://reviews.llvm.org/D11146

Files:
  include/llvm/Analysis/ValueTracking.h
  lib/Analysis/ValueTracking.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  lib/Transforms/InstCombine/InstCombineSelect.cpp
  lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  test/Transforms/InstCombine/minmax-fp.ll
  unittests/Analysis/CMakeLists.txt
  unittests/Analysis/ValueTrackingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11146.29783.patch
Type: text/x-patch
Size: 26369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150715/cf4591d5/attachment.bin>


More information about the llvm-commits mailing list