Changes

Summary

  1. [ARM] Add trackLiveness to block-placement.mir. NFC (details)
  2. [mlir] Remove invalid DeallocOpLowering pattern insertion (details)
  3. Revert "[libcxx][CI] Work around Arm buildkite failures" (details)
  4. [mlir][linalg] Fix comments around ConstraintsSet (details)
  5. tsan: inline ProcessPendingSignals check (details)
  6. tsan: minor IgnoreSet refactoring (details)
  7. [clang-tidy] Always open files using UTF-8 encoding (details)
  8. [AArch64][AsmParser] NFC: Parser.Lex() -> Lex() (details)
  9. [OpenMPIRBuilder] Add a constructor to ReductionInfo to appease gcc5 (details)
  10. [ARM] Revert WLSTP to DLSTP if the target block is out of range (details)
  11. [flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions` (details)
  12. [LoopFlatten] Fix missed LoopFlatten opportunity (details)
  13. Fix MSVC signed/unsigned comparison warning. NFCI. (details)
  14. [TTI] Add basic SK_InsertSubvector shuffle mask recognition (details)
  15. [hwasan] Detect use after scope within function. (details)
  16. [CostModel] Treat 'widen subvector' patterns as zero cost (details)
  17. GlobalISel: Fix infinite loop in legalization artifact combiner (details)
  18. [AMDGPU] Disable NSA for BVH instructions when appropriate (details)
  19. [CostModel][AArch64] Add some shuffle concat tests. NFC. (details)
  20. tsan: refactor MetaMap::GetAndLock interface (details)
  21. tsan: add LIKELY/UNLIKELY to MetaMap::GetSync (details)
  22. tsan: don't save creation stack for some sync objects (details)
  23. tsan: add new vector clock (details)
Commit 85455192e18959b0d5bc20e99c21e13de9c5695e by david.green
[ARM] Add trackLiveness to block-placement.mir. NFC

Also move the test to mve-wls-block-placement.mir, to better fit what it
tests.
The file was addedllvm/test/CodeGen/Thumb2/mve-wls-block-placement.mir
The file was removedllvm/test/CodeGen/Thumb2/block-placement.mir
Commit 00a756d3f6e9266960718c2730a6aea61178f359 by ivan.butygin
[mlir] Remove invalid DeallocOpLowering pattern insertion

It is inserted later under then condition.

Differential Revision: https://reviews.llvm.org/D107238
The file was modifiedmlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
Commit e517a2405f39a174e65e4105106ae39704f88e4d by david.spickett
Revert "[libcxx][CI] Work around Arm buildkite failures"

This reverts commit f8bef4734845226c079900de3c273c8ab1915b49.

Buildkite agent 3.32.0 includes a fix for the PATH issue.
https://github.com/buildkite/agent/releases/tag/v3.32.0

Differential Revision: https://reviews.llvm.org/D107172
The file was modifiedlibcxx/utils/ci/run-buildbot
Commit 192e111e760b442c366ba053fe0a696edc2ea35b by springerm
[mlir][linalg] Fix comments around ConstraintsSet

Differential Revision: https://reviews.llvm.org/D107018
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
The file was modifiedmlir/include/mlir/Dialect/Linalg/Analysis/ConstraintsSet.h
Commit 8a49e053caac1623b7f0d87b68d21fb6526cad43 by dvyukov
tsan: inline ProcessPendingSignals check

ProcessPendingSignals is called in all interceptors
and user atomic operations. Make the fast-path check
(no pending signals) inlinable.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107217
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_rtl.h
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
Commit 7c6cca4b6e75fb3feea5449325c9394ee87456c3 by dvyukov
tsan: minor IgnoreSet refactoring

1. Move kMaxSize declaration to private section.
2. Inline Reset, it's trivial and called semi-frequently.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107215
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_ignoreset.h
Commit 307b1fddd4d84b559b154ff7744ae68bf9c6f503 by weratt
[clang-tidy] Always open files using UTF-8 encoding

The encoding used for opening files depends on the OS and might be different
from UTF-8 (e.g. on Windows it can be CP-1252). The documentation files use
UTF-8 and might be incompatible with other encodings. For example, right now
`clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst`
has non-ASCII quotes and running `add_new_check.py` fails on Windows, because
it tries to read the file with incompatible encoding.

Use `io.open` for compatibility with both Python 2 and Python 3.

Reviewed By: kbobyrev

Differential Revision: https://reviews.llvm.org/D106792
The file was modifiedclang-tools-extra/clang-tidy/rename_check.py
The file was modifiedclang-tools-extra/clang-tidy/add_new_check.py
Commit 7ed0120d84d2e143bce1b9bd5f426f0bc8d53102 by cullen.rhodes
[AArch64][AsmParser] NFC: Parser.Lex() -> Lex()

Reviewed By: tmatheson

Differential Revision: https://reviews.llvm.org/D107146
The file was modifiedllvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Commit 58cc5a4c9fe7580eeaa7dd856ca89aa73f3482c8 by zinenko
[OpenMPIRBuilder] Add a constructor to ReductionInfo to appease gcc5

Otherwise, it produces wrong code for brace initializers.
The file was modifiedllvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
Commit 28293918409dd3a5aa1aefa3342e50e099814cab by david.green
[ARM] Revert WLSTP to DLSTP if the target block is out of range

If the block target for a WLSTP instruction is known to be out of range,
and cannot be fixed by the ARMBlockPlacementPass, we can relax it to a
DLSTP (and cmp/branch) to still allow the creation of tail predicated
loops. That is what this patch does, adding extra revert code to the
fallback path of ARMBlockPlacementPass.

Due to the code produced when reverting, this creates a DLSTP between a
Bcc and a Br. As a DLS isn't necessarily a terminator we need to split
the block to move the DLS/Br into.

Differential Revision: https://reviews.llvm.org/D104709
The file was modifiedllvm/lib/Target/ARM/ARMBlockPlacement.cpp
The file was modifiedllvm/test/CodeGen/Thumb2/mve-wls-block-placement.mir
The file was modifiedllvm/test/CodeGen/Thumb2/mve-memtp-branch.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-memtp-loop.ll
Commit 23d4c4f3fb12e127a5f07a7082f33b02082bb3f5 by andrzej.warzynski
[flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`

As all member variables in `FrontendOptions` and `PreprocessorOptions`
are public, we should be naming them as `variable` rather than
`variable_` [1]. This patch fixes that.

Also, `FrontendOptions` & `PreprocessorOptions` are re-defined as a
structs rather than classes (all fields are meant to be public).

[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md#naming

Differential Revision: https://reviews.llvm.org/D107062
The file was modifiedflang/lib/Frontend/FrontendAction.cpp
The file was modifiedflang/include/flang/Frontend/FrontendOptions.h
The file was modifiedflang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedflang/include/flang/Frontend/CompilerInstance.h
The file was modifiedflang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
The file was modifiedflang/unittests/Frontend/FrontendActionTest.cpp
The file was modifiedflang/lib/Frontend/CompilerInstance.cpp
The file was modifiedflang/lib/Frontend/FrontendActions.cpp
The file was modifiedflang/include/flang/Frontend/PreprocessorOptions.h
The file was modifiedflang/docs/FlangDriver.md
Commit f117ed542fd2c327924d7767268d75ce77559944 by rosie.sumpter
[LoopFlatten] Fix missed LoopFlatten opportunity

When the limit of the inner loop is a known integer, the InstCombine
pass now causes the transformation e.g. imcp ult i32 %inc, tripcount ->
icmp ult %j, tripcount-step (where %j is the inner loop induction
variable and %inc is add %j, step), which is now accounted for when
identifying the trip count of the loop. This is also an acceptable use
of %j (provided the step is 1) so is ignored as long as the compare
that it's used in is also the condition of the inner branch.

Differential Revision: https://reviews.llvm.org/D105802
The file was modifiedllvm/lib/Transforms/Scalar/LoopFlatten.cpp
The file was modifiedllvm/test/Transforms/LoopFlatten/loop-flatten.ll
The file was modifiedllvm/test/Transforms/LoopFlatten/loop-flatten-negative.ll
Commit 057905011660200466fe1ab25cca76717e382d0b by llvm-dev
Fix MSVC signed/unsigned comparison warning. NFCI.
The file was modifiedllvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
Commit 7397dcb403c2214d76444b3f3b16bb4eeed42e58 by llvm-dev
[TTI] Add basic SK_InsertSubvector shuffle mask recognition

This patch adds an initial ShuffleVectorInst::isInsertSubvectorMask helper to recognize 2-op shuffles where the lowest elements of one of the sources are being inserted into the "in-place" other operand, this includes "concat_vectors" patterns as can be seen in the Arm shuffle cost changes. This also helped fix a x86 issue with irregular/length-changing SK_InsertSubvector costs - I'm hoping this will help with D107188

This doesn't currently attempt to work with 1-op shuffles that could either be a "widening" shuffle or a self-insertion.

The self-insertion case is tricky, but we currently always match this with the existing SK_PermuteSingleSrc logic.

The widening case will be addressed in a follow up patch that treats the cost as 0.

Masks with a high number of undef elts will still struggle to match optimal subvector widths - its currently bounded by minimum-width possible insertion, whilst some cases would benefit from wider (pow2?) subvectors.

Differential Revision: https://reviews.llvm.org/D107228
The file was modifiedllvm/lib/Target/X86/X86TargetTransformInfo.cpp
The file was modifiedllvm/lib/IR/Instructions.cpp
The file was modifiedllvm/include/llvm/IR/Instructions.h
The file was modifiedllvm/test/Analysis/CostModel/X86/shuffle-insert_subvector.ll
The file was modifiedllvm/include/llvm/Analysis/TargetTransformInfoImpl.h
The file was modifiedllvm/test/Analysis/CostModel/ARM/shuffle.ll
Commit 66b4aafa2ec73cc397d1844a4c782eabcfe9f2cf by fmayer
[hwasan] Detect use after scope within function.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D105201
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
The file was modifiedllvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
The file was addedllvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
The file was addedcompiler-rt/test/hwasan/TestCases/stack-uas.c
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-nobug.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
The file was modifiedcompiler-rt/test/hwasan/TestCases/use-after-scope.cpp
Commit 872a950033d3cacd8c489f8be68d7c25a11a8746 by llvm-dev
[CostModel] Treat 'widen subvector' patterns as zero cost

As discussed on D107228, widening a subvector by inserting the whole subvector into the bottom a larger undef vector should always be cheap enough that we can treat it as zero cost.

NOTE: If this proves to cause issues we have the option of introducing a "SK_WidenSubvector" shuffle kind enum that targets could override the zero cost, but that doesn't seem necessary atm.

Differential Revision: https://reviews.llvm.org/D107228
The file was modifiedllvm/test/Analysis/CostModel/AMDGPU/shufflevector.ll
The file was modifiedllvm/include/llvm/Analysis/TargetTransformInfoImpl.h
The file was modifiedllvm/test/Analysis/CostModel/X86/shuffle-insert_subvector.ll
Commit dc3fbe293f1a1c1068e2cd27151fb373798fdfb6 by petar.avramovic
GlobalISel: Fix infinite loop in legalization artifact combiner

ArtifactValueFinder keeps trying to combine g_unmerge_values in some cases.
Fix is to skip combine attempt for dead defs.

Differential Revision: https://reviews.llvm.org/D106879
The file was addedllvm/test/CodeGen/AMDGPU/GlobalISel/bug-legalization-artifact-combiner-dead-def.mir
The file was addedllvm/test/CodeGen/AMDGPU/GlobalISel/bug-legalization-artifact-combiner-dead-def.ll
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
Commit 675c9423736d4117e918f734c995dc3bb069c986 by carl.ritson
[AMDGPU] Disable NSA for BVH instructions when appropriate

Check maximum NSA size when selecting NSA or non-NSA BVH instructions.

Differential Revision: https://reviews.llvm.org/D103230
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.intersect_ray.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
Commit 46a861af3d1c77f28b414e6d96890fc2d0cf8538 by sjoerd.meijer
[CostModel][AArch64] Add some shuffle concat tests. NFC.

Test ported over from test/Analysis/CostModel/ARM/shuffle.ll.
The file was modifiedllvm/test/Analysis/CostModel/AArch64/shuffle-other.ll
Commit 9e3e97aa810acac7b8ecffa7d4a92f55966e5358 by dvyukov
tsan: refactor MetaMap::GetAndLock interface

Don't lock the sync object inside of MetaMap methods.
This has several advantages:
- the new interface does not confuse thread-safety analysis
   so we can remove a bunch of NO_THREAD_SAFETY_ANALYSIS attributes
- this allows use of scoped lock objects
- this allows more flexibility, e.g. locking some other mutex
   between searching and locking the sync object
Also prefix the methods with GetSync to be consistent with GetBlock method.
Also make interface wrappers inlinable, otherwise we either end up with
2 copies of the method, or with an additional call.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107256
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_sync.h
The file was modifiedcompiler-rt/lib/sanitizer_common/sanitizer_mutex.h
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_sync.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
The file was modifiedcompiler-rt/lib/tsan/tests/unit/tsan_sync_test.cpp
Commit 14c7507b9d5936074076eb19deecd163c1315f94 by dvyukov
tsan: add LIKELY/UNLIKELY to MetaMap::GetSync

MetaMap::GetSync shows up in profiles,
so add LIKELY/UNLIKELY annotations.

Depends on D107256.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107257
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_sync.cpp
Commit 7bd81fe1831e909e762e2f1f5caaba154989d4a1 by dvyukov
tsan: don't save creation stack for some sync objects

Currently we save the creation stack for sync objects always.
But it's not needed to some sync objects, most notably atomics.
We simply don't use atomic creation stack anywhere.
Allow callers to control saving of the creation stack
and don't save it for atomics.

Depends on D107257.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107258
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_sync.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_sync.h
The file was modifiedcompiler-rt/lib/tsan/tests/unit/tsan_sync_test.cpp
Commit 5c2b48fdb0a6f8dd7fb3fc24bdd3c028a2e3a51a by dvyukov
tsan: add new vector clock

Add new fixed-size vector clock for the new tsan runtime.
For now it's unused.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107167
The file was addedcompiler-rt/lib/tsan/rtl/tsan_vector_clock.h
The file was modifiedcompiler-rt/lib/tsan/tests/unit/CMakeLists.txt
The file was modifiedcompiler-rt/lib/tsan/CMakeLists.txt
The file was addedcompiler-rt/lib/tsan/rtl/tsan_vector_clock.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_defs.h
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_rtl.cpp
The file was addedcompiler-rt/lib/tsan/tests/unit/tsan_vector_clock_test.cpp