]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Merge commit b8ebc11f0 from llvm git (by Sanjay Patel):
authordim <dim@FreeBSD.org>
Wed, 18 Mar 2020 20:44:40 +0000 (20:44 +0000)
committerdim <dim@FreeBSD.org>
Wed, 18 Mar 2020 20:44:40 +0000 (20:44 +0000)
commit72724eca61fa08564f63977476e441a40d8d4549
treeccdaf66a137580596ee7fc4388797f278d7503ef
parent90dec00a00d003dbadef8f8fdece9c9b2c4ff6fd
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
contrib/llvm-project/llvm/lib/Transforms/Scalar/EarlyCSE.cpp