HomePhabricator

[ValueTracking] ignore FP signed-zero when detecting a casted-to-integer…

Authored by spatel on Dec 26 2017, 7:09 AM.

Description

[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

llvm-svn: 321456