Changes

Summary

  1. Revert "Revert "[VE] notify and build as official target"" (details)
Commit 9b41104ec0fb06710faaf7b4b4a55ed37369c2ea by simon.moll
Revert "Revert "[VE] notify and build as official target""

This reverts commit 5db9389c3afd04a46c62bfdcb9590f4714975a69.

Switching to follow llvm-project.git:

commit 6f25e754a0d
Author: Simon Moll <simon.moll@emea.nec.com>
Date:   Thu Dec 2 11:17:47 2021 +0100

    Revert "Revert "[VE] Make VE official""
The file was modifiedzorg/buildbot/builders/annotated/ve-linux-steps.make (diff)
The file was modifiedbuildbot/osuosl/master/config/status.py (diff)

Summary

  1. [clang-format] Add better support for co-routinues (details)
  2. [GlobalOpt] Add test for PR39751 (NFC) (details)
  3. [llvm-c] Make LLVMAddAlias opaque pointer compatible (details)
  4. [fir] Add fir numeric intrinsic runtime call builder (details)
  5. [clangd] IncludeClenaer: Don't mark forward declarations of a class if it's declared in the main file (details)
  6. [ORC] Fix ambiguous call to overloaded function. (details)
  7. [VE][NFC] Fix use-after-free in PVFMK expansion (details)
  8. [BuildLibCalls] Add additional attrs to memcpy_chk. (details)
  9. [ELF] Discard input .note.gnu.build-id even with default --build-id=none (details)
  10. [InferAttrs] Add memset_pattern{4,8} declarations to test. (details)
  11. Revert "Revert "[VE] Make VE official"" (details)
  12. [Flang] Replace notifyMatchFailure with TODO hard failures (details)
  13. [ARM] Add additional postinc distribute tests and regenerate tests. NFC (details)
  14. Use cc/c++ instead of gcc/g++ on FreeBSD. (details)
  15. [GlobalOpt] Fix assertion failure during instruction deletion (details)
  16. [BuildLibCalls] Add support for memset_pattern{4,8}. (details)
  17. [llvm-readobj] Add support for machine-independent NetBSD ELF core notes. (details)
  18. [ARM] Correct range in isLegalAddressImm (details)
  19. [LICM] Adding the test as a precommit for the D113289 (details)
  20. [DAG][PowerPC] Enable initial ISD::BITCAST SimplifyDemandedBits/SimplifyMultipleUseDemandedBits big-endian handling (details)
  21. [BasicAA] Add tests for memset_pattern{4,8,16}. (details)
  22. Reland "[LICM] Hoist LOAD without sinking the STORE" (details)
  23. [VE][Clang][NFC] Disable VE toolchain tests on Windows (details)
  24. [AArch64][SVE] Enable bf16 vector.insert (details)
  25. Expand testing of necessary features for print-changed=dot-cfg. (details)
  26. [fir] Declare test function inline (details)
  27. Add new clang-tidy check for string_view(nullptr) (details)
  28. Fix documentation for `forEachLambdaCapture` and `hasAnyCapture` (details)
  29. [HIPSPV] Add CUDA->SPIR-V address space mapping (details)
  30. [flang] GettingInvolved: update LLVM Alias Analysis Technical Call info (details)
  31. [gn build] Port 6a9487df73e9 (details)
Commit 57b95aed2a04f00dc84c4c4926c506528081196d by mydeveloperday
[clang-format] Add better support for co-routinues

Responding to a Discord call to help {D113977} and heavily inspired by the unlanded {D34225} add some support to help coroutinues from not being formatted from

```for co_await(auto elt : seq)```

to

```
for
co_await(auto elt : seq)
```

Because of the dominance of clang-format in the C++ community, I don't think we should make it the blocker that prevents users from embracing the newer parts of the standard because we butcher the layout of some of the new constucts.

Reviewed By: HazardyKnusperkeks, Quuxplusone, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D114859
The file was modifiedclang/docs/ReleaseNotes.rst
The file was modifiedclang/lib/Format/UnwrappedLineParser.cpp
The file was modifiedclang/unittests/Format/FormatTest.cpp
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
Commit bc61e5e90b8db92aa5464d0565c8993b776df54d by nikita.ppv
[GlobalOpt] Add test for PR39751 (NFC)

This has been fixed by D114889, as noted in the comments.
The file was addedllvm/test/Transforms/GlobalOpt/pr39751.ll
Commit 55d392cc30fb36e6361ba71f4b568c093f8b23f3 by nikita.ppv
[llvm-c] Make LLVMAddAlias opaque pointer compatible

Deprecate LLVMAddAlias in favor of LLVMAddAlias2, which accepts a
value type and an address space. Previously these were extracted
from the pointer type.

Differential Revision: https://reviews.llvm.org/D114860
The file was modifiedllvm/lib/IR/Core.cpp
The file was modifiedllvm/tools/llvm-c-test/echo.cpp
The file was modifiedllvm/include/llvm-c/Core.h
The file was modifiedllvm/unittests/IR/ConstantsTest.cpp
Commit 529d0942daf3ed0766dafadad562dfeacf734c3e by clementval
[fir] Add fir numeric intrinsic runtime call builder

This patch adds the FIR builder to generate the numeric intrinsic
runtime call.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: rovka

Differential Revision: https://reviews.llvm.org/D114477

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
The file was modifiedflang/lib/Optimizer/Builder/CMakeLists.txt
The file was addedflang/lib/Optimizer/Builder/Runtime/Numeric.cpp
The file was addedflang/include/flang/Optimizer/Builder/Runtime/Numeric.h
The file was modifiedflang/unittests/Optimizer/CMakeLists.txt
The file was addedflang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp
Commit d3a4ef35685c6aaad74294b678e77e1b75af1918 by kbobyrev
[clangd] IncludeClenaer: Don't mark forward declarations of a class if it's declared in the main file

This will mark more headers that are unrelated to used symbol but contain its
forawrd declaration. E.g. the following are examples of headers forward
declaring `llvm::StringRef`:

- clang/include/clang/Basic/Cuda.h
- llvm/include/llvm/Support/SHA256.h
- llvm/include/llvm/Support/TrigramIndex.h
- llvm/include/llvm/Support/RandomNumberGenerator.
- ... and more (~50 in total)

This patch is a reduced version of D112707 which was controversial.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D114864
The file was modifiedclang-tools-extra/clangd/IncludeCleaner.cpp
The file was modifiedclang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
Commit 905381dc108cc8fa0003b26cc1ae689987e73f47 by Lang Hames
[ORC] Fix ambiguous call to overloaded function.

This should fix the build failure at
https://lab.llvm.org/buildbot#builders/110/builds/8359
The file was modifiedllvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
Commit e37000f3bff384e20e0696ab4c9126d50030b144 by simon.moll
[VE][NFC] Fix use-after-free in PVFMK expansion

There is custom expansion code for packed VFMK Pseudos in the VE
backend.  This code erased the Pseudo without telling
ExpandPostRAPseudos about it, causing the generic expansion function to
access the erased Pseudo.  This bug triggered in the
test/CodeGen/VE/VELIntrinsics/vfmk.ll test with asan-enabled builds.

Detected by:
sanitizer-x86_64-linux-fast
(https://lab.llvm.org/buildbot/#/builders/5/builds/15393)
The file was modifiedllvm/lib/Target/VE/VEInstrInfo.cpp
Commit 0496edad49939b655435ad71ffda9e366c7c3dc6 by flo
[BuildLibCalls] Add additional attrs to memcpy_chk.

`memcpy_chk` can be treated like `memcpy`, with the exception that it
may not return (if it aborts the program).

See D114793 for a similar patch for `memset_chk`.

Reviewed By: xbolva00

Differential Revision: https://reviews.llvm.org/D114863
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/annotate.ll
The file was modifiedllvm/lib/Transforms/Utils/BuildLibCalls.cpp
Commit c5bfffed4831fd8ef3aa1fa3d9d4268d546bf6c5 by i
[ELF] Discard input .note.gnu.build-id even with default --build-id=none

binutils 2.38 will adopt this behavior
https://sourceware.org/bugzilla/show_bug.cgi?id=28639

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D114910
The file was modifiedlld/ELF/InputFiles.cpp
The file was modifiedlld/test/ELF/relocatable-build-id.s
Commit d9bb9bd4bf7a661cbb67f49e2c65f637367393eb by flo
[InferAttrs] Add memset_pattern{4,8} declarations to test.
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/annotate.ll
Commit 6f25e754a0daf7ffa871072d8f2b5304b79096fa by simon.moll
Revert "Revert "[VE] Make VE official""

This reverts commit 27c9e8b45b25614a92539ac6787dbb5670d950b3.

Bugs exposed by AddressSanitizer have been reproduced and fixed locally:
* commit e37000f3bff384
* commit 435d44bf8ab392
The file was modifiedllvm/CMakeLists.txt
Commit 7ce8c6fcf1e3d0f22c11ef827b9e152a00de7eae by kiran.chandramohan
[Flang] Replace notifyMatchFailure with TODO hard failures

For unimplemented patterns we revert to using TODO hard failures instead of
notifyMatchFailure.

For fir.select_type revert to using mlir::emiterror.
For the fir.embox TODO on a type with len params we cannot add a test since the type cannot be converted to llvm.

Adding negative tests using not and checking for the error message.
TODO exits with an error in a build without assertion but aborts in a
build with assertions. Abort requires using not with the --crash
option. The two different usages of not is handled by using a custom
command %not_todo_cmd which is converted to not or not --crash
depending on the presence or absence of assertions. Using llvm-config
to check the presence of assertions.

Reviewed By: clementval, awarzynski

Differential Revision: https://reviews.llvm.org/D114371
The file was addedflang/test/Fir/Todo/boxproc_host.fir
The file was addedflang/test/Fir/Todo/end.fir
The file was addedflang/test/Fir/Todo/select_case_with_character.fir
The file was addedflang/test/Fir/Todo/unboxproc.fir
The file was modifiedflang/test/lit.cfg.py
The file was addedflang/test/Fir/Todo/gentypedesc.fir
The file was addedflang/test/Fir/Todo/len_param_index.fir
The file was modifiedflang/lib/Optimizer/CodeGen/CodeGen.cpp
The file was modifiedflang/test/Fir/convert-to-llvm-invalid.fir
The file was addedflang/test/Fir/Todo/emboxproc.fir
The file was addedflang/test/Fir/Todo/global_len.fir
The file was addedflang/test/Fir/Todo/dispatch.fir
The file was addedflang/test/Fir/Todo/dispatch_table.fir
The file was modifiedflang/test/CMakeLists.txt
Commit 73c50ccf7a6bf82eb6a7d19510e9f7315d471c57 by david.green
[ARM] Add additional postinc distribute tests and regenerate tests. NFC
The file was modifiedllvm/test/CodeGen/Thumb2/store-prepostinc.mir
The file was modifiedllvm/test/CodeGen/Thumb2/postinc-distribute.mir
Commit 69deb1371fd4cd2fbf37a82cbc21df79c6d51c70 by fred
Use cc/c++ instead of gcc/g++ on FreeBSD.

All supported FreeBSD platforms do not have GCC in base anymore.

Differential Revision: https://reviews.llvm.org/D114530
The file was modifiedclang/tools/scan-build/libexec/ccc-analyzer
Commit a0ff26e08c0cca4917a08c8b8383b8338aa8e73e by nikita.ppv
[GlobalOpt] Fix assertion failure during instruction deletion

This fixes the assertion failure reported in https://reviews.llvm.org/D114889#3166417,
by making RecursivelyDeleteTriviallyDeadInstructionsPermissive()
more permissive. As the function accepts a WeakTrackingVH, even if
originally only Instructions were inserted, we may end up with
different Value types after a RAUW operation. As such, we should
not assume that the vector only contains instructions.

Notably this matches the behavior of the
RecursivelyDeleteTriviallyDeadInstructions() function variant which
accepts a single value rather than vector.
The file was addedllvm/test/Transforms/GlobalOpt/recursively-delete-dead-inst-assertion.ll
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
Commit 2de5f39e546d64ed00fd63f47b64c1cafe5d6e35 by flo
[BuildLibCalls] Add support for memset_pattern{4,8}.

Add support for memset_pattern{4,8} similar to the existing
memset_pattern16 handling.

Reviewed By: ab

Differential Revision: https://reviews.llvm.org/D114883
The file was modifiedllvm/lib/Transforms/Utils/BuildLibCalls.cpp
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/annotate.ll
Commit 878ff1f9f85f6c539efb9b8c00978011d381f278 by fred
[llvm-readobj] Add support for machine-independent NetBSD ELF core notes.

Notes generated in NetBSD core files provide additional information about
processes. These notes are described in core.5, which can be viewed here:
https://man.netbsd.org/core.5

Differential Revision: https://reviews.llvm.org/D114635
The file was modifiedllvm/include/llvm/BinaryFormat/ELF.h
The file was modifiedllvm/lib/ObjectYAML/ELFYAML.cpp
The file was modifiedllvm/tools/llvm-readobj/ELFDumper.cpp
The file was addedllvm/test/tools/llvm-readobj/ELF/note-netbsd-core.test
Commit e62930255822f86c5b422a0d61bbfc77324de3a9 by david.green
[ARM] Correct range in isLegalAddressImm

The ranges in isLegalAddressImm were off by one, not allowing the
maximum values for unscaled offsets.

Differential Revision: https://reviews.llvm.org/D114636
The file was modifiedllvm/test/CodeGen/Thumb2/store-prepostinc.mir
The file was modifiedllvm/lib/Target/ARM/ARMBaseInstrInfo.h
Commit 8e757b2383c90d81bc9661fd4ac070931a679ace by djtodoro
[LICM] Adding the test as a precommit for the D113289
The file was addedllvm/test/Transforms/LICM/hoist-load-without-store.ll
Commit 6803d08c38af7e3235e6cd249761511704e0f88d by llvm-dev
[DAG][PowerPC] Enable initial ISD::BITCAST SimplifyDemandedBits/SimplifyMultipleUseDemandedBits big-endian handling

This patch begins extending handling for peeking through bitcast nodes to big-endian targets as well as the existing little-endian case.

Differential Revision: https://reviews.llvm.org/D114676
The file was modifiedllvm/test/CodeGen/PowerPC/vec_conv_i16_to_fp32_elts.ll
The file was modifiedllvm/test/CodeGen/PowerPC/vec_extract_p9.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Commit 47616c8855fd44abcbd7cad3f7d8153d28db347b by flo
[BasicAA] Add tests for memset_pattern{4,8,16}.

This also removes the existing memset_pattern.ll test, which was relying
on GVN. It is also covered by the new test directly.
The file was addedllvm/test/Analysis/BasicAA/libfuncs-darwin.ll
The file was removedllvm/test/Analysis/BasicAA/memset_pattern.ll
Commit 2cdc6f2ca62e83fec445114fbbe6276e9ab2a7d0 by djtodoro
Reland "[LICM] Hoist LOAD without sinking the STORE"

When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.

Please consider this small example:

loop {
  var = *ptr;
  if (var) break;
  *ptr= var + 1;
}
After this patch, it will be:

var0 = *ptr;
loop {
  var1 = phi (var0, var2);
  if (var1) break;
  var2 = var1 + 1;
  *ptr = var2;
}
This addresses some problems from [0].

[0] https://bugs.llvm.org/show_bug.cgi?id=51193

Differential revision: https://reviews.llvm.org/D113289
The file was modifiedllvm/lib/Transforms/Utils/SSAUpdater.cpp
The file was modifiedllvm/test/Transforms/LICM/scalar-promote-opaque-ptrs.ll
The file was modifiedllvm/test/Transforms/LICM/promote-capture.ll
The file was modifiedllvm/test/Transforms/LICM/scalar-promote.ll
The file was modifiedllvm/test/Transforms/InstMerge/st_sink_bugfix_22613.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/SSAUpdater.h
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
The file was modifiedllvm/test/Transforms/LICM/hoist-load-without-store.ll
The file was modifiedllvm/test/Transforms/LICM/scalar-promote-memmodel.ll
Commit 3b442644e278b53e351addf349c75b995b10f029 by simon.moll
[VE][Clang][NFC] Disable VE toolchain tests on Windows

VE hardware is unsupported under Windows. Disable the clang VE toolchain
tests here. Tests breaking because of non-POSIX path separators.
The file was modifiedclang/test/Driver/ve-toolchain.cpp
The file was modifiedclang/test/Driver/ve-toolchain.c
Commit 4244f95cc6ce73ab38fbb91929a0888309f3ca8d by matthew.devereau
[AArch64][SVE] Enable bf16 vector.insert

Allow passthrough bf16 registers for vector.insert

Differential revision: https://reviews.llvm.org/D114858
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.cpp
The file was modifiedllvm/test/CodeGen/AArch64/sve-insert-vector.ll
Commit 2a1bf9e0cf78a0582b62de8e78375394bb8f6711 by schmeise
Expand testing of necessary features for print-changed=dot-cfg.

Summary:
Expand the testing for whether the lit tests for print-changed=dot-cfg
are supported to include checking whether dot supports pdf output.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: hvdijk (Harald van Dijk)
Differential Revision: https://reviews.llvm.org/D113187
The file was modifiedllvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg
Commit 99961b4f1c73f135e5022d7c09dca05eb867cf7b by clementval
[fir] Declare test function inline

Declare functions checkCallOp and checkCallOpFromResultBox inline due to buildbot failure flang-aarch64-latest-clang
The file was modifiedflang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h
Commit 6a9487df73e917c4faf5e060f2bb33c6ade3f967 by yitzhakm
Add new clang-tidy check for string_view(nullptr)

Checks for various ways that the `const CharT*` constructor of `std::basic_string_view` can be passed a null argument and replaces them with the default constructor in most cases. For the comparison operators, braced initializer list does not compile so instead a call to `.empty()` or the empty string literal are used, where appropriate.

This prevents code from invoking behavior which is unconditionally undefined. The single-argument `const CharT*` constructor does not check for the null case before dereferencing its input. The standard is slated to add an explicitly-deleted overload to catch some of these cases: wg21.link/p2166

https://reviews.llvm.org/D114823 is a companion change to prevent duplicate warnings from the `bugprone-string-constructor` check.

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D113148
The file was addedclang-tools-extra/docs/clang-tidy/checks/bugprone-stringview-nullptr.rst
The file was modifiedclang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
The file was modifiedclang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
The file was addedclang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp
The file was addedclang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.h
The file was modifiedclang-tools-extra/docs/clang-tidy/checks/list.rst
The file was modifiedclang-tools-extra/docs/ReleaseNotes.rst
The file was addedclang-tools-extra/test/clang-tidy/checkers/bugprone-stringview-nullptr.cpp
Commit 4e9e2f24178077d7055c0f667d13f887fef508d5 by yitzhakm
Fix documentation for `forEachLambdaCapture` and `hasAnyCapture`

Updates the return types of these matchers' definitions to use
`internal::Matcher<LambdaCapture>` instead of `LambdaCaptureMatcher`. This
ensures that they are categorized as traversal matchers, instead of narrowing
matchers.

Reviewed By: ymandel, tdl-g, aaron.ballman

Differential Revision: https://reviews.llvm.org/D114809
The file was modifiedclang/docs/LibASTMatchersReference.html
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchers.h
Commit f4d3cb4ca833d0b165d199e78ed8f1d59a8032eb by anastasia.stulova
[HIPSPV] Add CUDA->SPIR-V address space mapping

Add mapping for CUDA address spaces for HIP to SPIR-V
translation. This change allows HIP device code to be
emitted as valid SPIR-V by mapping unqualified pointers
to generic address space and by mapping __device__ and
__shared__ AS to their equivalent AS in SPIR-V
(CrossWorkgroup and Workgroup, respectively).

Cuda's __constant__ AS is handled specially. In HIP
unqualified pointers (aka "flat" pointers) can point to
__constant__ objects. Mapping this AS to ConstantMemory
would produce to illegal address space casts to
generic AS. Therefore, __constant__ AS is mapped to
CrossWorkgroup.

Patch by linjamaki (Henry Linjamäki)!

Differential Revision: https://reviews.llvm.org/D108621
The file was addedclang/test/CodeGenHIP/hipspv-addr-spaces.cpp
The file was modifiedclang/lib/Basic/Targets/SPIR.h
Commit 6f08b55213d8a7646b01b20d506bd7f2e170de83 by jeroen.dobbelaere
[flang] GettingInvolved: update LLVM Alias Analysis Technical Call info

The google doc was changed and the calls are now using teams.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D114145
The file was modifiedflang/docs/GettingInvolved.md
Commit a692c5492ad534c54ee283ac266e841d781cac90 by llvmgnsyncbot
[gn build] Port 6a9487df73e9
The file was modifiedllvm/utils/gn/secondary/clang-tools-extra/clang-tidy/bugprone/BUILD.gn

Summary

  1. Revert "Revert "[VE] notify and build as official target"" (details)
Commit 9b41104ec0fb06710faaf7b4b4a55ed37369c2ea by simon.moll
Revert "Revert "[VE] notify and build as official target""

This reverts commit 5db9389c3afd04a46c62bfdcb9590f4714975a69.

Switching to follow llvm-project.git:

commit 6f25e754a0d
Author: Simon Moll <simon.moll@emea.nec.com>
Date:   Thu Dec 2 11:17:47 2021 +0100

    Revert "Revert "[VE] Make VE official""
The file was modifiedbuildbot/osuosl/master/config/status.py
The file was modifiedzorg/buildbot/builders/annotated/ve-linux-steps.make