[all-commits] [llvm/llvm-project] cfa792: [Transforms] add phase ordering tests for min/max/...

Saar Raz via All-commits all-commits at lists.llvm.org
Thu Mar 19 02:25:37 PDT 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: cfa792458fc47f9890d94a2718288c269c8a2a6e
      https://github.com/llvm/llvm-project/commit/cfa792458fc47f9890d94a2718288c269c8a2a6e
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-03-19 (Thu, 19 Mar 2020)

  Changed paths:
    A llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll

  Log Message:
  -----------
  [Transforms] add phase ordering tests for min/max/abs; NFC

Test that instcombine and early-cse can cooperate
to reduce sequences of select patterns that are not
composed of the same underlying instructions.

There's a bug in EarlyCSE (PR41083), and we can test
how much a possible fix (D74285) may affect optimization.

(cherry picked from commit 0ad6e726ec7eee8ef14a89fa288d5a1420d96b1e)


  Commit: 623461b2ce421cd287f1bea50c0998003375a782
      https://github.com/llvm/llvm-project/commit/623461b2ce421cd287f1bea50c0998003375a782
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-03-19 (Thu, 19 Mar 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/EarlyCSE.cpp
    M llvm/test/Transforms/EarlyCSE/commute.ll
    M llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll

  Log Message:
  -----------
  [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

(cherry picked from commit b8ebc11f032032c7ca449f020a1fe40346e707c8)


  Commit: 5401d393f88b9fa99a8d3a2a1b3013e757d958a2
      https://github.com/llvm/llvm-project/commit/5401d393f88b9fa99a8d3a2a1b3013e757d958a2
  Author: Hans Wennborg <hans at chromium.org>
  Date:   2020-03-19 (Thu, 19 Mar 2020)

  Changed paths:
    M llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll

  Log Message:
  -----------
  ../llvm/utils/update_test_checks.py --opt-binary bin/opt ../llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll


  Commit: a36a14b70f18b156cea8552fd4b138487340ba76
      https://github.com/llvm/llvm-project/commit/a36a14b70f18b156cea8552fd4b138487340ba76
  Author: Saar Raz <saar at raz.email>
  Date:   2020-03-19 (Thu, 19 Mar 2020)

  Changed paths:
    M clang/lib/Sema/TreeTransform.h
    M clang/test/SemaTemplate/instantiate-requires-expr.cpp

  Log Message:
  -----------
  [Concepts] Fix incorrect DeclContext for transformed RequiresExprBodyDecl

We would assign the incorrect DeclContext when transforming the RequiresExprBodyDecl, causing incorrect
handling of 'this' inside RequiresExprBodyDecls (bug #45162).

Assign the current context as the DeclContext of the transformed decl.

(cherry picked from commit 9769e1ee9acc33638449b50ac394b5ee2d4efb60)


  Commit: 35627038123b5b391a20e9f4d44a85c7a325027b
      https://github.com/llvm/llvm-project/commit/35627038123b5b391a20e9f4d44a85c7a325027b
  Author: Saar Raz <saar at raz.email>
  Date:   2020-03-19 (Thu, 19 Mar 2020)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseTemplate.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/SemaCXX/invalid-member-expr.cpp
    M clang/test/SemaCXX/typo-correction.cpp
    M clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp

  Log Message:
  -----------
  [Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint annotates an invalid template-id

TryAnnotateTypeConstraint could annotate a template-id which doesn't end up being a type-constraint,
in which case control flow would incorrectly flow into ParseImplicitInt.

Reenter the loop in this case.
Enable relevant tests for C++20. This required disabling typo-correction during TryAnnotateTypeConstraint
and changing a test case which is broken due to a separate bug (will be reported and handled separately).

(cherry picked from commit 19fccc52ff2c1da1f93d9317c34769bd9bab8ac8)


Compare: https://github.com/llvm/llvm-project/compare/52c365aa9ca0...35627038123b


More information about the All-commits mailing list