SuccessChanges

Changes from Git (git http://labmaster3.local/git/llvm-project.git)

Summary

  1. [mlir-lsp-server] Add support for textDocument/documentSymbols (details)
  2. [mlir-lsp-server] Document the features provided by the language server (details)
  3. [lldb, win] Remove obsolete workaround for MSVC and python libs (details)
  4. [ms] [llvm-ml] Warn on command-line redefinition (details)
  5. [mlir-vscode] Fix dependencies to enable packaging the extension properly. (details)
  6. [libc] Add implementation of expm1f. (details)
  7. [lld-macho][nfc] Fix uninitialized members warning from Coverity (details)
  8. [ARM] Ensure instructions are simplified prior to GatherScatter lowering. (details)
  9. [OpenMP] Implement '#pragma omp unroll'. (details)
  10. [libcxx][ranges][nfc] moves view concepts into `__ranges/concepts.h` (details)
  11. [gn build] Port bbb3d03f93b8 (details)
  12. Move code for checking loop metadata into Analysis [nfc] (details)
  13. Move variable only used inside an assert into the assert. (details)
  14. [SCEV] Use mustprogress flag on loops (in addition to function attribute) (details)
  15. [ELF][RISCV] Resolve branch relocations referencing undefined weak to current location if not using PLT (details)
  16. [ELF] Simplify getAArch64UndefinedRelativeWeakVA. NFC (details)
  17. [libc++] Remove unnecessary header in enable_view.h (which caused a cycle) (details)
  18. [LI] Add a cover function for checking if a loop is mustprogress [nfc] (details)
  19. [ARM] Fix Changed status in MVEGatherScatterLoweringPass. (details)
  20. [clang] NRVO: Improvements and handling of more cases. (details)
  21. [SimplifyCFG] avoid 'tmp' variables in test file; NFC (details)
  22. [LV] Parallel annotated loop does not imply all loads can be hoisted. (details)
  23. 2d Arm Neon sdot op, and lowering to the intrinsic. (details)
  24. [MLIR] Document that Dialect Conversion traverses in preorder (details)
  25. [AArch64][GlobalISel] Legalize scalar G_CTTZ + G_CTTZ_ZERO_UNDEF (details)
  26. [libcxx][ranges] removes default_initializable from weakly_incrementable and view (details)
  27. Preserve more MD_mem_parallel_loop_access and MD_access_group in SROA (details)
  28. [clang] Implement P2266 Simpler implicit move (details)
  29. [Profile] Handle invalid profile data (details)
  30. [IR] make -warn-frame-size into a module attr (details)
  31. [Profile] Remove redundant check (details)
  32. LoadStoreVectorizer: support different operand orders in the add sequence match (details)
  33. [static initializers] Emit global_ctors and global_dtors in reverse order when .ctors/.dtors are used. (details)
  34. [IR] Value: Fix OpCode checks (details)
  35. [RISCV] Add test cases that show failure to use some W instructions if they are proceeded by a load. NFC (details)
  36. [SDAG] Fix pow2 assumption when splitting vectors (details)
  37. [ValueTypes] Define MVTs for v6i32, v6f32, v7i32, v7f32 (details)
  38. [AArch64][GlobalISel] Fix incorrectly generating uxtw/sxtw for addressing modes. (details)
  39. [mlir][IR] Move MemRefElementTypeInterface to a new BuiltinTypeInterfaces file (details)
  40. [mlir] Add new SubElementAttr/SubElementType Interfaces (details)
  41. [mlir-ir-printing] Prefix the dump message with the split marker(// -----) (details)
  42. [Flang] Compile fix after D99459. (details)
  43. [RISCV] Use ComputeNumSignBits/MaskedValueIsZero in RISCVDAGToDAGISel::selectSExti32/selectZExti32. (details)
  44. [VectorCombine] Fix alignment in single element store (details)
  45. Revert "[clang] Implement P2266 Simpler implicit move" (details)
  46. Revert "[clang] NRVO: Improvements and handling of more cases." (details)
  47. [RISCV] Remove extra assignment of intrinsic ID in ManualCodegen. NFC (details)
  48. [lld/mac] Make binaries written by lld strippable (details)
  49. [RISCV] Avoid scalar outgoing argumetns overwriting vector frame objects. (details)
Commit ff81a2c95ddb944c61c162baec3521d9dd62c2cc by riddleriver
[mlir-lsp-server] Add support for textDocument/documentSymbols

This allows for building an outline of the symbols and symbol tables within the IR. This allows for easy navigations to functions/modules and other symbol/symbol table operations within the IR.

Differential Revision: https://reviews.llvm.org/D103729
The file was modifiedmlir/lib/Parser/AsmParserState.cpp
The file was addedmlir/test/mlir-lsp-server/document-symbols.test
The file was modifiedmlir/lib/Tools/mlir-lsp-server/LSPServer.cpp
The file was modifiedmlir/lib/Tools/mlir-lsp-server/lsp/Protocol.cpp
The file was modifiedmlir/lib/Tools/mlir-lsp-server/MLIRServer.h
The file was modifiedmlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
The file was modifiedmlir/lib/Tools/mlir-lsp-server/lsp/Transport.cpp
The file was modifiedmlir/test/mlir-lsp-server/initialize-params.test
The file was modifiedmlir/lib/Parser/Parser.cpp
The file was modifiedmlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
The file was modifiedmlir/include/mlir/Parser/AsmParserState.h
Commit bb97959949ff68aa7e001bab2be1b5be4d6d389a by riddleriver
[mlir-lsp-server] Document the features provided by the language server

This revision adds focused documentation on each of the individual features of the server, with images showcasing how they look in vscode.

Differential Revision: https://reviews.llvm.org/D103942
The file was modifiedmlir/docs/Tools/MLIRLSP.md
Commit ca10add5dbe4c3fb2ccaa032d9c7f3e13ca4b14b by stilis
[lldb, win] Remove obsolete workaround for MSVC and python libs

This workaround was necessary before the major changes of managing python versions, but it is not needed anymore.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D104047
The file was modifiedlldb/source/API/CMakeLists.txt
Commit f03a3caac5e5ac9a440bea1b8ad1485c714f156b by epastor
[ms] [llvm-ml] Warn on command-line redefinition

If a macro is defined on the command line and then overridden in the source code, this is likely to be an error in the user's build system. We should warn on this.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D104008
The file was modifiedllvm/test/tools/llvm-ml/command_line_defines.asm
The file was modifiedllvm/lib/MC/MCParser/MasmParser.cpp
The file was addedllvm/test/tools/llvm-ml/command_line_defines_errors.asm
Commit c0e6f2f43a4cf894173b78cc95b6c29c9fe1ab94 by riddleriver
[mlir-vscode] Fix dependencies to enable packaging the extension properly.
The file was modifiedmlir/utils/vscode/package-lock.json
The file was modifiedmlir/utils/vscode/package.json
Commit 4e5f8b4d8d9d7a6039e10b9507dac896eed92040 by lntue
[libc] Add implementation of expm1f.

Use expm1f(x) = exp(x) - 1 for |x| > ln(2).
For |x| <= ln(2), divide it into 3 subintervals: [-ln2, -1/8], [-1/8, 1/8], [1/8, ln2]
and use a degree-6 polynomial approximation generated by Sollya's fpminmax for each interval.
Errors < 1.5 ULPs when we use fma to evaluate the polynomials.

Differential Revision: https://reviews.llvm.org/D101134
The file was addedlibc/test/src/math/exhaustive/expm1f_test.cpp
The file was addedlibc/src/math/generic/expm1f.cpp
The file was addedlibc/utils/mathtools/expm1f.sollya
The file was modifiedlibc/utils/MPFRWrapper/MPFRUtils.h
The file was addedlibc/test/src/math/expm1f_test.cpp
The file was modifiedlibc/utils/FPUtil/CMakeLists.txt
The file was modifiedlibc/test/src/math/exhaustive/CMakeLists.txt
The file was addedlibc/src/math/expm1f.h
The file was modifiedlibc/utils/MPFRWrapper/MPFRUtils.cpp
The file was modifiedlibc/utils/FPUtil/BitPatterns.h
The file was modifiedlibc/spec/stdc.td
The file was addedlibc/test/src/math/differential_testing/expm1f_diff.cpp
The file was modifiedlibc/test/src/math/differential_testing/CMakeLists.txt
The file was addedlibc/test/src/math/differential_testing/expm1f_perf.cpp
The file was modifiedlibc/config/linux/x86_64/entrypoints.txt
The file was modifiedlibc/test/src/math/CMakeLists.txt
The file was modifiedlibc/src/math/CMakeLists.txt
The file was modifiedlibc/src/math/generic/CMakeLists.txt
The file was modifiedlibc/utils/FPUtil/generic/FMA.h
The file was modifiedlibc/config/linux/aarch64/entrypoints.txt
The file was addedlibc/utils/FPUtil/PolyEval.h
Commit 4b5c6c5c4b9293557ec8e76d6500527e5d8f9611 by jezng
[lld-macho][nfc] Fix uninitialized members warning from Coverity

We were always assigning to this member before using it, but just to be
safe...

See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151029.html
The file was modifiedlld/MachO/InputSection.h
Commit e0c605f6383c5a3aa8f5fa34ed4be9dc51b4a2ae by david.green
[ARM] Ensure instructions are simplified prior to GatherScatter lowering.

Surprisingly, not all instructions are always simplified after unrolling
and before MVE gather/scatter lowering. Notably dead gather operations
can be left around which cause the gather/scatter lowering pass to crash
if there are multiple gathers, some of which are dead.

This patch ensures they are simplified before we modify anything, which
can change some of the existing tests, including making them no-longer
test what they originally tested. This uses a combination of disabling
the gather/scatter lowering pass and adjusting the test to keep them as
before.

Differential Revision: https://reviews.llvm.org/D103150
The file was modifiedllvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
The file was modifiedllvm/test/CodeGen/Thumb2/mve-pred-xor.ll
The file was modifiedllvm/test/CodeGen/Thumb2/LowOverheadLoops/remat-vctp.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-vqdmulh.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-phireg.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-gather-scatter-optimisation.ll
The file was addedllvm/test/CodeGen/Thumb2/mve-gather-unused.ll
The file was modifiedllvm/test/CodeGen/Thumb2/lsll0.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-selectcc.ll
Commit a22236120f17074532bec70f5916a235beddd475 by llvm-project
[OpenMP] Implement '#pragma omp unroll'.

Implementation of the unroll directive introduced in OpenMP 5.1. Follows the approach from D76342 for the tile directive (i.e. AST-based, not using the OpenMPIRBuilder). Tries to use `llvm.loop.unroll.*` metadata where possible, but has to fall back to an AST representation of the outer loop if the partially unrolled generated loop is associated with another directive (because it needs to compute the number of iterations).

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D99459
The file was modifiedclang/include/clang/AST/StmtOpenMP.h
The file was addedclang/test/OpenMP/unroll_codegen_for_collapse_outer.cpp
The file was modifiedclang/lib/Sema/TreeTransform.h
The file was modifiedclang/lib/CodeGen/CGOpenMPRuntime.cpp
The file was modifiedclang/lib/Serialization/ASTReader.cpp
The file was modifiedclang/lib/Serialization/ASTWriterStmt.cpp
The file was addedclang/test/OpenMP/unroll_codegen_for_partial.cpp
The file was modifiedclang/lib/AST/StmtPrinter.cpp
The file was modifiedclang/lib/AST/OpenMPClause.cpp
The file was modifiedclang/lib/Serialization/ASTWriter.cpp
The file was modifiedclang/lib/AST/StmtOpenMP.cpp
The file was modifiedclang/include/clang-c/Index.h
The file was modifiedclang/lib/CodeGen/CodeGenFunction.h
The file was addedclang/test/OpenMP/unroll_codegen_partial.cpp
The file was modifiedllvm/include/llvm/Frontend/OpenMP/OMP.td
The file was addedclang/test/OpenMP/unroll_codegen_heuristic.cpp
The file was addedclang/test/OpenMP/unroll_messages.cpp
The file was modifiedclang/lib/AST/StmtProfile.cpp
The file was addedclang/test/OpenMP/unroll_codegen_unroll_for.cpp
The file was modifiedclang/tools/libclang/CXCursor.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/lib/Sema/SemaOpenMP.cpp
The file was addedclang/test/OpenMP/unroll_ast_print.cpp
The file was modifiedclang/include/clang/AST/OpenMPClause.h
The file was modifiedclang/lib/CodeGen/CGStmtOpenMP.cpp
The file was modifiedclang/tools/libclang/CIndex.cpp
The file was modifiedclang/lib/Basic/OpenMPKinds.cpp
The file was modifiedclang/lib/Sema/SemaExceptionSpec.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was addedclang/test/OpenMP/unroll_codegen_full.cpp
The file was modifiedclang/include/clang/AST/RecursiveASTVisitor.h
The file was modifiedclang/lib/CodeGen/CGStmt.cpp
The file was modifiedclang/include/clang/Basic/StmtNodes.td
The file was modifiedclang/lib/StaticAnalyzer/Core/ExprEngine.cpp
The file was addedclang/test/OpenMP/unroll_codegen_factor.cpp
The file was modifiedclang/lib/Parse/ParseOpenMP.cpp
The file was addedclang/test/OpenMP/unroll_codegen_parallel_for_factor.cpp
The file was addedclang/test/OpenMP/unroll_codegen_tile_for.cpp
The file was modifiedclang/include/clang/Serialization/ASTBitCodes.h
The file was modifiedclang/lib/Serialization/ASTReaderStmt.cpp
Commit bbb3d03f93b86ccef7581f34c7582ebd70c80a19 by cjdb
[libcxx][ranges][nfc] moves view concepts into `__ranges/concepts.h`
The file was modifiedlibcxx/include/ranges
The file was removedlibcxx/include/__ranges/view.h
The file was modifiedlibcxx/include/__ranges/concepts.h
The file was addedlibcxx/include/__ranges/enable_view.h
The file was modifiedlibcxx/include/__ranges/view_interface.h
The file was modifiedlibcxx/include/CMakeLists.txt
Commit 14097fbb0818dab80676c0cd909116b1720f2c9f by llvmgnsyncbot
[gn build] Port bbb3d03f93b8
The file was modifiedllvm/utils/gn/secondary/libcxx/include/BUILD.gn
Commit b6ee5f2b1df66987e65e1b636ba9ae1554b0334b by listmail
Move code for checking loop metadata into Analysis [nfc]

I need the mustprogress loop metadata in ScalarEvolution and it makes sense to keep all the accessors for quering loop metadate together.
The file was modifiedllvm/include/llvm/Analysis/LoopInfo.h
The file was modifiedllvm/lib/Analysis/LoopInfo.cpp
The file was modifiedllvm/include/llvm/Transforms/Utils/LoopUtils.h
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
Commit 1d3873d41eca67e974bafbaa91866581bcc0d973 by saugustine
Move variable only used inside an assert into the assert.

This prevents build failures with -Wunused.
The file was modifiedclang/lib/Serialization/ASTReaderStmt.cpp
Commit aaaeb4b160fe94e0ad3bcd6073eea4807f84a33a by listmail
[SCEV] Use mustprogress flag on loops (in addition to function attribute)

This addresses a performance regression reported against 3c6e4191.  That change (correctly) limited a transform based on assumed finiteness to mustprogress loops, but the previous change (38540d7) which introduced the mustprogress check utility only handled function attributes, not the loop metadata form.

It turns out that clang uses the function attribute form for C++, and the loop metadata form for C.  As a result, 3c6e4191 ended up being a large regression in practice for C code as loops weren't being considered mustprogress despite the language semantics.
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
The file was modifiedllvm/test/Analysis/ScalarEvolution/trip-count-unknown-stride.ll
Commit c03b6305d8419fda84a67f4fe357b69a86e4b54f by i
[ELF][RISCV] Resolve branch relocations referencing undefined weak to current location if not using PLT

In a -no-pie link we optimize R_PLT_PC to R_PC. Currently we resolve a branch
relocation to the link-time zero address. However such a choice tends to cause
relocation overflow possibility for RISC architectures.

* aarch64: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the next instruction
* mips: GNU ld: branch to the start of the text segment (?); ld.lld: branch to zero
* ppc32: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the current instruction
* ppc64: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the current instruction
* riscv: GNU ld: branch to the absolute zero address (with instruction rewriting)
* i386/x86_64: GNU ld/ld.lld: branch to the link-time zero address

I think that resolving to the same location is a good choice. The instruction,
if triggered, is clearly an undefined behavior. Resolving to the same location
can cause an infinite loop (making the user aware of the issue) while ensuring
no overflow.

Reviewed By: jrtc27

Differential Revision: https://reviews.llvm.org/D103001
The file was modifiedlld/test/ELF/riscv-undefined-weak.s
The file was modifiedlld/ELF/InputSection.cpp
Commit 0995bbdb66ebd91097c344dfc6529cd05de4818d by i
[ELF] Simplify getAArch64UndefinedRelativeWeakVA. NFC
The file was modifiedlld/ELF/InputSection.cpp
Commit 859c924c5fd58865e824b02c8bea40e7cb55456e by Louis Dionne
[libc++] Remove unnecessary header in enable_view.h (which caused a cycle)
The file was modifiedlibcxx/include/__ranges/enable_view.h
Commit 7629b2a09c169bfd7f7295deb3678f3fa7755eee by listmail
[LI] Add a cover function for checking if a loop is mustprogress [nfc]

Essentially, the cover function simply combines the loop level check and the function level scope into one call.  This simplifies several callers and is (subjectively) less error prone.
The file was modifiedllvm/include/llvm/Analysis/LoopInfo.h
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
The file was modifiedllvm/lib/Analysis/LoopInfo.cpp
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
Commit 5d5b686f6bf6b15b8fbd9ccf957295397f27afc9 by david.green
[ARM] Fix Changed status in MVEGatherScatterLoweringPass.

Now that we are calling SimplifyInstructionsInBlock, make sure we update
Changed when it reports alterations.
The file was modifiedllvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
Commit 667fbcdd0b2ee5e78f5ce9789b862e3bbca94644 by mizvekov
[clang] NRVO: Improvements and handling of more cases.

This expands NRVO propagation for more cases:

Parse analysis improvement:
* Lambdas and Blocks with dependent return type can have their variables
  marked as NRVO Candidates.

Variable instantiation improvements:
* Fixes crash when instantiating NRVO variables in Blocks.
* Functions, Lambdas, and Blocks which have auto return type have their
  variables' NRVO status propagated. For Blocks with non-auto return type,
  as a limitation, this propagation does not consider the actual return
  type.

This also implements exclusion of VarDecls which are references to
dependent types.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D99696
The file was modifiedclang/lib/Sema/SemaCoroutine.cpp
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/test/CodeGen/nrvo-tracking.cpp
The file was modifiedclang/lib/Sema/Sema.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/lib/Sema/SemaStmt.cpp
The file was modifiedclang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit 7b969ef8b4eb93d7a2be093b27280f12b8cd9ccb by spatel
[SimplifyCFG] avoid 'tmp' variables in test file; NFC
The file was modifiedllvm/test/Transforms/SimplifyCFG/two-entry-phi-return.ll
Commit 4f01122c3f6c70beee8f736f196a09976602685f by joachim
[LV] Parallel annotated loop does not imply all loads can be hoisted.

As noted in https://bugs.llvm.org/show_bug.cgi?id=46666, the current behavior of assuming if-conversion safety if a loop is annotated parallel (`!llvm.loop.parallel_accesses`), is not expectable, the documentation for this behavior was since removed from the LangRef again, and can lead to invalid reads.
This was observed in POCL (https://github.com/pocl/pocl/issues/757) and would require similar workarounds in current work at hipSYCL.

The question remains why this was initially added and what the implications of removing this optimization would be.
Do we need an alternative mechanism to propagate the information about legality of if-conversion?
Or is the idea that conditional loads in `#pragma clang loop vectorize(assume_safety)` can be executed unmasked without additional checks flawed in general?
I think this implication is not part of what a user of that pragma (and corresponding metadata) would expect and thus dangerous.

Only two additional tests failed, which are adapted in this patch. Depending on the further direction force-ifcvt.ll should be removed or further adapted.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D103907
The file was removedllvm/test/Transforms/LoopVectorize/X86/force-ifcvt.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/X86/tail_folding_and_assume_safety.ll
The file was modifiedllvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
Commit 20daedacca803b81db6d8773b705345702bf0fc3 by ataei
2d Arm Neon sdot op, and lowering to the intrinsic.

This adds Sdot2d op, which is similar to the usual Neon
intrinsic except that it takes 2d vector operands, reflecting the
structure of the arithmetic that it's performing: 4 separate
4-dimensional dot products, whence the vector<4x4xi8> shape.

This also adds a new pass, arm-neon-2d-to-intr, lowering
this new 2d op to the 1d intrinsic.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D102504
The file was modifiedmlir/include/mlir/Conversion/Passes.td
The file was modifiedmlir/include/mlir/Dialect/ArmNeon/ArmNeon.td
The file was addedmlir/test/Dialect/ArmNeon/invalid.mlir
The file was modifiedmlir/lib/Conversion/PassDetail.h
The file was addedmlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
The file was addedmlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h
The file was modifiedmlir/include/mlir/Conversion/Passes.h
The file was addedmlir/lib/Conversion/ArmNeon2dToIntr/CMakeLists.txt
The file was addedmlir/test/Target/LLVMIR/arm-neon-2d.mlir
The file was modifiedmlir/lib/Conversion/CMakeLists.txt
Commit 4f6ec382c8b7204f3b1f48060025f970925f5804 by gcmn
[MLIR] Document that Dialect Conversion traverses in preorder

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D102525
The file was modifiedmlir/docs/DialectConversion.md
Commit 933df6ca796c0ace889bcc64706ec53462bd859a by Jessica Paquette
[AArch64][GlobalISel] Legalize scalar G_CTTZ + G_CTTZ_ZERO_UNDEF

This adds legalization for scalar G_CTTZ and G_CTTZ_ZERO_UNDEF. Vector support
requires handling vector G_BITREVERSE, which I haven't gotten around to yet.

For G_CTTZ_ZERO_UNDEF, we just lower it to G_CTTZ.

For G_CTTZ, we match SelectionDAG's lowering to a G_BITREVERSE + G_CTLZ.

e.g. https://godbolt.org/z/nPEseYh1s

(With this patch, we have slightly worse codegen than SDAG for types smaller
than s32; it seems like we're missing a combine.)

Also, this adds in a function to build G_BITREVERSE to MachineIRBuilder.

Differential Revision: https://reviews.llvm.org/D104065
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/legalize-cttz.mir
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/legalize-cttz-zero-undef.mir
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
Commit 462f8f06113616ac5646144972d3f453639aac69 by cjdb
[libcxx][ranges] removes default_initializable from weakly_incrementable and view

also:

* removes default constructors from predefined iterators
* makes span and string_view views

Partially implements P2325.
Partially resolves LWG3326.

Differential Revision: https://reviews.llvm.org/D102468
The file was modifiedlibcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.winc/weakly_incrementable.compile.pass.cpp
The file was modifiedlibcxx/include/__ranges/concepts.h
The file was modifiedlibcxx/include/__iterator/concepts.h
The file was modifiedlibcxx/test/std/containers/views/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/test/std/strings/string.view/range_concept_conformance.compile.pass.cpp
The file was modifiedlibcxx/include/iterator
The file was removedlibcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.cons/default.pass.cpp
The file was modifiedlibcxx/docs/Cxx2aStatusIssuesStatus.csv
The file was modifiedlibcxx/docs/Cxx2aStatusPaperStatus.csv
The file was removedlibcxx/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/default.pass.cpp
The file was modifiedlibcxx/include/span
The file was modifiedlibcxx/test/std/ranges/range.req/range.view/view.compile.pass.cpp
The file was modifiedlibcxx/include/__ranges/enable_view.h
The file was removedlibcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.winc/subsumption.compile.pass.cpp
The file was removedlibcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/default.pass.cpp
The file was removedlibcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/default.pass.cpp
The file was modifiedlibcxx/include/string_view
The file was removedlibcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/default.pass.cpp
The file was modifiedlibcxx/test/std/ranges/range.req/range.view/view.subsumption.compile.pass.cpp
Commit 41555eaf65b12db00c8a18e7fe530f72ab9ebfc0 by andrew.kaylor
Preserve more MD_mem_parallel_loop_access and MD_access_group in SROA

SROA sometimes preserves MD_mem_parallel_loop_access and MD_access_group metadata on loads/stores, and sometimes fails to do so. This change adds copying of the MD after other CreateAlignedLoad/CreateAlignedStores. Also fix a case where the metadata was being copied from a load, rather than the store.

Added a LIT test to catch one case.

Patch by Mark Mendell

Differential Revision: https://reviews.llvm.org/D103254
The file was modifiedllvm/lib/Transforms/Scalar/SROA.cpp
The file was addedllvm/test/Transforms/SROA/mem-par-metadata-sroa-cast.ll
Commit cbd0054b9eb17ec48f0702e3828209646c8f5ebd by mizvekov
[clang] Implement P2266 Simpler implicit move

This Implements [[http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html|P2266 Simpler implicit move]].

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D99005
The file was modifiedclang/test/SemaCXX/warn-return-std-move.cpp
The file was modifiedclang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-cxx14.cpp
The file was modifiedclang/test/SemaCXX/constant-expression-cxx14.cpp
The file was modifiedclang/test/SemaCXX/coroutines.cpp
The file was modifiedclang/test/SemaCXX/constant-expression-cxx11.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/test/SemaCXX/coroutine-rvo.cpp
The file was modifiedclang/lib/Sema/SemaType.cpp
The file was modifiedclang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
The file was modifiedclang/test/SemaCXX/deduced-return-type-cxx14.cpp
The file was modifiedclang/test/CXX/class/class.init/class.copy.elision/p3.cpp
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/test/CXX/drs/dr3xx.cpp
The file was modifiedclang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
The file was modifiedclang/test/SemaCXX/return-stack-addr.cpp
The file was modifiedclang/lib/Sema/SemaCoroutine.cpp
The file was modifiedclang/lib/Sema/SemaStmt.cpp
Commit 189428c8fc2465c25efbf4f0bb73e26fecf150ce by aeubanks
[Profile] Handle invalid profile data

This mostly follows LLVM's InstrProfReader.cpp error handling.
Previously, attempting to merge corrupted profile data would result in
crashes. See https://crbug.com/1216811#c4.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D104050
The file was addedcompiler-rt/test/profile/Linux/corrupted-profile.c
The file was modifiedcompiler-rt/test/profile/instrprof-merge.c
The file was modifiedcompiler-rt/lib/profile/InstrProfilingMerge.c
The file was modifiedcompiler-rt/lib/profile/InstrProfilingFile.c
The file was modifiedcompiler-rt/test/profile/Linux/instrprof-merge-vp.c
The file was modifiedcompiler-rt/lib/profile/InstrProfiling.h
The file was modifiedcompiler-rt/test/profile/instrprof-without-libc.c
Commit fc018ebb608ee0c1239b405460e49f1835ab6175 by ndesaulniers
[IR] make -warn-frame-size into a module attr

-Wframe-larger-than= is an interesting warning; we can't know the frame
size until PrologueEpilogueInsertion (PEI); very late in the compilation
pipeline.

-Wframe-larger-than= was propagated through CC1 as an -mllvm flag, then
was a cl::opt in LLVM's PEI pass; this meant it was dropped during LTO
and needed to be re-specified via -plugin-opt.

Instead, make it part of the IR proper as a module level attribute,
similar to D103048. Introduce -fwarn-stack-size CC1 option.

Reviewed By: rsmith, qcolombet

Differential Revision: https://reviews.llvm.org/D103928
The file was addedllvm/test/Linker/warn-stack-frame.ll
The file was modifiedllvm/lib/IR/Module.cpp
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
The file was modifiedllvm/lib/CodeGen/PrologEpilogInserter.cpp
The file was modifiedclang/test/Frontend/backend-diagnostic.c
The file was addedclang/test/Driver/Wframe-larger-than.c
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedclang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedllvm/include/llvm/IR/Module.h
The file was modifiedllvm/test/CodeGen/X86/warn-stack.ll
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
The file was modifiedllvm/test/CodeGen/ARM/warn-stack.ll
Commit b73742bc8d2ec53f0892f1609837c088f9cfcf64 by aeubanks
[Profile] Remove redundant check

This is already checked outside the loop.

Followup to D104050.
The file was modifiedcompiler-rt/lib/profile/InstrProfilingMerge.c
Commit 119965865cc730060e4cc95690ee7dab91c2c440 by vkeles
LoadStoreVectorizer: support different operand orders in the add sequence match

First we refactor the code which does no wrapping add sequences
match: we need to allow different operand orders for
the key add instructions involved in the match.

Then we use the refactored code trying 4 variants of matching operands.

Originally the code relied on the fact that the matching operands
of the two last add instructions of memory index calculations
had the same LHS argument. But which operand is the same
in the two instructions is actually not essential, so now we allow
that to be any of LHS or RHS of each of the two instructions.
This increases the chances of vectorization to happen.

Reviewed By: volkan

Differential Revision: https://reviews.llvm.org/D103912
The file was modifiedllvm/test/Transforms/LoadStoreVectorizer/X86/vectorize-i8-nested-add.ll
The file was modifiedllvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Commit 5a1589fc6d1131e6d73c498cc5987433d1c5e098 by wolfgang_pieb
[static initializers] Emit global_ctors and global_dtors in reverse order when .ctors/.dtors are used.

Reviewed By: rnk, MaskRay, efriedma

Differential Revision: https://reviews.llvm.org/D103495
The file was modifiedllvm/test/CodeGen/X86/constructor.ll
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
The file was modifiedllvm/test/CodeGen/SPARC/constructor.ll
The file was modifiedllvm/test/CodeGen/X86/2011-08-29-InitOrder.ll
Commit ffaca140d01b0b93723c3322b08351b03b95831f by ndesaulniers
[IR] Value: Fix OpCode checks

Value::SubclassID cannot be directly compared to Instruction enums, such as
Instruction::{Call,Invoke,CallBr}. We have to first subtract InstructionVal
from the SubclassID to get the OpCode, similar to Instruction::getOpCode().

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D104043
The file was modifiedllvm/lib/IR/Value.cpp
Commit b35a842581f089daa57dd7e6b78ccb08d92709b2 by craig.topper
[RISCV] Add test cases that show failure to use some W instructions if they are proceeded by a load. NFC

The loads end up becoming sextload/zextload which prevent our
isel patterns from finding the sign_extend_inreg or AND instruction
we need.

The easiest way to fix this is to use computeKnownBits or
ComputeNumSignBits in our isel matching to catch this.
The file was modifiedllvm/test/CodeGen/RISCV/double-convert.ll
The file was modifiedllvm/test/CodeGen/RISCV/half-convert.ll
The file was modifiedllvm/test/CodeGen/RISCV/float-convert.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb.ll
Commit cfbb92441f17d1f5a9d9c3e195646df4117cb0ca by carl.ritson
[SDAG] Fix pow2 assumption when splitting vectors

When reducing vector builds to shuffles it possible that
the DAG combiner may try to extract invalid subvectors.

This happens as the existing code assumes vectors will be power
of 2 sizes, which is already untrue, but becomes more noticable
with v6 and v7 types.
Specifically the existing code assumes that half PowerOf2Ceil of
a given vector index will fit twice into a given vector.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D103880
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit 2c2d2922a24b7fa8a92f38d9043ab476d330210d by carl.ritson
[ValueTypes] Define MVTs for v6i32, v6f32, v7i32, v7f32

For use in AMDGPU selection DAG.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D103881
The file was modifiedllvm/lib/CodeGen/ValueTypes.cpp
The file was modifiedllvm/include/llvm/CodeGen/ValueTypes.td
The file was modifiedllvm/include/llvm/Support/MachineValueType.h
The file was modifiedllvm/utils/TableGen/CodeGenTarget.cpp
Commit 670edf3ee0045ce007f2f6aec94a2c3344c5682e by Amara Emerson
[AArch64][GlobalISel] Fix incorrectly generating uxtw/sxtw for addressing modes.

When the extend is from 8 or 16 bits, the addressing modes don't support those
extensions, but we weren't checking that and therefore always generated the 32->64b
extension mode. Fun.

Differential Revision: https://reviews.llvm.org/D104070
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/select-arith-extended-reg.mir
Commit f8a1d652da00ecff448213c58522da5a61d9bc4b by riddleriver
[mlir][IR] Move MemRefElementTypeInterface to a new BuiltinTypeInterfaces file

This allows for using other type interfaces in the builtin dialect, which currently results in a compile time failure (as it generates duplicate interface declarations).
The file was addedmlir/include/mlir/IR/BuiltinTypeInterfaces.td
The file was modifiedmlir/include/mlir/IR/BuiltinTypes.td
The file was modifiedmlir/include/mlir/IR/CMakeLists.txt
The file was modifiedmlir/lib/IR/CMakeLists.txt
Commit c42dd5dbb015afaef99cf876195c474c63c2393e by riddleriver
[mlir] Add new SubElementAttr/SubElementType Interfaces

These interfaces allow for a composite attribute or type to opaquely provide access to any held attributes or types. There are several intended use cases for this interface. The first of which is to allow the printer to create aliases for non-builtin dialect attributes and types. In the future, this interface will also be extended to allow for SymbolRefAttr to be placed on other entities aside from just DictionaryAttr and ArrayAttr.

To limit potential test breakages, this revision only adds the new interfaces to the builtin attributes/types that are currently hardcoded during AsmPrinter alias generation. In a followup the remaining builtin attributes/types, and non-builtin attributes/types can be extended to support it.

Differential Revision: https://reviews.llvm.org/D102945
The file was modifiedmlir/lib/IR/AsmPrinter.cpp
The file was modifiedmlir/lib/IR/BuiltinTypes.cpp
The file was addedmlir/unittests/IR/SubElementInterfaceTest.cpp
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.h
The file was modifiedmlir/lib/IR/BuiltinAttributes.cpp
The file was addedmlir/include/mlir/IR/SubElementInterfaces.td
The file was modifiedmlir/include/mlir/IR/CMakeLists.txt
The file was modifiedmlir/include/mlir/IR/BuiltinTypes.h
The file was modifiedmlir/lib/IR/CMakeLists.txt
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.td
The file was modifiedmlir/include/mlir/IR/BuiltinTypes.td
The file was addedmlir/lib/IR/SubElementInterfaces.cpp
The file was modifiedmlir/unittests/IR/CMakeLists.txt
The file was addedmlir/include/mlir/IR/SubElementInterfaces.h
Commit 8800047707a9cd86fb7143699af0e5564c28f4aa by riddleriver
[mlir-ir-printing] Prefix the dump message with the split marker(// -----)

This allows for better interaction with tools (such as mlir-lsp-server), as it separates the IR into separate modules for consecutive dumps.

Differential Revision: https://reviews.llvm.org/D104073
The file was modifiedmlir/test/Pass/run-reproducer.mlir
The file was modifiedmlir/lib/Pass/IRPrinting.cpp
The file was modifiedmlir/test/Pass/ir-printing.mlir
Commit 7836d058c7e115eace62e324ef6c01670326f518 by llvm-project
[Flang] Compile fix after D99459.

Fix Flang build after addition of a new OpenMP clauses for a Clang
patch (D99459). Flang is using TableGen to generation the declaration
of clause checks and the new clause was missing a definiton.
The file was modifiedflang/lib/Semantics/check-omp-structure.cpp
Commit 420bd5ee8ec996a2c2e305541e59465a5ba436e3 by craig.topper
[RISCV] Use ComputeNumSignBits/MaskedValueIsZero in RISCVDAGToDAGISel::selectSExti32/selectZExti32.

This helps us select W instructions in more cases. Most of the
affected tests have had the sign_extend_inreg or AND folded into
sextload/zextload.

Differential Revision: https://reviews.llvm.org/D104079
The file was modifiedllvm/test/CodeGen/RISCV/double-convert.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
The file was modifiedllvm/test/CodeGen/RISCV/float-convert.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfoB.td
The file was modifiedllvm/test/CodeGen/RISCV/half-convert.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb.ll
The file was modifiedllvm/test/CodeGen/RISCV/rem.ll
Commit 2670c7dd5b25e87825edc0aca7729c1d3dba5afc by qiucofan
[VectorCombine] Fix alignment in single element store

This fixes the concern in single element store scalarization that the
alignment of new store may be larger than it should be. It calculates
the largest alignment if index is constant, and a safe one if not.

Reviewed By: lebedev.ri, spatel

Differential Revision: https://reviews.llvm.org/D103419
The file was modifiedllvm/lib/Transforms/Vectorize/VectorCombine.cpp
The file was modifiedllvm/test/Transforms/VectorCombine/load-insert-store.ll
Commit db26615aa6a165483e6540b3f6ed684a0cbe06df by aeubanks
Revert "[clang] Implement P2266 Simpler implicit move"

This reverts commit cbd0054b9eb17ec48f0702e3828209646c8f5ebd.
The file was modifiedclang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/lib/Sema/SemaType.cpp
The file was modifiedclang/test/SemaCXX/coroutines.cpp
The file was modifiedclang/test/SemaCXX/warn-return-std-move.cpp
The file was modifiedclang/lib/Sema/SemaCoroutine.cpp
The file was modifiedclang/test/SemaCXX/constant-expression-cxx11.cpp
The file was modifiedclang/test/CXX/class/class.init/class.copy.elision/p3.cpp
The file was modifiedclang/test/SemaCXX/deduced-return-type-cxx14.cpp
The file was modifiedclang/test/SemaCXX/return-stack-addr.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/test/SemaCXX/coroutine-rvo.cpp
The file was modifiedclang/test/SemaCXX/constant-expression-cxx14.cpp
The file was modifiedclang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
The file was modifiedclang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-cxx14.cpp
The file was modifiedclang/lib/Sema/SemaStmt.cpp
The file was modifiedclang/test/CXX/drs/dr3xx.cpp
Commit 85ca7e424fd050582026a299906c9e8397043c52 by aeubanks
Revert "[clang] NRVO: Improvements and handling of more cases."

This reverts commit 667fbcdd0b2ee5e78f5ce9789b862e3bbca94644.

Causes crashes on a stage 2 build on Windows.
The file was modifiedclang/lib/Sema/Sema.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/test/CodeGen/nrvo-tracking.cpp
The file was modifiedclang/lib/Sema/SemaTemplateInstantiateDecl.cpp
The file was modifiedclang/lib/Sema/SemaCoroutine.cpp
The file was modifiedclang/lib/Sema/SemaStmt.cpp
Commit 081ae5fe1aa3ead6d9da75747d3698f09ff89cb9 by craig.topper
[RISCV] Remove extra assignment of intrinsic ID in ManualCodegen. NFC

There's already an autogenerated assignment.

Fixes static analyzer warning reported in PR50593.
The file was modifiedclang/include/clang/Basic/riscv_vector.td
Commit 54418c5a355eda7ff77a221c692ee90944c25196 by thakis
[lld/mac] Make binaries written by lld strippable

Be less clever when writing the indirect symbols in LC_DYSYMTAB:
lld used to make point __stubs and __la_symbol_ptr point at the
same bytes in the indirect symbol table in the __LINKEDIT segment.
That confused strip, so write the same bytes twice and make
__stubs and __la_symbol_ptr point at one copy each, so that they
don't share data. This unconfuses strip, and seems to be what ld64
does too, so hopefully tools are generally more used to this.

This makes the output binaries a bit larger, but not much: 4 bytes
for roughly each called function from a dylib and each weak function.
Chromium Framewoork grows by 6536 bytes, clang-format by a few hundred.

With this, `strip -x Chromium\ Framework` works (244 MB before stripping
to 171 MB after stripping, compared to 236 MB=>164 MB with ld64). Running
strip without `-x` produces the same error message now for lld-linked
Chromium Framework as for when using ld64 as a linker.

`strip clang-format` also works now but didn't previously.

Fixes PR50657.

Differential Revision: https://reviews.llvm.org/D104081
The file was modifiedlld/test/MachO/indirect-symtab.s
The file was modifiedlld/MachO/SyntheticSections.cpp
Commit 643b6407faf460915679f304420cfbee87c47734 by kai.wang
[RISCV] Avoid scalar outgoing argumetns overwriting vector frame objects.

When using FP to access stack objects, the scalable stack objects will
be put at the lower end of the frame. It looks like

```
|-------------------|  <-- FP
| callee-saved regs |
|-------------------|
| scalar local vars |
|-------------------|
| RVV local vars    |
|-------------------|  <-- SP
```

If there are scalar arguments that need to pass through memory and there
are vector objects on the stack using FP to access. The outgoing scalar
arguments will overwrite the vector objects. It looks like

```
|-------------------|  <-- FP
| callee-saved regs |
|-------------------|
| scalar local vars |
|-------------------|         |-------------------|
| RVV local vars    |         | outgoing args     | <- outgoing arguments
|-------------------|  <-- SP |-------------------|    overwrite from here.
```

In this patch, we reserve the stack for the outgoing arguments before
function calls if using FP to access and there are scalable vector frame
objects. It looks like

```
|-------------------|  <-- FP
| callee-saved regs |
|-------------------|
| scalar local vars |
|-------------------|
| RVV local vars    |
|-------------------|
| outgoing args     |
|-------------------|  <-- SP
```

Differential Revision: https://reviews.llvm.org/D103622
The file was modifiedllvm/test/CodeGen/RISCV/rvv/rvv-out-arguments.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVFrameLowering.cpp