]> granicus.if.org Git - llvm/commit
[ValueTracking] ignore FP signed-zero when detecting a casted-to-integer fmin/fmax...
authorSanjay Patel <spatel@rotateright.com>
Tue, 26 Dec 2017 15:09:19 +0000 (15:09 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 26 Dec 2017 15:09:19 +0000 (15:09 +0000)
commitba5e1fbe8d22fd8cc29e3b654c66ed7c39584fe4
treed34356d13b10204b2aa64c3de82548512b477d96
parent03438cb38e811137a5386d71ccb6379707cf7d52
[ValueTracking] ignore FP signed-zero when detecting a casted-to-integer fmin/fmax pattern

This is a preliminary step for the patch discussed in D41136 (and denoted here with the FIXME comment).

When we match an FP min/max that is cast to integer, any intermediate difference between +0.0 or -0.0
should be muted in the result by the conversion (either fptosi or fptoui) of the result. Thus, we can
enable 'nsz' for the purpose of matching fmin/fmax.

Note that there's probably room to generalize this more, possibly by fixing the current calls to the
weak version of isKnownNonZero() in matchSelectPattern() to the more powerful recursive version.

Differential Revision: https://reviews.llvm.org/D41333

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321456 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/minmax-fp.ll