UnstableChanges

Summary

  1. [GlobalISel][TableGen] Fix ConstrainOperandRC bug (details)
  2. [VE] Support llvm.eh.sjlj.lsda (details)
  3. [RISCV] Add vector integer min/max ISel patterns (details)
  4. Sema::BuildCallExpr - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI. (details)
  5. SystemZTargetLowering::lowerDYNAMIC_STACKALLOC - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI. (details)
  6. MemProfiler::insertDynamicShadowAtFunctionEntry - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI. (details)
  7. Inform the consumer on invalid template instantiations. (details)
  8. [VE][NFC] Fix typo in comments (details)
  9. [WebAssembly] call_indirect causes indirect function table import (details)
  10. [DebugInfo] Avoid LSR crash on large integer inputs (details)
  11. [Coroutines] checkAsyncFuncPointer - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI. (details)
  12. [SimplifyIndVar] createWideIV - make WideIVInfo arg a const ref. NFCI. (details)
  13. [LV] Simplify lambda in all_of to directly return hasVF() result. (NFC) (details)
  14. [SVE] Lower vector CTLZ, CTPOP and CTTZ operations. (details)
  15. [IR] Add ConstantInt::getBool helpers to wrap getTrue/getFalse. (details)
  16. [VE] Support SJLJ exception related instructions (details)
  17. [OpenCL] Warn about side effects for unevaluated vec_step arg (details)
  18. [clangd] When querying drivers by binary, look in PATH too (details)
  19. [AMDGPU] Split out new helper function macToMad in SIFoldOperands. NFC. (details)
  20. [AMDGPU] Precommit test case for D94010 (details)
  21. [AMDGPU] Handle v_fmac_legacy_f32 in SIFoldOperands (details)
  22. [CodeGen] Format SelectionDAG::getConstant methods (NFC) (details)
  23. [VE] Change clang to support SjLj Lowering (details)
  24. [X86] getMemoryOpCost - use dyn_cast_or_null<StoreInst>. NFCI. (details)
  25. [OpenCL] Restrict pointer to member functions. (details)
  26. [mlir] Add canonicalization pattern out_tensor->linalg->dim to out_tensor->dim. (details)
  27. [ASTMatchers] Ensure that we can match inside lambdas (details)
  28. [ASTMatchers] Fix build when no targets are enabled (details)
  29. [X86][AVX] combineVectorSignBitsTruncation - use PACKSS/PACKUS in more AVX cases (details)
  30. [VPlan] Re-add interleave group members to plan. (details)
  31. [LoopNest] Allow empty basic blocks without loops (details)
  32. [clang][AArch64][SVE] Avoid going through memory for coerced VLST arguments (details)
  33. [ASTMatchers] Fix traversal matchers with explicit and defaulted methods (details)
  34. [-Wcalled-once-parameter] Introduce 'called_once' attribute (details)
  35. [AArch64][SVE] Add optimization to remove redundant ptest instructions (details)
  36. [gn build] Port fec1a442e3b (details)
  37. [clang-tidy] Add extra tests (details)
  38. [Coverage] Add support for Branch Coverage in LLVM Source-Based Code Coverage (details)
  39. [Clang] Add AArch64 VCMLA LANE variants. (details)
  40. [RegisterClassInfo] Return non-zero for RC without allocatable reg (details)
  41. [mlir] Remove LLVMType, LLVM dialect types now derive Type directly (details)
  42. [clang-tidy] Update uses of deprecated Transformer APIs in StringFindStrContainsCheck. (details)
  43. [AMDGPU] Remove deprecated V_MUL_LO_I32 from GFX10 (details)
  44. CGExpr - EmitMatrixSubscriptExpr - fix getAs<> null-dereference static analyzer warning. NFCI. (details)
  45. [ARM][AArch64] Some extra test to show anyextend lowering. NFC (details)
  46. [ASTMatchers] Omit methods from explicit template instantations (details)
  47. [mlir][Linalg] Add a test case that consumer has "reduction" loops. (details)
  48. [lldb] Add timers to Reproducer::Keep and Reproducer::Discard (details)
  49. [libTooling] Add support for smart pointers to relevant Transformer `Stencil`s. (details)
  50. GlobalISel: Add isKnownToBeAPowerOfTwo helper function (details)
  51. [llvm-link] fix linker behavior when linking archives with --only-needed option (details)
Commit 3c1d015edc755e8f3fa9c2a92d0b9bc81ba4d5fd by mikael.holmen
[GlobalISel][TableGen] Fix ConstrainOperandRC bug

TableGen would pick the largest RC for constraining the operands, which
could potentially be an unallocatable RC. This patch removes selection
of unallocatable RCs.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D93945
The file was modifiedllvm/utils/TableGen/GlobalISelEmitter.cpp
The file was modifiedllvm/utils/TableGen/CodeGenTarget.h
The file was modifiedllvm/test/TableGen/GlobalISelEmitterSubreg.td
The file was modifiedllvm/utils/TableGen/CodeGenTarget.cpp
Commit 2654f33c47f44b05351422e61c94afa5a6d6afe5 by marukawa
[VE] Support llvm.eh.sjlj.lsda

In order to support SJLJ exception, implement llvm.eh.sjlj.lsda first.
Add regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93811
The file was modifiedllvm/lib/Target/VE/VEISelLowering.cpp
The file was modifiedllvm/lib/Target/VE/VEISelLowering.h
The file was addedllvm/test/CodeGen/VE/Scalar/builtin_sjlj_lsda.ll
Commit 1d4411e9ea0ea7b8460e40d2d596cafafc84be33 by fraser
[RISCV] Add vector integer min/max ISel patterns

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D94012
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
The file was addedllvm/test/CodeGen/RISCV/rvv/vmax-sdnode-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vmin-sdnode-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vmax-sdnode-rv64.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode-rv64.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vmin-sdnode-rv64.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
The file was addedllvm/test/CodeGen/RISCV/rvv/vminu-sdnode-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vminu-sdnode-rv64.ll
Commit 6725860d21a03741d6c3331ab0560416bb19e068 by llvm-dev
Sema::BuildCallExpr - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

We're immediately dereferencing the casted pointer, so use cast<> which will assert instead of dyn_cast<> which can return null.

Fixes static analyzer warning.
The file was modifiedclang/lib/Sema/SemaExpr.cpp
Commit 52e448974b2ec826c8af429c370c4d6e79ce5747 by llvm-dev
SystemZTargetLowering::lowerDYNAMIC_STACKALLOC - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

We're immediately dereferencing the casted pointer, so use cast<> which will assert instead of dyn_cast<> which can return null.

Fixes static analyzer warning.
The file was modifiedllvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Commit 84d5768d97635602225f5056da96b058e588b2f5 by llvm-dev
MemProfiler::insertDynamicShadowAtFunctionEntry - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

We're immediately dereferencing the casted pointer, so use cast<> which will assert instead of dyn_cast<> which can return null.

Fixes static analyzer warning.
The file was modifiedllvm/lib/Transforms/Instrumentation/MemProfiler.cpp
Commit 02eb8e20b51b3ea263bbfe696241b8541c72ee7a by v.g.vassilev
Inform the consumer on invalid template instantiations.

Some clients which want to track state need the information whether a template
was instantiated and made invalid.

Differential revision: https://reviews.llvm.org/D92248
The file was modifiedclang/lib/Sema/SemaTemplateInstantiate.cpp
Commit 53a341a61d1fc2d0c455738a6a4d5f5d54a4e1d3 by marukawa
[VE][NFC] Fix typo in comments
The file was modifiedllvm/lib/Target/VE/VEISelLowering.cpp
Commit 9ad83fd6dc46330dcdea8af36c435061a31ac0c5 by wingo
[WebAssembly] call_indirect causes indirect function table import

For wasm-ld table linking work to proceed, object files should indicate
if they use an indirect function table.  In the future this will be done
by the usual symbols and relocations mechanism, but until that support
lands in the linker, the presence of an `__indirect_function_table` in
the object file's import section shows that the object file needs an
indirect function table.

Prior to https://reviews.llvm.org/D91637, this condition was met by all
object files residualizing an `__indirect_function_table` import.

Since https://reviews.llvm.org/D91637, the intention has been that only
those object files needing an indirect function table would have the
`__indirect_function_table` import.  However, we missed the case of
object files which use the table via `call_indirect` but which
themselves do not declare any indirect functions.

This changeset makes it so that when we lower a call to `call_indirect`,
that we ensure that a `__indirect_function_table` symbol is present and
that it will be propagated to the linker.

A followup patch will revise this mechanism to make an explicit link
between `call_indirect` and its associated indirect function table; see
https://reviews.llvm.org/D90948.

Differential Revision: https://reviews.llvm.org/D92840
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyUtilities.h
The file was modifiedllvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
The file was addedllvm/test/CodeGen/WebAssembly/call-indirect.ll
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp
The file was modifiedllvm/test/MC/WebAssembly/type-index.s
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
The file was modifiedllvm/lib/MC/WasmObjectWriter.cpp
Commit 914066fe38a93c004b742a696ec337701eb738ec by jeremy.morse
[DebugInfo] Avoid LSR crash on large integer inputs

Loop strength reduction tries to recover debug variable values by looking
for simple offsets from PHI values. In really extreme conditions there may
be an offset used that won't fit in an int64_t, hitting an APInt assertion.

This patch adds a regression test and adjusts the equivalent value
collecting code to filter out any values where the offset can't be
represented by an int64_t. This means that for very large integers with
very large offsets, the variable location will become undef, which is the
same behaviour as before 2a6782bb9f1 / D87494.

Differential Revision: https://reviews.llvm.org/D94016
The file was modifiedllvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
The file was addedllvm/test/Transforms/LoopStrengthReduce/dbg-preserve-1.ll
Commit 7a97eeb197a8023acbb800d40b3bb852fc2f5d60 by llvm-dev
[Coroutines] checkAsyncFuncPointer - use cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

We're immediately dereferencing the casted pointer, so use cast<> which will assert instead of dyn_cast<> which can return null.

Fixes static analyzer warning.
The file was modifiedllvm/lib/Transforms/Coroutines/Coroutines.cpp
Commit a000366d0502b35fc0d3b113ace7f0e3bbdc08cd by llvm-dev
[SimplifyIndVar] createWideIV - make WideIVInfo arg a const ref. NFCI.

The WideIVInfo arg is only ever used as a const.

Fixes cppcheck warning.
The file was modifiedllvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
The file was modifiedllvm/lib/Transforms/Utils/SimplifyIndVar.cpp
Commit 38c6933dcc9660b0c00f00ae62345339010dc764 by flo
[LV] Simplify lambda in all_of to directly return hasVF() result. (NFC)

The if in the lambda is not necessary. We can directly return the result
of hasVF.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
Commit eba6deab22b576004a209b3f42ccc5e58f7603bf by paul.walker
[SVE] Lower vector CTLZ, CTPOP and CTTZ operations.

CTLZ and CTPOP are lowered to CLZ and CNT instructions respectively.

CTTZ is not a native SVE operation but is instead lowered to:
  CTTZ(V) => CTLZ(BITREVERSE(V))

In the case of fixed-length support using SVE we also lower CTTZ
operating on NEON sized vectors because of its reliance on
BITREVERSE which is also lowered to SVE intructions at these lengths.

Differential Revision: https://reviews.llvm.org/D93607
The file was modifiedllvm/lib/Target/AArch64/SVEInstrFormats.td
The file was addedllvm/test/CodeGen/AArch64/sve-fixed-length-bit-counting.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.h
The file was modifiedllvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
The file was addedllvm/test/CodeGen/AArch64/sve-bit-counting.ll
Commit 313d982df65a7a8f1da2da5f0e03e6b6e301ce3c by llvm-dev
[IR] Add ConstantInt::getBool helpers to wrap getTrue/getFalse.
The file was modifiedllvm/lib/IR/Constants.cpp
The file was modifiedllvm/include/llvm/IR/Constants.h
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Commit f784be0777f34a5b3bc3da6892ca242de7840fce by marukawa
[VE] Support SJLJ exception related instructions

Support EH_SJLJ_LONGJMP, EH_SJLJ_SETJMP, and EH_SJLJ_SETUP_DISPATCH
for SjLj exception handling.  NC++ uses SjLj exception handling, so
implement it first.  Add regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94071
The file was addedllvm/test/CodeGen/VE/Scalar/builtin_sjlj.ll
The file was addedllvm/lib/Target/VE/VEInstrBuilder.h
The file was addedllvm/test/CodeGen/VE/Scalar/builtin_sjlj_landingpad.ll
The file was modifiedllvm/lib/Target/VE/VEInstrInfo.td
The file was removedllvm/test/CodeGen/VE/Scalar/sjlj_except.ll
The file was addedllvm/test/CodeGen/VE/Scalar/builtin_sjlj_bp.ll
The file was modifiedllvm/lib/Target/VE/VEISelLowering.h
The file was addedllvm/test/CodeGen/VE/Scalar/builtin_sjlj_callsite.ll
The file was modifiedllvm/lib/Target/VE/VEISelLowering.cpp
Commit 0e4d2361b817bd16f97cd45d5792017edc3891ee by sven.vanhaastregt
[OpenCL] Warn about side effects for unevaluated vec_step arg

The argument to the `vec_step` builtin is not evaluated.  Hoist the
diagnostic for this in `Sema::CheckUnaryExprOrTypeTraitOperand` such
that it comes before `Sema::CheckVecStepTraitOperandType`.

A minor side-effect of this change is that it also produces the
warning for `co_await` and `co_yield` as `sizeof` arguments now, which
seems to be reasonable given that the warning is emitted for `typeid`
already.

Differential Revision: https://reviews.llvm.org/D91348
The file was modifiedclang/test/SemaCXX/coroutines.cpp
The file was modifiedclang/test/SemaOpenCL/vec_step.cl
The file was modifiedclang/lib/Sema/SemaExpr.cpp
Commit 2f8d1e9eb27e111eb6dfd242d88dd7c98005fb5c by sam.mccall
[clangd] When querying drivers by binary, look in PATH too

Sometimes compile_commands.json databases are created without an
absolute path for the driver in the command field. By default the driver
name is appended to the current directory, however if no driver is found
in that location assume it was in the default PATH and try finding it
there

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D93600
The file was modifiedclang-tools-extra/clangd/QueryDriverDatabase.cpp
The file was modifiedclang-tools-extra/clangd/test/system-include-extractor.test
Commit 4e6054a86c0cb0697913007c99b59f3f65c9d04b by jay.foad
[AMDGPU] Split out new helper function macToMad in SIFoldOperands. NFC.

Differential Revision: https://reviews.llvm.org/D94009
The file was modifiedllvm/lib/Target/AMDGPU/SIFoldOperands.cpp
Commit 639a50e2f138ed3e647b00809a2871a1b9ae9012 by jay.foad
[AMDGPU] Precommit test case for D94010
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll
Commit 3914bebe91f6b557e61d6d74117762f9043593e0 by jay.foad
[AMDGPU] Handle v_fmac_legacy_f32 in SIFoldOperands

Convert it to v_fma_legacy_f32 if it is profitable to do so, just like
other mac instructions that are converted to their mad equivalents.

Differential Revision: https://reviews.llvm.org/D94010
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.fma.legacy.ll
The file was modifiedllvm/lib/Target/AMDGPU/SIFoldOperands.cpp
Commit 9a1ac97d3af5efb8ddc8ae390dfeb3c7d2b9a8c5 by fraser
[CodeGen] Format SelectionDAG::getConstant methods (NFC)
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Commit 489000d8516da7eaf6aabaad11cce0ed7e67c61f by marukawa
[VE] Change clang to support SjLj Lowering

We supports SjLj exception handling in the backend, so changing
clang to allow lowering using SjLj exceptions.  Update a regression
test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94076
The file was modifiedclang/test/Sema/builtin-longjmp.c
The file was modifiedclang/lib/Basic/Targets/VE.h
Commit dc74d7ed1f651aa61d15b4eaaa32200df1f38d37 by llvm-dev
[X86] getMemoryOpCost - use dyn_cast_or_null<StoreInst>. NFCI.

Use instead of the isa_and_nonnull<StoreInst> and use the StoreInst::getPointerOperand wrapper instead of a hardcoded Instruction::getOperand.

Looks cleaner and avoids a spurious clang static analyzer null dereference warning.
The file was modifiedllvm/lib/Target/X86/X86TargetTransformInfo.cpp
Commit 6f770292a000039f265c985623b1550aa50566b0 by anastasia.stulova
[OpenCL] Restrict pointer to member functions.

Pointers to member functions are a special case
of function pointers and therefore have to be
disallowed.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D93958
The file was addedclang/test/SemaOpenCLCXX/members.cl
The file was modifiedclang/lib/Sema/SemaDecl.cpp
Commit 89ae5b5b6a475addb7248ca7a948a944a15f0275 by pifon
[mlir] Add canonicalization pattern out_tensor->linalg->dim to out_tensor->dim.

Differential Revision: https://reviews.llvm.org/D94079
The file was modifiedmlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
The file was modifiedmlir/test/Dialect/Linalg/canonicalize.mlir
Commit c3a21e5de3dc3f55e4d219afd55dec518159d356 by steveire
[ASTMatchers] Ensure that we can match inside lambdas

Because we don't know in ASTMatchFinder whether we're matching in AsIs
or IgnoreUnlessSpelledInSource mode, we need to traverse the lambda
twice, but store whether we're matching in nodes spelled in source or
not.

Differential Revision: https://reviews.llvm.org/D93688
The file was modifiedclang/lib/ASTMatchers/ASTMatchersInternal.cpp
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchersInternal.h
The file was modifiedclang/lib/ASTMatchers/ASTMatchFinder.cpp
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
Commit c3403dc63d73710d14844e8a8cfad7a0f52d4a54 by steveire
[ASTMatchers] Fix build when no targets are enabled

This makes sense to do when building only tools like clang-tidy for
example.

Differential Revision: https://reviews.llvm.org/D93987
The file was modifiedllvm/cmake/modules/LLVM-Config.cmake
Commit 73a44f437bf19ecf2c865e6c8b9b8a2e4a811960 by llvm-dev
[X86][AVX] combineVectorSignBitsTruncation - use PACKSS/PACKUS in more AVX cases

AVX512 has fast truncation ops, but if the truncation source is a concatenation of subvectors then its likely that we can use PACK more efficiently.

This is only guaranteed to work for truncations to 128/256-bit vectors as the PACK works across 128-bit sub-lanes, for now I've just disabled 512-bit truncation cases but we need to get them working eventually for D61129.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was modifiedllvm/test/CodeGen/X86/vector-pack-128.ll
The file was modifiedllvm/test/CodeGen/X86/vector-pack-256.ll
Commit 8a47e6252ad43a2eb3238f9b36394571ba13f4a9 by flo
[VPlan] Re-add interleave group members to plan.

Creating in-loop reductions relies on IR references to map
IR values to VPValues after interleave group creation.

Make sure we re-add the updated member to the plan, so the look-ups
still work as expected

This fixes a crash reported after D90562.
The file was modifiedllvm/test/Transforms/LoopVectorize/ARM/mve-reductions.ll
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit c00551893674d6d61e9e5d68412e2b8621f617b8 by whitneyt
[LoopNest] Allow empty basic blocks without loops

Allow loop nests with empty basic blocks without loops in different
levels as perfect.

Reviewers: Meinersbur

Differential Revision: https://reviews.llvm.org/D93665
The file was modifiedllvm/include/llvm/Analysis/LoopNestAnalysis.h
The file was modifiedllvm/test/Analysis/LoopNestAnalysis/perfectnest.ll
The file was modifiedllvm/lib/Analysis/LoopNestAnalysis.cpp
Commit 3d5b18a3fdf47ae2286642131e4a92968dd01c2a by joe.ellis
[clang][AArch64][SVE] Avoid going through memory for coerced VLST arguments

VLST arguments are coerced to VLATs at the function boundary for
consistency with the VLAT ABI. They are then bitcast back to VLSTs in
the function prolog. Previously, this conversion is done through memory.
With the introduction of the llvm.vector.{insert,extract} intrinsic, we
can avoid going through memory here.

Depends on D92761

Differential Revision: https://reviews.llvm.org/D92762
The file was modifiedclang/lib/CodeGen/CGCall.cpp
The file was modifiedclang/test/CodeGen/aarch64-sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.cpp
The file was modifiedclang/test/CodeGen/aarch64-sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c
The file was modifiedclang/test/CodeGen/attr-arm-sve-vector-bits-call.c
The file was modifiedclang/test/CodeGen/attr-arm-sve-vector-bits-cast.c
Commit 7e4f53f748d3c97f0b9b852bfbcab0740aba521b by steveire
[ASTMatchers] Fix traversal matchers with explicit and defaulted methods

Differential Revision: https://reviews.llvm.org/D94030
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchers.h
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
The file was modifiedclang/lib/ASTMatchers/ASTMatchFinder.cpp
The file was modifiedclang/include/clang/ASTMatchers/ASTMatchersInternal.h
Commit fec1a442e3b12fc01929b2b405d1abf7df9ab68e by vsavchenko
[-Wcalled-once-parameter] Introduce 'called_once' attribute

This commit introduces a new attribute `called_once`.
It can be applied to function-like parameters to signify that
this parameter should be called exactly once.  This concept
is particularly widespread in asynchronous programs.

Additionally, this commit introduce a new group of dataflow
analysis-based warnings to check this property.  It identifies
and reports the following situations:
  * parameter is called twice
  * parameter is never called
  * parameter is not called on one of the paths

Current implementation can also automatically infer `called_once`
attribute for completion handler paramaters that should follow the
same principle by convention.  This behavior is OFF by default and
can be turned on by using `-Wcompletion-handler`.

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

rdar://72812043
The file was modifiedclang/lib/Sema/AnalysisBasedWarnings.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/test/Misc/pragma-attribute-supported-attributes-list.test
The file was addedclang/test/SemaObjC/warn-called-once.m
The file was addedclang/lib/Analysis/CalledOnceCheck.cpp
The file was addedclang/include/clang/Analysis/Analyses/CalledOnceCheck.h
The file was modifiedclang/include/clang/Basic/AttrDocs.td
The file was modifiedclang/lib/Sema/SemaExpr.cpp
The file was modifiedclang/include/clang/Basic/Attr.td
The file was modifiedclang/lib/Analysis/CMakeLists.txt
The file was modifiedclang/include/clang/AST/ParentMap.h
The file was modifiedclang/include/clang/Basic/DiagnosticGroups.td
The file was addedclang/test/SemaObjC/attr-called-once.m
The file was modifiedclang/lib/Sema/SemaDeclAttr.cpp
Commit c73ae747cb0c5546ac4a91a9609d5407e5b03897 by bradley.smith
[AArch64][SVE] Add optimization to remove redundant ptest instructions

Co-Authored-by: Graham Hunter <graham.hunter@arm.com>
Co-Authored-by: Paul Walker <paul.walker@arm.com>

Differential Revision: https://reviews.llvm.org/D93292
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilels.mir
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrFormats.td
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmpne.ll
The file was modifiedllvm/test/CodeGen/AArch64/sve-setcc.ll
The file was modifiedllvm/lib/Target/AArch64/SVEInstrFormats.td
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrInfo.h
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmplo.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmpeq.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilehi.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-brk.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmpeq.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmpgt.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilewr.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilegt.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmpge.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmphs.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmpls.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilerw.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilehs.mir
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrInfo.cpp
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmphi.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilege.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilele.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilelo.mir
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmplt.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-cmple.ll
The file was addedllvm/test/CodeGen/AArch64/sve-ptest-removal-whilelt.mir
Commit bf09e25e1e9fb27db21fdb7ed54a72504137430a by llvmgnsyncbot
[gn build] Port fec1a442e3b
The file was modifiedllvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
Commit 53c3acb89fcc25ba7ef1f1d76a79c241eeacb7f0 by steveire
[clang-tidy] Add extra tests

By default, check_clang_tidy runs tests in c++11-or-later mode.

Differential Revision: https://reviews.llvm.org/D94029
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/bugprone-use-after-move.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/readability-delete-null-pointer.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/modernize-raw-string-literal.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/bugprone-unused-raii.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-value-param-header.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/readability-avoid-const-params-in-decls.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-semicolon-constexpr.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/modernize-use-nodiscard.cpp
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp
Commit 9f2967bcfe2f7d1fc02281f0098306c90c2c10a5 by a-phipps
[Coverage] Add support for Branch Coverage in LLVM Source-Based Code Coverage

This is an enhancement to LLVM Source-Based Code Coverage in clang to track how
many times individual branch-generating conditions are taken (evaluate to TRUE)
and not taken (evaluate to FALSE).  Individual conditions may comprise larger
boolean expressions using boolean logical operators.  This functionality is
very similar to what is supported by GCOV except that it is very closely
anchored to the ASTs.

Differential Revision: https://reviews.llvm.org/D84467
The file was modifiedclang/lib/CodeGen/CGExprScalar.cpp
The file was modifiedllvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
The file was modifiedllvm/tools/llvm-cov/CoverageSummaryInfo.cpp
The file was addedclang/test/CoverageMapping/branch-macros.cpp
The file was modifiedclang/test/CoverageMapping/continue.c
The file was modifiedllvm/tools/llvm-cov/SourceCoverageView.cpp
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-templates.o32l
The file was modifiedllvm/include/llvm/ProfileData/InstrProf.h
The file was modifiedllvm/test/tools/llvm-cov/Inputs/showExpansions.json
The file was modifiedclang/docs/SourceBasedCodeCoverage.rst
The file was modifiedllvm/tools/llvm-cov/SourceCoverageViewText.cpp
The file was modifiedclang/test/Profile/cxx-lambda.cpp
The file was modifiedllvm/tools/llvm-cov/SourceCoverageViewText.h
The file was modifiedclang/test/CoverageMapping/loops.cpp
The file was modifiedclang/lib/CodeGen/CodeGenFunction.cpp
The file was modifiedclang/test/CoverageMapping/macro-expressions.cpp
The file was modifiedclang/test/CoverageMapping/return.c
The file was modifiedclang/test/CoverageMapping/if.cpp
The file was modifiedclang/test/Profile/c-general.c
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-macros.o32l
The file was modifiedllvm/tools/llvm-cov/CoverageViewOptions.h
The file was modifiedclang/lib/CodeGen/CodeGenFunction.h
The file was addedclang/test/CoverageMapping/branch-mincounters.cpp
The file was modifiedclang/test/CoverageMapping/logical.cpp
The file was addedclang/test/CoverageMapping/branch-constfolded.cpp
The file was addedclang/test/Profile/branch-logical-mixed.cpp
The file was modifiedllvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
The file was modifiedclang/lib/CodeGen/CGStmt.cpp
The file was modifiedclang/lib/CodeGen/CoverageMappingGen.cpp
The file was addedllvm/test/tools/llvm-cov/branch-macros.cpp
The file was modifiedllvm/tools/llvm-cov/SourceCoverageViewHTML.h
The file was modifiedclang/test/CoverageMapping/loopmacro.c
The file was addedllvm/test/tools/llvm-cov/branch-export-json.test
The file was modifiedclang/test/CoverageMapping/moremacros.c
The file was modifiedllvm/docs/CommandGuide/llvm-cov.rst
The file was addedllvm/test/tools/llvm-cov/branch-templates.cpp
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-showBranchPercentage.o32l
The file was modifiedclang/test/CoverageMapping/label.cpp
The file was addedllvm/test/tools/llvm-cov/branch-export-lcov.test
The file was addedclang/test/CoverageMapping/branch-templates.cpp
The file was modifiedclang/test/Profile/Inputs/c-general.proftext
The file was modifiedllvm/docs/CoverageMappingFormat.rst
The file was modifiedcompiler-rt/include/profile/InstrProfData.inc
The file was modifiedclang/lib/CodeGen/CodeGenPGO.cpp
The file was modifiedclang/test/CoverageMapping/macros.c
The file was modifiedclang/lib/CodeGen/CoverageMappingGen.h
The file was modifiedclang/test/CoverageMapping/while.c
The file was modifiedllvm/test/tools/llvm-cov/ignore-filename-regex.test
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-templates.proftext
The file was modifiedllvm/tools/llvm-cov/SourceCoverageView.h
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.proftext
The file was modifiedllvm/test/tools/llvm-cov/Inputs/binary-formats.canonical.json
The file was modifiedllvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
The file was addedllvm/test/tools/llvm-cov/branch-logical-mixed.cpp
The file was modifiedclang/test/CoverageMapping/switchmacro.c
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.o32l
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-c-general.proftext
The file was modifiedllvm/tools/llvm-cov/CoverageExporterJson.cpp
The file was modifiedclang/test/CoverageMapping/coroutine.cpp
The file was modifiedclang/test/CoverageMapping/macroscopes.cpp
The file was modifiedllvm/include/llvm/ProfileData/InstrProfData.inc
The file was modifiedllvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
The file was addedllvm/test/tools/llvm-cov/branch-c-general.c
The file was modifiedclang/test/CoverageMapping/unreachable-macro.c
The file was modifiedllvm/tools/llvm-cov/CodeCoverage.cpp
The file was modifiedllvm/tools/llvm-cov/CoverageSummaryInfo.h
The file was modifiedllvm/tools/llvm-cov/CoverageReport.cpp
The file was modifiedclang/test/CoverageMapping/macro-expansion.c
The file was addedclang/test/Profile/branch-profdup.cpp
The file was modifiedllvm/tools/llvm-cov/CoverageExporterLcov.cpp
The file was modifiedclang/test/CoverageMapping/test.c
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-c-general.o32l
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-macros.proftext
The file was addedllvm/test/tools/llvm-cov/Inputs/branch-showBranchPercentage.proftext
The file was addedllvm/test/tools/llvm-cov/branch-noShowBranch.test
The file was addedllvm/test/tools/llvm-cov/branch-showBranchPercentage.c
The file was addedclang/test/CoverageMapping/branch-logical-mixed.cpp
The file was modifiedclang/test/CoverageMapping/switch.cpp
The file was modifiedllvm/lib/ProfileData/Coverage/CoverageMapping.cpp
Commit 51d5991f04dda76c2f07123569b5c31ed3dfcfe8 by flo
[Clang] Add AArch64 VCMLA LANE variants.

This patch adds the LANE variants for VCMLA on AArch64 as defined in
"Arm Neon Intrinsics Reference for ACLE Q3 2020" [1]

This patch also updates `dup_typed` to accept constant type strings directly.

Based on a patch by Tim Northover.

[1] https://developer.arm.com/documentation/ihi0073/latest

Reviewed By: SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D93014
The file was modifiedclang/test/CodeGen/aarch64-neon-vcmla.c
The file was modifiedclang/utils/TableGen/NeonEmitter.cpp
The file was modifiedclang/include/clang/Basic/arm_neon.td
Commit f26bc0ddd508edad7e3838850dfcb6b960d6e681 by Jinsong Ji
[RegisterClassInfo] Return non-zero for RC without allocatable reg

In some case, the RC may have 0 allocatable reg.
eg: VRSAVERC in PowerPC, which has only 1 reg, but it is also reserved.

The curreent implementation will keep calling the computePSetLimit because
getRegPressureSetLimit assume computePSetLimit will return a non-zero value.

The fix simply early return the value from TableGen for such special case.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D92907
The file was modifiedllvm/test/CodeGen/PowerPC/compute-regpressure.ll
The file was modifiedllvm/lib/CodeGen/RegisterClassInfo.cpp
Commit c69c9e0f0fd2e5b72c4a1947822a4961b8630123 by zinenko
[mlir] Remove LLVMType, LLVM dialect types now derive Type directly

BEGIN_PUBLIC
[mlir] Remove LLVMType, LLVM dialect types now derive Type directly

This class has become a simple `isa` hook with no proper functionality.
Removing will allow us to eventually make the LLVM dialect type infrastructure
open, i.e., support non-LLVM types inside container types, which itself will
make the type conversion more progressive.

Introduce a call `LLVM::isCompatibleType` to be used instead of
`isa<LLVMType>`. For now, this is strictly equivalent.
END_PUBLIC

Depends On D93681

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D93713
The file was modifiedmlir/lib/Conversion/ArmSVEToLLVM/ArmSVEToLLVM.cpp
The file was modifiedmlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp
The file was modifiedmlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
The file was modifiedmlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
The file was modifiedmlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
The file was modifiedmlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp
The file was modifiedmlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
The file was modifiedmlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
The file was modifiedmlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
The file was modifiedmlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
The file was modifiedmlir/lib/Conversion/GPUCommon/GPUOpsLowering.h
The file was modifiedmlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
The file was modifiedmlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h
The file was modifiedmlir/test/Dialect/LLVMIR/invalid.mlir
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
The file was modifiedmlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
The file was modifiedmlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
The file was modifiedmlir/lib/Conversion/VectorToROCDL/VectorToROCDL.cpp
The file was modifiedmlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
The file was modifiedmlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
The file was modifiedmlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
The file was modifiedmlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
The file was modifiedmlir/include/mlir/Target/LLVMIR/TypeTranslation.h
The file was modifiedmlir/docs/Tutorials/Toy/Ch-6.md
The file was modifiedmlir/lib/Target/LLVMIR/TypeTranslation.cpp
The file was modifiedmlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/TypeDetail.h
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
The file was modifiedmlir/lib/Target/LLVMIR/ModuleTranslation.cpp
Commit 9eb2284f60391eca246f12398d247fc1555d6bf5 by yitzhakm
[clang-tidy] Update uses of deprecated Transformer APIs in StringFindStrContainsCheck.

Migrates `change` to `changeTo`; changes to new constructor API (2-arg construct
+ `setRule`); refactors use of `addInclude` to newer version.

Differential Revision: https://reviews.llvm.org/D93695
The file was modifiedclang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp
Commit 60466fad2dc155329cc870ea733d4f41561bd46d by Joseph.Nash
[AMDGPU] Remove deprecated V_MUL_LO_I32 from GFX10

It was removed in GFX10 GPUs, but LLVM could
generate it.

Reviewed By: rampitec, arsenm

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

Change-Id: Id1c716d71313edcfb768b2b175a6789ef9b01f3c
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPU.td
The file was modifiedllvm/test/MC/AMDGPU/gfx10_asm_vop3.s
The file was modifiedllvm/test/MC/AMDGPU/gfx1030_unsupported.s
The file was modifiedllvm/lib/Target/AMDGPU/VOP3Instructions.td
Commit 55488bd3cd1a468941e26ad4cf94f2bad887fc02 by llvm-dev
CGExpr - EmitMatrixSubscriptExpr - fix getAs<> null-dereference static analyzer warning. NFCI.

getAs<> can return null if the cast is invalid, which can lead to null pointer deferences. Use castAs<> instead which will assert that the cast is valid.
The file was modifiedclang/lib/CodeGen/CGExpr.cpp
Commit 0c59a4da59a42f04ba932fdab806fc4473d4e0b5 by david.green
[ARM][AArch64] Some extra test to show anyextend lowering. NFC
The file was addedllvm/test/CodeGen/AArch64/lowerMUL-newload.ll
The file was modifiedllvm/test/CodeGen/ARM/lowerMUL-newload.ll
Commit f22c0f40b5d657c0293fc9332274c18d3c4f836c by steveire
[ASTMatchers] Omit methods from explicit template instantations

Differential Revision: https://reviews.llvm.org/D94032
The file was modifiedclang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
The file was modifiedclang/lib/ASTMatchers/ASTMatchFinder.cpp
Commit 30dcbb2a83018da90bac9e52fdbf1b0770e941c2 by hanchung
[mlir][Linalg] Add a test case that consumer has "reduction" loops.

In the past, this was a missing test case and the fusion was not supported. It's
supported after the revisit of init_tensor in Linalg.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D94093
The file was modifiedmlir/test/Dialect/Linalg/fusion-tensor.mlir
Commit c82beaba319657d93a62523a65f8969aad9ecab1 by Jonas Devlieghere
[lldb] Add timers to Reproducer::Keep and Reproducer::Discard
The file was modifiedlldb/source/Utility/Reproducer.cpp
Commit 675a2973ee7745d1859e3b72be40a803dd349e55 by yitzhakm
[libTooling] Add support for smart pointers to relevant Transformer `Stencil`s.

Stencils `maybeDeref` and `maybeAddressOf` are designed to handle nodes that may
be pointers. Currently, they only handle native pointers. This patch extends the
support to recognize smart pointers and handle them as well.

Differential Revision: https://reviews.llvm.org/D93637
The file was modifiedclang/include/clang/Tooling/Transformer/Stencil.h
The file was modifiedclang/unittests/Tooling/StencilTest.cpp
The file was modifiedclang/lib/Tooling/Transformer/Stencil.cpp
Commit a427f15d6070fd50457c553a097e031139b40886 by Matthew.Arsenault
GlobalISel: Add isKnownToBeAPowerOfTwo helper function
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/Utils.h
The file was modifiedllvm/lib/CodeGen/GlobalISel/Utils.cpp
The file was modifiedllvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
Commit 761aca1e2e393da62ddaf7c42b61196be2466571 by serguei.n.dmitriev
[llvm-link] fix linker behavior when linking archives with --only-needed option

This patch fixes linker behavior when archive is linked with other inputs
as a library (i.e. when --only-needed option is specified). In this case library
is expected to be normally linked first into a separate module and only after
that linker should import required symbols from the linked library module.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D92535
The file was addedllvm/test/tools/llvm-link/Inputs/i.ll
The file was modifiedllvm/tools/llvm-link/llvm-link.cpp
The file was addedllvm/test/tools/llvm-link/archive-only-needed.ll