SuccessChanges

Summary

  1. [ASTMatchers] Make cxxOperatorCallExpr matchers API-compatible with n-ary operators (details)
  2. [LegalizeDAG] Handle NeedInvert when expanding BR_CC (details)
  3. [ASTMatchers] Add binaryOperation matcher (details)
  4. [ASTMatchers] Add support for CXXRewrittenBinaryOperator (details)
  5. Fix llvm::Optional build breaks in MSVC using std::is_trivially_copyable (details)
  6. [Tests] Added tests for new instcombine or simplification; NFC (details)
  7. [InstSimplify] Add (~A & B) | ~(A | B) --> ~A (details)
  8. [RISCV] Correct alignment settings for vector registers. (details)
  9. [InstSimplify] Update comments, remove redundant tests (details)
Commit dbe056c2e37f00b9f33ab63bba73dbb004e13562 by steveire
[ASTMatchers] Make cxxOperatorCallExpr matchers API-compatible with n-ary operators

This makes them composable with mapAnyOf().

Differential Revision: https://reviews.llvm.org/D94128
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchers.h
The file was modifiedclang/docs/LibASTMatchersReference.html
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchersInternal.h
Commit 4f155567317d3187bc18be866b3f3b5352f1bfa5 by bjorn.a.pettersson
[LegalizeDAG] Handle NeedInvert when expanding BR_CC

This is a follow-up fix to commit 03c8d6a0c4bd0016bdfd1e5.
Seems like we now end up with NeedInvert being set in the result
from LegalizeSetCCCondCode more often than in the past, so we
need to handle NeedInvert when expanding BR_CC.

Not sure how to deal with the "Tmp4.getNode()" case properly,
but current assumption is that that code path isn't impacted
by the changes in 03c8d6a0c4bd0016bdfd1e5 so we can simply move
the old assert into the if-branch and only handle NeedInvert in the
else-branch.

I think that the test case added here, for PowerPC, might have
failed also before commit 03c8d6a0c4bd0016bdfd1e5. But we started
to hit the assert more often downstream when having merged that
commit.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D94762
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
The file was addedllvm/test/CodeGen/PowerPC/legalize-invert-br_cc.ll
Commit e810e95e4bb908d1c8844e2c6f7da999732cabc9 by steveire
[ASTMatchers] Add binaryOperation matcher

This is a simple utility which allows matching on binaryOperator and
cxxOperatorCallExpr. It can also be extended to support
cxxRewrittenBinaryOperator.

Add generic support for MapAnyOfMatchers to auto-marshalling functions.

Differential Revision: https://reviews.llvm.org/D94129
The file was modifiedclang/docs/LibASTMatchersReference.html
The file was modifiedclang/lib/ASTMatchers/Dynamic/Marshallers.h
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchers.h
The file was modifiedclang/lib/ASTMatchers/ASTMatchersInternal.cpp
The file was modifiedclang/lib/ASTMatchers/Dynamic/Registry.cpp
The file was modifiedclang/docs/tools/dump_ast_matchers.py
Commit b765eaf9a617bd3da30f47ece731b33593929885 by steveire
[ASTMatchers] Add support for CXXRewrittenBinaryOperator

Differential Revision: https://reviews.llvm.org/D94130
The file was modifiedclang/lib/ASTMatchers/Dynamic/Registry.cpp
The file was modifiedclang/docs/LibASTMatchersReference.html
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
The file was modifiedclang/lib/ASTMatchers/ASTMatchFinder.cpp
The file was modifiedclang/unittests/AST/ASTTraverserTest.cpp
The file was modifiedclang/include/clang/AST/ExprCXX.h
The file was modifiedclang/include/clang/AST/ASTNodeTraverser.h
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchers.h
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchersInternal.h
The file was modifiedclang/lib/ASTMatchers/ASTMatchersInternal.cpp
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
Commit 25c1578a46ff93f920b7ad4e3057465902ced8f5 by alexandre.ganea
Fix llvm::Optional build breaks in MSVC using std::is_trivially_copyable

Current code breaks this version of MSVC due to a mismatch between `std::is_trivially_copyable` and `llvm::is_trivially_copyable` for `std::pair` instantiations.  Hence I was attempting to use `std::is_trivially_copyable` to set `llvm::is_trivially_copyable<T>::value`.

I spent some time root causing an `llvm::Optional` build error on MSVC 16.8.3 related to the change described above:

```
62>C:\src\ocg_llvm\llvm-project\llvm\include\llvm/ADT/BreadthFirstIterator.h(96,12): error C2280: 'llvm::Optional<std::pair<std::pair<unsigned int,llvm::Graph<4>::NodeSubset> *,llvm::Optional<llvm::Graph<4>::ChildIterator>>> &llvm::Optional<std::pair<std::pair<unsigned int,llvm::Graph<4>::NodeSubset> *,llvm::Optional<llvm::Graph<4>::ChildIterator>>>::operator =(const llvm::Optional<std::pair<std::pair<unsigned int,llvm::Graph<4>::NodeSubset> *,llvm::Optional<llvm::Graph<4>::ChildIterator>>> &)': attempting to reference a deleted function (compiling source file C:\src\ocg_llvm\llvm-project\llvm\unittests\ADT\BreadthFirstIteratorTest.cpp)
...
```
The "trivial" specialization of `optional_detail::OptionalStorage` assumes that the value type is trivially copy constructible and trivially copy assignable. The specialization is invoked based on a check of `is_trivially_copyable` alone, which does not imply both `is_trivially_copy_assignable` and `is_trivially_copy_constructible` are true.

[[ https://en.cppreference.com/w/cpp/named_req/TriviallyCopyable | According to the spec ]], a deleted assignment operator does not make `is_trivially_copyable` false. So I think all these properties need to be checked explicitly in order to specialize `OptionalStorage` to the "trivial" version:
```
/// Storage for any type.
template <typename T, bool = std::is_trivially_copy_constructible<T>::value
                          && std::is_trivially_copy_assignable<T>::value>
class OptionalStorage {
```
Above fixed my build break in MSVC, but I think we need to explicitly check `is_trivially_copy_constructible` too since it might be possible the copy constructor is deleted.  Also would be ideal to move over to `std::is_trivially_copyable` instead of the `llvm` namespace verson.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D93510
The file was modifiedllvm/unittests/ADT/OptionalTest.cpp
The file was modifiedllvm/include/llvm/ADT/Optional.h
Commit 9fc814ed59669d8f1d06cde5714c17fac652f2a1 by Dávid Bolvanský
[Tests] Added tests for new instcombine or simplification; NFC
The file was modifiedllvm/test/Transforms/InstCombine/or.ll
Commit a4e2a5145a29af678139f33e94ab3df0fc973e59 by Dávid Bolvanský
[InstSimplify] Add (~A & B) | ~(A | B) --> ~A
The file was modifiedllvm/test/Transforms/InstSimplify/or.ll
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
Commit 098dbf190a5586d02f48b84eb41b93b701cdeb97 by kai.wang
[RISCV] Correct alignment settings for vector registers.

According to "9. Vector Memory Alignment Constraints" in V
specification, the alignment of vector memory access is aligned to the
size of the element. In our current implementation, we support ELEN up
to 64. We could assume the alignment of vector registers is 64 under the
assumption.

Differential Revision: https://reviews.llvm.org/D94751
The file was modifiedllvm/lib/Target/RISCV/RISCVRegisterInfo.td
Commit bdd4dda58b0de08bd3474fb8d4589a9ba9349e88 by Dávid Bolvanský
[InstSimplify] Update comments, remove redundant tests
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
The file was modifiedllvm/test/Transforms/InstCombine/or.ll