[PATCH] D54001: [ValueTracking] determine sign of 0.0 from select when matching min/max FP

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 14:48:58 PDT 2018


spatel created this revision.
spatel added reviewers: efriedma, arsenm, RKSimon.
Herald added subscribers: wdng, mcrosier.

In PR39475:
https://bugs.llvm.org/show_bug.cgi?id=39475
..we may fail to recognize/simplify fabs() in some cases because we do not canonicalize fcmp with a -0.0 operand.

Adding that canonicalization can cause regressions on min/max FP tests, so that's this patch: for the purpose of determining whether something is min/max, let the value returned by the select determine how we treat a 0.0 operand in the fcmp.

This patch doesn't actually change the -0.0 to +0.0. It just changes the analysis, so we don't fail to recognize equivalent min/max patterns that only differ in the signbit of 0.0.


https://reviews.llvm.org/D54001

Files:
  lib/Analysis/ValueTracking.cpp
  test/Transforms/InstCombine/minmax-fp.ll
  unittests/Analysis/ValueTrackingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54001.172239.patch
Type: text/x-patch
Size: 11690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181101/a76f046a/attachment.bin>


More information about the llvm-commits mailing list