Changes

Summary

  1. [gn build] Port ff13189c5d0d (details)
  2. tsan: refactor trace tests (details)
  3. [llvm][AArch64][SVE] Fold literals into math instructions (details)
  4. Lex arguments for __has_cpp_attribute and friends as expanded tokens (details)
  5. [InstCombine] Add some extra tests for truncated saturates. NFC (details)
Commit 1d7aadb4c48a696a8501126357295fdcc3c98380 by llvmgnsyncbot
[gn build] Port ff13189c5d0d
The file was modifiedllvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
Commit 27969c4e00bb3fcfc8cc149864e1b1f7e87a6753 by dvyukov
tsan: refactor trace tests

Instead of creating real threads for trace tests
create a new ThreadState in the main thread.
This makes the tests more unit-testy and will also
help with future trace tests that will need
more than 1 thread. Creating more than 1 real thread and
dispatching test actions across multiple threads in the
required deterministic order is painful.

This is resubmit of reverted D110546 with 2 changes:
1. The previous version patched ImitateTlsWrite to not
expect ThreadState to be allocated in TLS (the CHECK
failed for the fake test threads).
This added an ugly hack into production code and was still
logically wrong because we imitated write to the main
thread TLS/stack when we started the fake test thread
(which has nothing to do with the main thread TLS/stack).
This version uses ThreadType::Fiber instead of ThreadType::Regular
for the fake threads. This naturally makes ThreadStart skip
obtaining stack/tls and imitating writes to them.

2. This version still skips the tests on Darwin and PowerPC
to be on the safer side. Build bots reported failures for PowerPC
for the previous version.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D111156
The file was modifiedcompiler-rt/lib/tsan/tests/unit/tsan_trace_test.cpp
Commit 2e0fb007d63cf4d7979c6f6f577e6906145c7b95 by david.truby
[llvm][AArch64][SVE] Fold literals into math instructions

SVE has predicated literal forms of some instructions for specific
literals, which currently are generated correctly when using ACLE
but not when those instructions are generated directly.

This adds the patterns to generate those instructions when
generating from standard LLVM IR instructions.

Differential Revision: https://reviews.llvm.org/D99074
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrFormats.td
The file was addedllvm/test/CodeGen/AArch64/sve-intrinsics-fp-arith-imm.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
The file was modifiedllvm/lib/Target/AArch64/SVEInstrFormats.td
The file was addedllvm/test/CodeGen/AArch64/sve-fp-immediates-merging.ll
Commit 2edb89c746848c52964537268bf03e7906bf2542 by aaron
Lex arguments for __has_cpp_attribute and friends as expanded tokens

The C and C++ standards require the argument to __has_cpp_attribute and
__has_c_attribute to be expanded ([cpp.cond]p5). It would make little sense
to expand the argument to those operators but not expand the argument to
__has_attribute and __has_declspec, so those were both also changed in this
patch.

Note that it might make sense for the other builtins to also expand their
argument, but it wasn't as clear to me whether the behavior would be correct
there, and so they were left for a future revision.
The file was modifiedclang/lib/Lex/PPMacroExpansion.cpp
The file was modifiedclang/docs/ReleaseNotes.rst
The file was addedclang/test/Preprocessor/has_attribute_errors.cpp
The file was modifiedclang/test/Preprocessor/has_attribute.c
The file was modifiedclang/test/Preprocessor/has_c_attribute.c
The file was modifiedclang/test/Preprocessor/has_attribute.cpp
Commit 052b77e49f50e5796ee84a55c8a409b3ee41af22 by david.green
[InstCombine] Add some extra tests for truncated saturates. NFC
The file was addedllvm/test/Transforms/InstCombine/truncating-saturate.ll