SuccessChanges

Summary

  1. [ADT][NFC] Add extra typedefs to `ArrayRef` and `MutableArrayRef` (details)
  2. [lldb] Add deref support to libc++ unique_ptr synthetic (details)
  3. [llvm][utils] Support dereferencing llvm::Optional lldb formatter (details)
  4. [llvm][utils] Rename lldb dict variables to internal_dict (details)
  5. [AMDGPU] Better codegen for i64 bitreverse (details)
  6. Fix assert to use getTypeStoreSize instead of getPrimitiveSizeInBits, (details)
  7. [llvm][utils] Fix innocuous off by one in lldb formatters (details)
  8. [X86][AVX] SimplifyDemandedBitsForTargetNode - add basic X86ISD::VBROADCAST handling. (details)
  9. [PDB] Fix unsigned integer overflow (details)
  10. [MLIR][linalg] Make integer matmul ops cast before multiplying (details)
  11. [AMDGPU] Add selection pattern for v_xnor_b32 (details)
  12. [NFC] MCRegister fixes in RegisterClassInfo, and const-ed APIs (details)
  13. [libc++] Allow running CI on macOS when Ninja isn't installed outside of Xcode (details)
  14. [NFC] Const-ed 2 APIs in VirtRegMap (details)
  15. [NFC][regalloc] const-ed APIs, using MCRegister instead of unsigned (details)
  16. [InstCombine][NFC]Add a test for logical reductions. (details)
  17. [libc++] Make the from-scratch config work on macOS out-of-the-box (details)
  18. Add a helper for matching simple recurrence cycles (details)
  19. Change some addUsedGlobal to addUsedOrCompilerUsedGlobal (details)
  20. [libcxx] cleans up __cpp_concepts mess (details)
  21. Use helper introduced in 8020be0b8 to simplify ValueTracking [NFC] (details)
  22. [clang-tidy] Remove some test c++ mode restrictions. (details)
  23. [SanitizerCoverage] Clarify llvm.used/llvm.compiler.used and partially fix unmatched metadata sections on Windows (details)
  24. [clang-tidy][NFC] Tweak some generation of diag messages (details)
  25. [dfsan] Propagate origins for callsites (details)
  26. [scudo][test] Disable -Wfree-nonheap-object (details)
Commit 9909237d992000d651b32212d15111453485a6b0 by vlad.vinogradov
[ADT][NFC] Add extra typedefs to `ArrayRef` and `MutableArrayRef`

* `value_type`
* `pointer`
* `const_pointer`
* `reference`
* `const_reference`
* `const_reverse_iterator`
* `size_type`
* `difference_type`

It makes `ArrayRef` and `MutableArrayRef` types fully compliant with STL Container concept.

Reviewed By: lattner, courbet

Differential Revision: https://reviews.llvm.org/D95611
The file was modifiedllvm/include/llvm/ADT/ArrayRef.h
Commit 3a677b29a3b3f6a2539843db4d56ba59689fc0a0 by davelee.com
[lldb] Add deref support to libc++ unique_ptr synthetic

Add frame variable dereference suppport to libc++ `std::unique_ptr`.

This change allows for commands like `v *thing_up` and `v thing_up->m_id`. These commands now work the same way they would with raw pointers, and as they would with expression. This is done by adding an unaccounted for child member named `$$dereference$$`.

Without this change, the command would have to be written as `v *thing_up.__value_` or v thing_up.__value_->m_id` which exposes internal structure and is more clumsy to type.

Additionally, the existing tests were updated. See also https://reviews.llvm.org/D97165 which added deref support for `std::shared_ptr`.

Differential Revision: https://reviews.llvm.org/D97524
The file was modifiedlldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
The file was modifiedlldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/main.cpp
The file was modifiedlldb/source/Plugins/Language/CPlusPlus/LibCxx.h
The file was modifiedlldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
Commit 408456f53eccd9b2280840aff8fa99f865024544 by davelee.com
[llvm][utils] Support dereferencing llvm::Optional lldb formatter

Add deref support to `llvm::Optional` in `lldbDataFormatters.py`.

This creates a synthetic provider that adds dereference support, but otherwise proxies all access to the underlying value.

With this change, an optional value can be displayed by running `v *someOptional`, and its contents can be accessed with the arrow `operator->`, for example `v someOpt->HasThing`. This matches expressions usable from expression evaluation.

See also D97165 and D97524.

Differential Revision: https://reviews.llvm.org/D97525
The file was modifiedllvm/utils/lldbDataFormatters.py
Commit 8d1b6afcea6c30db7728d966d9281ab373eaa9e1 by davelee.com
[llvm][utils] Rename lldb dict variables to internal_dict

Most lldb scripts use `internal_dict`. Also, `dict` is a builtin constructor,
it's good habit to avoid using it as a variable name.
The file was modifiedllvm/utils/lldbDataFormatters.py
Commit 3ad5216ed88e303cb5d37864bb83b0eec81144af by jay.foad
[AMDGPU] Better codegen for i64 bitreverse

Differential Revision: https://reviews.llvm.org/D97547
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-bitreverse.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-bitreverse.mir
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
The file was modifiedllvm/lib/Target/AMDGPU/SOPInstructions.td
The file was modifiedllvm/test/CodeGen/AMDGPU/bitreverse.ll
The file was modifiedllvm/lib/Target/AMDGPU/SIISelLowering.cpp
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.h
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-bitreverse.mir
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
Commit 740e69b6fdc2b1415065f3d20acc4d10a73edb00 by jyknight
Fix assert to use getTypeStoreSize instead of getPrimitiveSizeInBits,
per comment on D97223.
The file was modifiedllvm/lib/CodeGen/AtomicExpandPass.cpp
Commit a01a406bba8ac624a876f8d5720e1d4949a5b0fa by davelee.com
[llvm][utils] Fix innocuous off by one in lldb formatters

num_children is "last_index" + 1, thus
    num_children + 1 = "last_index" + 2

this worked anyway because the index of `$$dereference$$` would work as long as
it was past the last index.
The file was modifiedllvm/utils/lldbDataFormatters.py
Commit ed1f45bce9fb4688a4ab06862b25c6d55b5dc415 by llvm-dev
[X86][AVX] SimplifyDemandedBitsForTargetNode - add basic X86ISD::VBROADCAST handling.

Simplify through to the scalar/vector source operand.
The file was modifiedllvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit 301551ae8e8f54fd66867c9411fcc17b2f02be7d by thakis
[PDB] Fix unsigned integer overflow

When building with -fsanitize=unsigned-integer-overflow, this code
causes a diagnostic like:

    ../../llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp:159:15:
    runtime error: unsigned integer overflow:
    90 - 229 cannot be represented in type 'unsigned long'

unsigned integer overflow is well defined and it isn't an issue in
practice, but in obscure scenarios (S1.size() small, S2.size over 2GB
on 32-bit systems) it could even be a bug.

So use the usual idiom for implementing cmp functions instead of the
gernally considered buggy idiom :)
See e.g. https://www.gnu.org/software/libc/manual/html_node/Comparison-Functions.html
or https://stackoverflow.com/questions/10996418/efficient-integer-compare-function/10997428#10997428

Differential Revision: https://reviews.llvm.org/D97557
The file was modifiedllvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
Commit 21bb63893e8557df7a7ab690ad98cb5979099186 by gcmn
[MLIR][linalg] Make integer matmul ops cast before multiplying

Right now they multiply before casting which means they would frequently
overflow. There are various reasonable ways to do this, but until we
have robust op description infra, this is a simple and safe default. More
careful treatments are likely to be hardware specific, as well (e.g.
using an i8*i8->i16 mul instruction).

Reviewed By: nicolasvasilache, mravishankar

Differential Revision: https://reviews.llvm.org/D97505
The file was modifiedmlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOpsSpec.tc
The file was modifiedmlir/test/Dialect/Linalg/vectorization.mlir
Commit dc2259537a30127808efc4ee68ec5b0cae5c983a by jay.foad
[AMDGPU] Add selection pattern for v_xnor_b32

This allows GlobalISel to use this instruction where available. I assume
SelectionDAG always selects s_xnor_b32 so it isn't affected by this
change.

Differential Revision: https://reviews.llvm.org/D97560
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.td
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/xnor.ll
The file was modifiedllvm/lib/Target/AMDGPU/VOP2Instructions.td
Commit a00f7dc2d539bae2702e871e0767e4effb87ceb6 by mtrofin
[NFC] MCRegister fixes in RegisterClassInfo, and const-ed APIs
The file was modifiedllvm/include/llvm/CodeGen/RegisterClassInfo.h
Commit f8e810c359b51c911dfb3be1f8c48f28356c09ec by Louis Dionne
[libc++] Allow running CI on macOS when Ninja isn't installed outside of Xcode

Xcode does bundle Ninja, so we can use that Ninja if there's no system-wide
Ninja installed. This is useful on some CI bots we have that don't come
with Ninja pre-installed.
The file was modifiedlibcxx/utils/ci/run-buildbot
Commit a2bfc43ae10e9ed1252d96fd25add647c42b79f9 by mtrofin
[NFC] Const-ed 2 APIs in VirtRegMap
The file was modifiedllvm/lib/CodeGen/VirtRegMap.cpp
The file was modifiedllvm/include/llvm/CodeGen/VirtRegMap.h
Commit 3e992326a510035adcddd284399ba67db374131c by mtrofin
[NFC][regalloc] const-ed APIs, using MCRegister instead of unsigned
The file was modifiedllvm/lib/CodeGen/RegAllocGreedy.cpp
Commit 7820518d55f9c40cd55adbe7185743e1bd2c936d by a.bataev
[InstCombine][NFC]Add a test for logical reductions.
The file was addedllvm/test/Transforms/InstCombine/vector-logical-reductions.ll
Commit 27f9ed78506329cbf14b91eb545ca7419a983e00 by Louis Dionne
[libc++] Make the from-scratch config work on macOS out-of-the-box
The file was modifiedlibcxx/test/configs/libcxx-trunk-shared.cfg.in
The file was modifiedlibcxx/test/configs/libcxx-trunk-static.cfg.in
Commit 8020be0b8b57e0d29d93f0a4a5b2e9bbfd2242e7 by listmail
Add a helper for matching simple recurrence cycles

This helper came up in another review, and I've got about 4 different patches with copies of this copied into it.  Time to precommit the routine.  :)
The file was modifiedllvm/include/llvm/Analysis/ValueTracking.h
The file was modifiedllvm/lib/Analysis/ValueTracking.cpp
Commit 28cb620321f5461255423f84c85e6891b5174c13 by i
Change some addUsedGlobal to addUsedOrCompilerUsedGlobal

An global value in the `llvm.used` list does not have GC root semantics on ELF targets.
This will be changed in a subsequent backend patch.

Change some `llvm.used` in the ELF code path to use `llvm.compiler.used` to
prevent undesired GC root semantics.

Change one extern "C" alias (due to `__attribute__((used))` in extern "C") to use `llvm.compiler.used` on all targets.

GNU ld has a rule "`__start_/__stop_` references from a live input section retain the associated C identifier name sections",
which LLD may drop entirely (currently refined to exclude SHF_LINK_ORDER/SHF_GROUP) in a future release (the rule makes it clumsy to GC metadata sections; D96914 added a way to try the potential future behavior).
For `llvm.used` global values defined in a C identifier name section, keep using `llvm.used` so that
the future LLD change will not affect them.

rnk kindly categorized the changes:
```
ObjC/blocks: this wants GC root semantics, since ObjC mainly runs on Mac.
MS C++ ABI stuff: wants GC root semantics, no change
OpenMP: unsure, but GC root semantics probably don't hurt
CodeGenModule: affected in this patch to *not* use GC root semantics so that __attribute__((used)) behavior remains the same on ELF, plus two other minor use cases that don't want GC semantics
Coverage: Probably want GC root semantics
CGExpr.cpp: refers to LTO, wants GC root
CGDeclCXX.cpp: one is MS ABI specific, so yes GC root, one is some other C++ init functionality, which should form GC roots (C++ initializers can have side effects and must run)
CGDecl.cpp: Changed in this patch for __attribute__((used))
```

Differential Revision: https://reviews.llvm.org/D97446
The file was modifiedclang/lib/CodeGen/CodeGenModule.h
The file was modifiedclang/test/CodeGen/2005-12-04-AttributeUsed.c
The file was modifiedclang/test/CodeGen/attr-msp430.c
The file was modifiedclang/test/CodeGenCXX/attr-x86-interrupt.cpp
The file was modifiedclang/test/CodeGen/attr-used.c
The file was modifiedclang/test/CodeGenCXX/extern-c.cpp
The file was modifiedclang/test/CodeGen/attr-x86-interrupt.c
The file was modifiedclang/test/CodeGen/keep-static-consts.cpp
The file was modifiedclang/test/CodeGen/attr-target-mv.c
The file was modifiedclang/lib/CodeGen/CGDecl.cpp
The file was modifiedclang/test/CodeGenCUDA/llvm-used.cu
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
Commit e4dd614ae81194b0a50361a91f8bd4364916ef2e by cjdb
[libcxx] cleans up __cpp_concepts mess

libc++ was previously a bit confused by what the value of __cpp_concepts
should be. Also replaces `__floating_point` with `floating_point` now
that it exists.

Differential Revision: https://reviews.llvm.org/D97015
The file was modifiedlibcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
The file was modifiedlibcxx/include/version
The file was modifiedlibcxx/test/std/language.support/support.limits/support.limits.general/numbers.version.pass.cpp
The file was modifiedlibcxx/utils/generate_feature_test_macro_components.py
The file was modifiedlibcxx/include/random
The file was modifiedlibcxx/include/numbers
The file was modifiedlibcxx/utils/libcxx/test/features.py
The file was modifiedlibcxx/include/concepts
Commit ebd3aeba273736596163d498c38cc32e743bed31 by listmail
Use helper introduced in 8020be0b8 to simplify ValueTracking [NFC]

Direct rewrite of the code the helper was extracted from.
The file was modifiedllvm/include/llvm/Analysis/ValueTracking.h
The file was modifiedllvm/lib/Analysis/ValueTracking.cpp
Commit b18f14d6897b9e9f34ffd0d8ed46b8ac596fbf05 by n.james93
[clang-tidy] Remove some test c++ mode restrictions.

Some comments are redundant, others just simple fixes.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D97544
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/google-readability-casting.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/portability-simd-intrinsics-ppc.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/abseil-upgrade-duration-conversions.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/abseil-time-subtraction.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/abseil-faster-strsplit-delimiter.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/portability-simd-intrinsics-x86.cpp
Commit b55f29c194d31cb51096d80b5e2710fc3385a7ef by i
[SanitizerCoverage] Clarify llvm.used/llvm.compiler.used and partially fix unmatched metadata sections on Windows

`__sancov_pcs` parallels the other metadata section(s). While some optimizers
(e.g. GlobalDCE) respect linker semantics for comdat and retain or discard the
sections as a unit, some (e.g.  GlobalOpt/ConstantMerge) do not. So we have to
conservatively retain all unconditionally in the compiler.

When a comdat is used, the COFF/ELF linkers' GC semantics ensure the
associated parallel array elements are retained or discarded together,
so `llvm.compiler.used` is sufficient.

Otherwise (MachO (see rL311955/rL311959), COFF special case where comdat is not
used), we have to use `llvm.used` to conservatively make all sections retain by
the linker. This will fix the Windows problem once internal linkage
GlobalObject's in `llvm.used` are retained via `/INCLUDE:`.

Reviewed By: morehouse, vitalybuka

Differential Revision: https://reviews.llvm.org/D97432
The file was modifiedllvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
The file was modifiedllvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard.ll
Commit 1a721b6a2634d9740b389a7604275b426c22600a by n.james93
[clang-tidy][NFC] Tweak some generation of diag messages

Fix up cases where diag is called by piecing together a string in favour of placeholders.
Fix up cases where select could be used instead of duplicating the message for sake of 1 word difference.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D97488
The file was modifiedclang-tools-extra/clang-tidy/modernize/UseNodiscardCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/abseil/DurationFactoryFloatCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/misc-uniqueptr-reset-release.cpp
The file was modifiedclang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
The file was modifiedclang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp
The file was modifiedclang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp
Commit a47d435bc4307ca71612dd03f09f12f7ff6b461f by jianzhouzh
[dfsan] Propagate origins for callsites

This is a part of https://reviews.llvm.org/D95835.

Each customized function has two wrappers. The
first one dfsw is for the normal shadow propagation. The second one dfso is used
when origin tracking is on. It calls the first one, and does additional
origin propagation. Which one to use can be decided at instrumentation
time. This is to ensure minimal additional overhead when origin tracking
is off.

Reviewed-by: morehouse

Differential Revision: https://reviews.llvm.org/D97483
The file was modifiedllvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
The file was addedllvm/test/Instrumentation/DataFlowSanitizer/origin_call.ll
The file was modifiedcompiler-rt/lib/dfsan/dfsan.syms.extra
The file was addedllvm/test/Instrumentation/DataFlowSanitizer/origin_abilist.ll
Commit bed888242662c2327b32b91a03635e079ad5667e by leonardchan
[scudo][test] Disable -Wfree-nonheap-object

As of 4f395db86b5cc11bb56853323d3cb1d4b6db5a0b which contains updates to
-Wfree-nonheap-object, a line in this test will trigger the warning. This
particular line is ok though since it's meant to test a free on a bad pointer.

Differential Revision: https://reviews.llvm.org/D97516
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp