freebsd-dev/contrib/llvm-project
Dimitry Andric e39dad62a8 Merge commit b8ebc11f0 from llvm git (by Sanjay Patel):
[EarlyCSE] avoid crashing when detecting min/max/abs patterns (PR41083)

  As discussed in PR41083:
  https://bugs.llvm.org/show_bug.cgi?id=41083
  ...we can assert/crash in EarlyCSE using the current hashing scheme
  and instructions with flags.

  ValueTracking's matchSelectPattern() may rely on overflow (nsw, etc)
  or other flags when detecting patterns such as min/max/abs composed
  of compare+select. But the value numbering / hashing mechanism used
  by EarlyCSE intersects those flags to allow more CSE.

  Several alternatives to solve this are discussed in the bug report.
  This patch avoids the issue by doing simple matching of min/max/abs
  patterns that never requires instruction flags. We give up some CSE
  power because of that, but that is not expected to result in much
  actual performance difference because InstCombine will canonicalize
  these patterns when possible. It even has this comment for abs/nabs:

    /// Canonicalize all these variants to 1 pattern.
    /// This makes CSE more likely.

  (And this patch adds PhaseOrdering tests to verify that the expected
  transforms are still happening in the standard optimization
  pipelines.

  I left this code to use ValueTracking's "flavor" enum values, so we
  don't have to change the callers' code. If we decide to go back to
  using the ValueTracking call (by changing the hashing algorithm
  instead), it should be obvious how to replace this chunk.

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

This fixes an assertion when building the math/gsl port on PowerPC64.

Requested by:	pkubja
MFC after:	6 weeks
X-MFC-With:	358851
2020-03-18 20:44:40 +00:00
..
clang Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp 2020-03-18 18:26:53 +00:00
compiler-rt Merge ^/vendor/llvm-project/release-10.x up to its last change (upstream 2020-02-27 19:04:39 +00:00
libcxx Merge ^/vendor/llvm-project/release-10.x up to its last change (upstream 2020-02-27 19:04:39 +00:00
libunwind Merge commit 221c5af4e from llvm git (by Nico Weber): 2020-02-15 15:03:26 +00:00
lld Merge commit 315f8a55f from llvm git (by Fangrui Song): 2020-03-18 20:38:15 +00:00
lldb Merge ^/vendor/llvm-project/release-10.x up to its last change (upstream 2020-03-05 18:11:47 +00:00
llvm Merge commit b8ebc11f0 from llvm git (by Sanjay Patel): 2020-03-18 20:44:40 +00:00
openmp Merge ^/vendor/lvm-project/master up to its last change (upstream commit 2020-01-24 22:00:03 +00:00
FREEBSD-Xlist Update FREEBSD-Xlist. 2020-01-25 14:39:59 +00:00