1. [MemCpyOpt] Avoid double invalidation (NFCI) (details)
  2. [MemCpyOpt] Add helper to erase instructions (NFC) (details)
  3. [lldb] Add a "design" section to the documentation. (details)
  4. [flang][NFC] Fix mis-matched struct/class declarations (details)
  5. Release the shadow memory used by the mmap range at munmap (details)
  6. [llvm-objcopy][NFC] refactor error handling. part 3. (details)
  7. [Hexagon] Move selection of HVX multiply from lowering to patterns (details)
  8. [libc++] Allow retries on some slightly flaky mutex tests (details)
  9. [Driver] Move detectLibcxxIncludePath to ToolChain (details)
  10. [clang-tidy] Implement readability-function-cognitive-complexity check (details)
  11. [clang] Implement objc_non_runtime_protocol to remove protocol metadata (details)
  12. [NFC][MSAN] Extract llvm.abs handling into a function (details)
  13. [libc++] Fix the build with GCC < 10 (details)
  14. [HIP] Align device binary (details)
  15. Don't reject calls to MinGW's unusual _setjmp declaration. (details)
  16. [test][Coro][NewPM] Fix coro-elide.ll under NPM (details)
  17. [MetaRenamer][NewPM] Port metarenamer to NPM (details)
Commit 87b63c1726e24214272cd6c04825c585635d1cdc by nikita.ppv
[MemCpyOpt] Avoid double invalidation (NFCI)

The removal of the cpy instruction is left to the caller of
performCallSlotOptzn(), including the invalidation of MD. Both
call-sites already do this.

Also handle incrementation of NumMemCpyInstr consistently at the
call-site. One of the call-site was already doing this, which
ended up incrementing the statistic twice.

This fix was part of D26739.
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Commit 94704ed008f78e71aa42a452d8b03c122e0f78cd by nikita.ppv
[MemCpyOpt] Add helper to erase instructions (NFC)

Next to erasing the instruction, we also always want to remove
it from MSSA and MD. Use a common function to do so.

This is a refactoring split out from D26739.
The file was modifiedllvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Commit 128e999d63c41e54d5d73c8af47e1ce401e6a200 by Jonas Devlieghere
[lldb] Add a "design" section to the documentation.

Create a "Design" section for the LLDB documentation. The goal is to
have design documents that describe how the LLDB internals work.

Currently similar pages  are mixed together under the "Development". The
existing pages describing the architecture, the reproducers, the
structured data plugins, and the SB API could be housed here. I hope
we'd see more pages being added here in the future.

Differential revision:
The file was modifiedlldb/docs/.htaccess
The file was removedlldb/docs/resources/architecture.rst
The file was removedlldb/docs/resources/reproducers.rst
The file was modifiedlldb/docs/index.rst
The file was addedlldb/docs/design/reproducers.rst
The file was removedlldb/docs/resources/
The file was addedlldb/docs/design/
The file was addedlldb/docs/design/sbapi.rst
The file was addedlldb/docs/design/overview.rst
The file was removedlldb/docs/resources/sbapi.rst
Commit 11622d0fed8c1fb99124ebf4a6aece4bcc83b367 by tkeith
[flang][NFC] Fix mis-matched struct/class declarations

The template `ListDirectedStatementState` was declared as a struct and then as a class.
Fix it so they match.

Differential Revision:
The file was modifiedflang/runtime/io-stmt.h
Commit 045a620c455d2f27a536d687ee6a0299b9e2c734 by jianzhouzh
Release the shadow memory used by the mmap range at munmap

When an application does a lot of pairs of mmap and munmap, if we did
not release shadoe memory used by mmap addresses, this would increase
memory usage.

Reviewed-by: morehouse

Differential Revision:
The file was modifiedcompiler-rt/lib/dfsan/dfsan_interceptors.cpp
The file was addedcompiler-rt/test/dfsan/munmap_release_shadow.c
Commit 0373c768c56fc7ce6fe1efa48383f7b376e7bc2a by a.v.lapshin
[llvm-objcopy][NFC] refactor error handling. part 3.

Remove usages of special error reporting functions(error(),
reportError()). Errors are reported as Expected<>/Error returning
values. This part is for ELF subfolder of llvm-objcopy.

Testing: check-all.

Differential Revision:
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.h
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.cpp
The file was modifiedllvm/tools/llvm-objcopy/MachO/MachOReader.cpp
The file was modifiedllvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/MachO/Object.cpp
The file was modifiedllvm/tools/llvm-objcopy/llvm-objcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/wasm/WasmObjcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
The file was removedllvm/tools/llvm-objcopy/llvm-objcopy.h
Commit f528816d586a42e4cf27af5b2fa9ba91213307aa by kparzysz
[Hexagon] Move selection of HVX multiply from lowering to patterns

Also, change i32*i32 to V6_vmpyieoh + V6_vmpyiewuh_acc, which works
on V60 as well.
The file was modifiedllvm/test/CodeGen/Hexagon/autohvx/arith.ll
The file was modifiedllvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
The file was modifiedllvm/lib/Target/Hexagon/
Commit f7e91e6cc7f35dd0dcc176463a355d78e1c020b1 by Louis Dionne
[libc++] Allow retries on some slightly flaky mutex tests
The file was modifiedlibcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp
The file was modifiedlibcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
Commit a594fd28e373cb7cd348cf01f6a90e055bf6cf6d by phosek
[Driver] Move detectLibcxxIncludePath to ToolChain

This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.

Differential Revision:
The file was modifiedclang/lib/Driver/ToolChains/Gnu.cpp
The file was modifiedclang/include/clang/Driver/ToolChain.h
The file was modifiedclang/lib/Driver/ToolChain.cpp
The file was modifiedclang/lib/Driver/ToolChains/Fuchsia.cpp
Commit ace644030e67506114d3ac9a221cf8eb5d10159c by lebedev.ri
[clang-tidy] Implement readability-function-cognitive-complexity check

Currently, there is basically just one clang-tidy check to impose
some sanity limits on functions - `clang-tidy-readability-function-size`.
It is nice, allows to limit line count, total number of statements,
number of branches, number of function parameters (not counting
implicit `this`), nesting level.

However, those are simple generic metrics. It is still trivially possible
to write a function, which does not violate any of these metrics,
yet is still rather unreadable.

Thus, some additional, slightly more complicated metric is needed.
There is a well-known [[ | Cyclomatic complexity]], but certainly has its downsides.
And there is a [[ | COGNITIVE COMPLEXITY by SonarSource ]], which is available for opensource on

This check checks function Cognitive Complexity metric, and flags
the functions with Cognitive Complexity exceeding the configured limit.
The default limit is `25`, same as in 'upstream'.

The metric is implemented as per [[ | COGNITIVE COMPLEXITY by SonarSource ]] specification version 1.2 (19 April 2017), with two notable exceptions:
   * `preprocessor conditionals` (`#ifdef`, `#if`, `#elif`, `#else`,
     `#endif`) are not accounted for.
      Could be done. Currently, upstream does not account for them either.
   * `each method in a recursion cycle` is not accounted for.
      It can't be fully implemented, because cross-translational-unit
      analysis would be needed, which is not possible in clang-tidy.
      Thus, at least right now, i completely avoided implementing it.

There are some further possible improvements:
* Are GNU statement expressions (`BinaryConditionalOperator`) really free?
  They should probably cause nesting level increase,
  and complexity level increase when they are nested within eachother.
* Microsoft SEH support
* ???

Reviewed By: aaron.ballman, JonasToth, lattner

Differential Revision:
The file was modifiedclang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
The file was addedclang-tools-extra/docs/clang-tidy/checks/readability-function-cognitive-complexity.rst
The file was addedclang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.h
The file was modifiedclang-tools-extra/docs/ReleaseNotes.rst
The file was modifiedclang-tools-extra/clang-tidy/readability/CMakeLists.txt
The file was modifiedclang-tools-extra/docs/clang-tidy/checks/list.rst
The file was addedclang-tools-extra/test/clang-tidy/checkers/readability-function-cognitive-complexity.cpp
The file was addedclang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp
Commit 14f6bfcb52e77867a6a84fcfd9e21bb5f1f5795c by nathan
[clang] Implement objc_non_runtime_protocol to remove protocol metadata

Motivated by the new objc_direct attribute, this change adds a new
attribute that remotes metadata from Protocols that the programmer knows
isn't going to be used at runtime. We simply have the frontend skip
generating any protocol metadata entries (e.g. OBJC_CLASS_NAME,
marked with `__attribute__((objc_non_runtime_protocol))`.

There are a few APIs used to retrieve a protocol at runtime.
`@protocol(SomeProtocol)` will now error out of the requested protocol
is marked with attribute. `objc_getProtocol` will return `NULL` which
is consistent with the behavior of a non-existing protocol.

Subscribers: cfe-commits

Tags: #clang

Differential Revision:
The file was modifiedclang/lib/CodeGen/CGObjCMac.cpp
The file was modifiedclang/lib/Sema/SemaExprObjC.cpp
The file was addedclang/test/CodeGenObjC/non-runtime-protocol.m
The file was modifiedclang/test/Misc/pragma-attribute-supported-attributes-list.test
The file was modifiedclang/lib/Sema/SemaDeclAttr.cpp
The file was modifiedclang/include/clang/Basic/
The file was modifiedclang/lib/CodeGen/CGObjCRuntime.h
The file was modifiedclang/lib/CodeGen/CGObjCGNU.cpp
The file was modifiedclang/lib/AST/DeclObjC.cpp
The file was modifiedclang/include/clang/AST/DeclObjC.h
The file was modifiedclang/include/clang/Basic/
The file was modifiedclang/include/clang/Basic/
The file was modifiedclang/lib/CodeGen/CGObjC.cpp
Commit aff896dea13fed04d79bbd1ce20d5e49fec720bc by Vitaly Buka
[NFC][MSAN] Extract llvm.abs handling into a function

Reviewed By: eugenis

Differential Revision:
The file was modifiedllvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Commit 04fce1515b7ae2fcf7986d8578c18cfd559c68b2 by Louis Dionne
[libc++] Fix the build with GCC < 10

For now, we still need to support older GCCs, so work around the lack of
__is_constructible on older GCCs.
The file was modifiedlibcxx/include/type_traits
The file was modifiedlibcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
Commit dc6a0b0ec7e3d72a4cc849af4e4aa6c6a29a53d2 by Yaxun.Liu
[HIP] Align device binary

To facilitate faster loading of device binaries and share them among processes,
HIP runtime favors their alignment being 4096 bytes. HIP runtime can load
unaligned device binaries, however, aligning them at 4096 bytes results in
faster loading and less shared memory usage.

This patch adds an option -bundle-align to clang-offload-bundler which allows
bundles to be aligned at specified alignment. By default it is 1, which is NFC
compared to existing format.

This patch then aligns embedded fat binary and device binary inside fat binary
at 4096 bytes.

It has been verified this change does not cause significant overall file size increase
for typical HIP applications (less than 1%).

Differential Revision:
The file was modifiedclang/test/Driver/clang-offload-bundler.c
The file was modifiedclang/test/Driver/hip-toolchain-no-rdc.hip
The file was modifiedclang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
The file was modifiedclang/test/Driver/hip-toolchain-rdc.hip
The file was modifiedclang/lib/CodeGen/CGCUDANV.cpp
The file was modifiedclang/lib/Driver/ToolChains/HIP.cpp
The file was modifiedclang/test/CodeGenCUDA/
Commit 8fb2a235b0f22dedba72b8b559ba33171a8dcd09 by richard
Don't reject calls to MinGW's unusual _setjmp declaration.

We now recognize this function as a builtin despite it having an
unexpected number of parameters; make sure we don't enforce that it has
only 1 argument for its 2 parameters.
The file was modifiedclang/test/Sema/builtin-setjmp.c
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
The file was modifiedclang/include/clang/Basic/Builtins.def
The file was modifiedclang/lib/Sema/SemaChecking.cpp
Commit b113fa451061244e68af13328df9df46619bd0c3 by aeubanks
[test][Coro][NewPM] Fix coro-elide.ll under NPM
The file was modifiedllvm/test/Transforms/Coroutines/coro-elide.ll
Commit 321986fe68298ded3259bd1ffefe8cbdd60dbf18 by aeubanks
[MetaRenamer][NewPM] Port metarenamer to NPM

Reviewed By: asbirlea

Differential Revision:
The file was modifiedllvm/test/Transforms/MetaRenamer/main.ll
The file was modifiedllvm/lib/Passes/PassRegistry.def
The file was modifiedllvm/lib/Transforms/Utils/MetaRenamer.cpp
The file was addedllvm/include/llvm/Transforms/Utils/MetaRenamer.h
The file was modifiedllvm/test/Transforms/MetaRenamer/metarenamer.ll
The file was modifiedllvm/lib/Passes/PassBuilder.cpp