Changes

Summary

  1. Simplify handling of builtin with inline redefinition (details)
  2. Revert "[clangd] Refactor IncludeStructure: use File (unsigned) for most computations" (details)
  3. [Docs][NFC] Add doxygen comment for AtomicExpandPass in passes.h (details)
  4. [VectorCombine] Discard ScalarizationResult state in early exit. (details)
  5. Add support for `NOLINTBEGIN` ... `NOLINTEND` comments (details)
  6. [Test] Add more tests with cycled phis (details)
  7. Revert "[flang] GET_COMMAND_ARGUMENT(VALUE) runtime implementation" (details)
  8. [lldb] Remove non-stop mode code (details)
  9. [lldb/test] Add ability to specify environment when spawning processes (details)
  10. [CMake] Add detection for the mold linker in AddLLVM.cmake. (details)
  11. Revert "[AArch64] Split bitmask immediate of bitwise AND operation" (details)
  12. Revert "[Test] Add more tests with cycled phis" (details)
  13. Reland "[flang] GET_COMMAND_ARGUMENT runtime implementation" (details)
  14. Recommit "[Test] Add more tests with cycled phis" (details)
  15. [lldb/test] Remove a check from TestLoadAfterAttach (details)
  16. Update the message for template-template param keyword for C++17 (details)
  17. [SLP]No need to schedule/check parent for extract{element/value} instruction. (details)
  18. [IR] Change the default value of InstertElement to poison (1/4) (details)
  19. [Analysis] Add FIXME:s related to size_t type checks (details)
  20. [Analysis] Be defensive when matching size_t in lib call signatures (details)
  21. [InstCombine] add/move tests for icmp with gep operand(s); NFC (details)
  22. Change __builtin_sycl_unique_stable_name to just use an Itanium mangling (details)
Commit 3d6f49a56995b845c40be5827ded5d1e3f692cec by sguelton
Simplify handling of builtin with inline redefinition

It is a common practice in glibc header to provide an inline redefinition of an
existing function. It is especially the case for fortified function.

Clang currently has an imperfect approach to the problem, using a combination of
trivially recursive function detection and noinline attribute.

Simplify the logic by suffixing these functions by `.inline` during codegen, so
that they are not recognized as builtin by llvm.

After that patch, clang passes all tests from https://github.com/serge-sans-paille/fortify-test-suite

Differential Revision: https://reviews.llvm.org/D109967
The file was modifiedclang/lib/CodeGen/CodeGenFunction.cpp
The file was removedclang/test/CodeGen/memcpy-no-nobuiltin-if-not-emitted.c
The file was modifiedclang/test/CodeGen/memcpy-nobuiltin.c
The file was modifiedclang/test/CodeGen/pr9614.c
The file was addedclang/test/CodeGen/memcpy-inline-builtin.c
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
Commit e7a5347b55e6050106bb61fa9a54920720806e07 by kbobyrev
Revert "[clangd] Refactor IncludeStructure: use File (unsigned) for most computations"

This reverts

- d1c6e54930f200c40820868c086e114cee1ec693
- 7394d3ba276adeb1527428b2355a920129a2b9b1
- e50771181b7e0d96b30ee33049dc05172125b927
- 1bcd6b51a98263d440ff7549070060f7e7b0326a
The file was modifiedclang-tools-extra/clangd/Headers.h
The file was modifiedclang-tools-extra/clangd/CodeComplete.cpp
The file was modifiedclang-tools-extra/clangd/unittests/ParsedASTTests.cpp
The file was modifiedclang-tools-extra/clangd/Headers.cpp
The file was modifiedclang-tools-extra/clangd/unittests/HeadersTests.cpp
Commit 1aa7b8388581d9b4a52a8d4c5d4f13d4bf6c0013 by shivam98.tkg
[Docs][NFC] Add doxygen comment for AtomicExpandPass in passes.h
The file was modifiedllvm/include/llvm/CodeGen/Passes.h
Commit e2f6290e06be63149af770197b772248369ac038 by flo
[VectorCombine] Discard ScalarizationResult state in early exit.

ScalarizationResult's destructor makes sure ToFreeze is not ignored if
set. Currently, scalarizeLoadExtract has an early exit if the index is
not safe directly. But when it is SafeWithFreeze, we need to discard the
state first, otherwise we hit the assert in the destructor.

Fixes PR51992.
The file was modifiedllvm/test/Transforms/VectorCombine/AArch64/load-extractelement-scalarization.ll
The file was modifiedllvm/lib/Transforms/Vectorize/VectorCombine.cpp
Commit c0687e1984a82925918c874b7bb68ad34c32aed0 by aaron
Add support for `NOLINTBEGIN` ... `NOLINTEND` comments

Add support for NOLINTBEGIN ... NOLINTEND comments to suppress
clang-tidy warnings over multiple lines. All lines between the "begin"
and "end" markers are suppressed.

Example:

// NOLINTBEGIN(some-check)
<Code with warnings to be suppressed, line 1>
<Code with warnings to be suppressed, line 2>
<Code with warnings to be suppressed, line 3>
// NOLINTEND(some-check)
Follows similar syntax as the NOLINT and NOLINTNEXTLINE comments
that are already implemented, i.e. allows multiple checks to be provided
in parentheses; suppresses all checks if the parentheses are omitted,
etc.

If the comments are misused, e.g. using a NOLINTBEGIN but not
terminating it with a NOLINTEND, a clang-tidy-nolint diagnostic
message pointing to the misuse is generated.

As part of implementing this feature, the following bugs were fixed in
existing code:

IsNOLINTFound(): IsNOLINTFound("NOLINT", Str) returns true when Str is
"NOLINTNEXTLINE". This is because the textual search finds NOLINT as
the stem of NOLINTNEXTLINE.

LineIsMarkedWithNOLINT(): NOLINTNEXTLINEs on the very first line of a
file are ignored. This is due to rsplit('\n\').second returning a blank
string when there are no more newline chars to split on.
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-specific-end-global.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-without-end.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-typo-in-check-name.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-end-without-begin.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-delims.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
The file was modifiedclang-tools-extra/docs/ReleaseNotes.rst
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-end-at-sof.cpp
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-at-eof.cpp
The file was modifiedclang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
The file was modifiedclang-tools-extra/docs/clang-tidy/index.rst
The file was addedclang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-global-end-specific.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/infrastructure/nolint.cpp
The file was modifiedclang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
Commit 7128a545b3baa62c1164843103fb08daeba5cd9d by mkazantsev
[Test] Add more tests with cycled phis
The file was modifiedllvm/test/Analysis/ScalarEvolution/cycled_phis.ll
Commit 6359a4cdbfb83c67a2a776baba4e3f4fb8334853 by diana.picus
Revert "[flang] GET_COMMAND_ARGUMENT(VALUE) runtime implementation"

This reverts commit 0446f1299f6be9fd35bc5f458c78b34dca3105f6 and
df6302311f88d0fbc666b6277d029aa371039945.

There's a warning on flang-aarch64-latest-gcc related to strncpy using
the result of strlen as a bound. I'll recommit with a fix.
The file was modifiedflang/runtime/command.cpp
The file was modifiedflang/runtime/stat.h
The file was modifiedflang/unittests/Runtime/CommandTest.cpp
The file was modifiedflang/include/flang/Runtime/magic-numbers.h
The file was modifiedflang/runtime/stat.cpp
The file was modifiedflang/test/Runtime/no-cpp-dep.c
Commit 156cb4cc64bec2b72aad9848f8181b338ff19ebc by pavel
[lldb] Remove non-stop mode code

We added some support for this mode back in 2015, but the feature was
never productionized. It is completely untested, and there are known
major structural lldb issues that need to be resolved before this
feature can really be supported.

It also complicates making further changes to stop reply packet
handling, which is what I am about to do.

Differential Revision: https://reviews.llvm.org/D110553
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
The file was modifiedlldb/include/lldb/Target/Target.h
The file was modifiedlldb/source/Commands/CommandObjectThread.cpp
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
The file was modifiedlldb/source/Target/Target.cpp
The file was modifiedlldb/source/Target/TargetProperties.td
The file was modifiedlldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Commit 9413ead7bcbaf5d8876ee484256df65c2846c5c9 by pavel
[lldb/test] Add ability to specify environment when spawning processes

We only had that ability for regular debugger launches. This meant that
it was not possible to use the normal dlopen patterns in attach tests.
This fixes that.
The file was modifiedlldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py
The file was modifiedlldb/test/API/functionalities/load_after_attach/main.cpp
The file was modifiedlldb/packages/Python/lldbsuite/test/lldbtest.py
Commit 5b125a49ba9f52cb6b24767f3c98ce623a2d5207 by shivam98.tkg
[CMake] Add detection for the mold linker in AddLLVM.cmake.

mold says it is compatible with GNU ld and gold linkers:

```
$ mold -v
mold 0.9.5 (compatible with GNU ld and GNU gold)
```

And thus it currently gets detected as Gold.

With the following diff, CMake now correctly reports the linker name, and mold keeps being identified as Gold internally for now.

Reviewed By: ldionne, MaskRay

Differential Revision: https://reviews.llvm.org/D110035
The file was modifiedllvm/cmake/modules/AddLLVM.cmake
Commit f85d8a5bed95cc17a452b6b63b9866fbf181d94d by jingu.kang
Revert "[AArch64] Split bitmask immediate of bitwise AND operation"

This reverts commit 864b206796ae8aa7f35f830655337751dbd9176c.

Reverting due to error on buildbots.
The file was removedllvm/lib/Target/AArch64/AArch64MIPeepholeOpt.cpp
The file was modifiedllvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
The file was modifiedllvm/test/CodeGen/AArch64/unfold-masked-merge-scalar-constmask-innerouter.ll
The file was modifiedllvm/test/CodeGen/AArch64/O3-pipeline.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64.h
The file was modifiedllvm/lib/Target/AArch64/CMakeLists.txt
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetMachine.cpp
The file was removedllvm/test/CodeGen/AArch64/aarch64-split-and-bitmask-immediate.ll
Commit a91145f75af4f00c37d767a9ee408c62655ceb44 by mkazantsev
Revert "[Test] Add more tests with cycled phis"

This reverts commit 7128a545b3baa62c1164843103fb08daeba5cd9d.

Need to regenerate tests after rebase.
The file was modifiedllvm/test/Analysis/ScalarEvolution/cycled_phis.ll
Commit 37089bae29a92b97e16be4795553b68a6b04ff91 by diana.picus
Reland "[flang] GET_COMMAND_ARGUMENT runtime implementation"

Recommit https://reviews.llvm.org/D109813 and
https://reviews.llvm.org/D109814.

This implements the second and final entry point for GET_COMMAND_ARGUMENT,
handling the VALUE, STATUS and ERRMSG parameters.

It has a small fix in that we're now using memcpy instead of strncpy
(which was a bad idea to begin with, since we're not actually interested
in a string copy).
The file was modifiedflang/include/flang/Runtime/magic-numbers.h
The file was modifiedflang/runtime/stat.cpp
The file was modifiedflang/runtime/stat.h
The file was modifiedflang/test/Runtime/no-cpp-dep.c
The file was modifiedflang/runtime/command.cpp
The file was modifiedflang/unittests/Runtime/CommandTest.cpp
Commit 00be84f910dc2816a07925e7e0f4c647c1e2f83d by mkazantsev
Recommit "[Test] Add more tests with cycled phis"
The file was modifiedllvm/test/Analysis/ScalarEvolution/cycled_phis.ll
Commit 7866dbb261240f71c79e70d2ed52351846f795cd by pavel
[lldb/test] Remove a check from TestLoadAfterAttach

The two module retrieval methods (qXfer:libraries-svr4 and manual list
traversal) differ in how the handle the
manually-added-but-not-yet-loaded modules. The svr4 path will remove it,
while the manual one will keep in the list.

It's likely the two paths need ought to be synchronized, but right now,
this distinction is not relevant for the test.
The file was modifiedlldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py
Commit 45e75d93821f7e4f04d9f42cb19f729b346e7c0c by erich.keane
Update the message for template-template param keyword for C++17

C++17 permits using 'typename' or 'class' for a template template
parameter, but the error message in the parser only refers to 'class'.
This patch, in C++17 or newer modes, adds "or 'template'" to the
diagnostic.
The file was modifiedclang/test/Parser/cxx2a-concept-declaration.cpp
The file was modifiedclang/lib/Parse/ParseTemplate.cpp
The file was modifiedclang/test/Parser/cxx-template-decl.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticParseKinds.td
Commit 8bacfb9bedf10a2e446db072be2c1cd2cd1d7aab by a.bataev
[SLP]No need to schedule/check parent for extract{element/value} instruction.

The instruction extractelement/extractvalue are not required to
be scheduled since they only depend on the source vector/aggregate (with
constant indices), smae applies to the parent basic block checks.
Improves compile time and saves scheduling budget.

Differential Revision: https://reviews.llvm.org/D108703
The file was modifiedllvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
Commit 86bf234d0b7038479292a0d771dc05966140b908 by gusrb406
[IR] Change the default value of InstertElement to poison (1/4)

This patch is for fixing potential insertElement-related bugs like D93818.
```
V = UndefValue::get(VecTy);
for(...)
  V = Builder.CreateInsertElementy(V, Elt, Idx);
=>
V = PoisonValue::get(VecTy);
for(...)
  V = Builder.CreateInsertElementy(V, Elt, Idx);
```
Like above, this patch changes the placeholder V to poison.
The patch will be separated into several commits.

Reviewed By: aqjune

Differential Revision: https://reviews.llvm.org/D110311
The file was modifiedllvm/include/llvm/IR/IRBuilder.h
The file was modifiedllvm/lib/IR/AutoUpgrade.cpp
The file was modifiedllvm/unittests/IR/PatternMatch.cpp
The file was modifiedllvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
The file was modifiedllvm/unittests/IR/IRBuilderTest.cpp
Commit 1f5ea14bca71aecad1f5a6017ff20fe50c9da752 by bjorn.a.pettersson
[Analysis] Add FIXME:s related to size_t type checks

Differential Revision: https://reviews.llvm.org/D110583
The file was modifiedllvm/lib/Analysis/TargetLibraryInfo.cpp
Commit 460efc1fb8354295ce1320b5dae62f06cdeda278 by bjorn.a.pettersson
[Analysis] Be defensive when matching size_t in lib call signatures

When TargetLibraryInfoImpl::isValidProtoForLibFunc is checking
function signatures to detect lib calls it may check that a parameter
or return value matches with the "size_t" type. For this to work it
has to derive the IR type matching with "size_t". Depending on if
a DataLayout is provided or not, this has been done in two different
way. Either a more strict check being based on IntPtrType (which is
given by the DataLayout) or a more relaxed check assuming that any
integer type matches with "size_t".

Given that the stricter approach exist it seems like we do not want
to trigger rewrites etc if we aren't sure that a function calls
actually match with the library function. Therefore it was questioned
why we actually have the more relaxed approach when not being able
to derive an IR type for "size_t". This patch will take a more
defensive approach, requiring that a DataLayout is passed to
isValidProtoForLibFunc.

Differential Revision: https://reviews.llvm.org/D110584
The file was modifiedllvm/lib/Analysis/TargetLibraryInfo.cpp
The file was modifiedllvm/include/llvm/Analysis/TargetLibraryInfo.h
Commit 72d991c42e185d3bf248d22fe25073fbf345529f by spatel
[InstCombine] add/move tests for icmp with gep operand(s); NFC
The file was modifiedllvm/test/Transforms/InstCombine/icmp.ll
The file was addedllvm/test/Transforms/InstCombine/icmp-gep.ll
The file was modifiedllvm/test/Transforms/InstCombine/indexed-gep-compares.ll
Commit 9324cc2ca951fe5fe11c85470cb08e699c59499c by erich.keane
Change __builtin_sycl_unique_stable_name to just use an Itanium mangling

After significant problems in our downstream with the previous
implementation, the SYCL standard has opted to make using macros/etc to
change kernel-naming-lambdas in any way UB (even passively). As a
result, we are able to just emit the itanium mangling.

However, this DOES require a little work in the CXXABI, as the microsoft
and itanium mangler use different numbering schemes for lambdas.  This
patch adds a pair of mangling contexts that use the normal 'itanium'
mangling strategy to fill in the "DeviceManglingNumber" used previously
by CUDA.

Differential Revision: https://reviews.llvm.org/D110281
The file was modifiedclang/docs/LanguageExtensions.rst
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/lib/Sema/SemaSYCL.cpp
The file was modifiedclang/test/CodeGenSYCL/unique_stable_name.cpp
The file was modifiedclang/lib/AST/Expr.cpp
The file was modifiedclang/lib/AST/ItaniumMangle.cpp
The file was modifiedclang/lib/AST/ASTContext.cpp
The file was modifiedclang/lib/AST/ItaniumCXXABI.cpp
The file was modifiedclang/lib/Sema/SemaTemplateInstantiateDecl.cpp
The file was modifiedclang/include/clang/AST/ASTContext.h
The file was modifiedclang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp
The file was modifiedclang/lib/AST/MicrosoftCXXABI.cpp
The file was modifiedclang/test/SemaSYCL/unique_stable_name.cpp
The file was modifiedclang/lib/AST/ExprConstant.cpp
The file was modifiedclang/include/clang/Sema/Sema.h