UnstableChanges

Summary

  1. [lld/mac] Make binaries written by lld strippable (details)
  2. [RISCV] Avoid scalar outgoing argumetns overwriting vector frame objects. (details)
  3. [lldb] Move once_flags in HostInfoLinux so the internal state struct (details)
  4. [PowerPC] Relax register superclasses for paired memops (details)
  5. [lldb] Fix leak in test (details)
  6. Revert "[CMake] Don't use libc++ by default on Windows yet" (details)
  7. Revert "[Driver] Support libc++ in MSVC" (details)
  8. Function Specialization Pass (details)
  9. [gn build] Port c4a0969b9c14 (details)
  10. [mlir] Refactor ComplexOps.td [NFC] (details)
  11. [clang-tidy] LIT test fix for Remark diagnostic (details)
  12. [compiler-rt] [builtins] [AArch64] Add missing AArch64 data synchronization barrier (dsb) to __clear_cache (details)
  13. [OpenCL][NFC] Reorganize ClangOpenCLBuiltinEmitter comments (details)
  14. Fix implicit dependency on <string> header. NFCI. (details)
  15. [Analysis] Pass RecurrenceDescriptor as const reference. NFCI. (details)
  16. SampleProf.h - fix spelling mistake in assert message. NFC. (details)
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/lib/Target/RISCV/RISCVFrameLowering.cpp
The file was modifiedllvm/test/CodeGen/RISCV/rvv/rvv-out-arguments.ll
Commit 632cbcac79065a62a306dbda7b3a6e1f315e3260 by Raphael Isemann
[lldb] Move once_flags in HostInfoLinux so the internal state struct

The HostInfoLinuxFields struct is supposed to be set up/torn down on
Initialize/Terminate and should contain all the state of the plugin.
`once_flags` are part of this state and should also be reset on `Terminate` so
we can re-initialize these lazy values after the next `Initialize` call.

This itself is NFC as the HostInfoLinux was broken before this patch and is
still broken afterwards. D104091 will be the proper fix.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D104093
The file was modifiedlldb/source/Host/linux/HostInfoLinux.cpp
Commit bc104fdcecc0da1650177f3587ffe233b37f071b by qiucofan
[PowerPC] Relax register superclasses for paired memops

Relaxing superclass constraint for VSX register classes helps reducing
32-byte spills and copies when register pressure is high.

In test case affected, some of them introduces more copies due to new
allocation order. However, this patch should not be the root cause, and
we may be able to fix it in other places of register allocation.

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D104006
The file was modifiedllvm/test/CodeGen/PowerPC/aix-p9-xxinsertw-xxextractuw.ll
The file was modifiedllvm/test/CodeGen/PowerPC/constant-pool.ll
The file was modifiedllvm/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll
The file was modifiedllvm/test/CodeGen/PowerPC/remove-redundant-moves.ll
The file was modifiedllvm/test/CodeGen/PowerPC/mma-acc-spill.ll
The file was modifiedllvm/test/CodeGen/PowerPC/mma-intrinsics.ll
The file was modifiedllvm/test/CodeGen/PowerPC/paired-vector-intrinsics.ll
The file was modifiedllvm/test/CodeGen/PowerPC/vec_conv_i64_to_fp32_elts.ll
The file was modifiedllvm/test/CodeGen/PowerPC/mma-outer-product.ll
The file was modifiedllvm/test/CodeGen/PowerPC/vsx.ll
The file was modifiedllvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
Commit f3f904563ec9ce8c7bfda83bbca19790cc4d9afc by Vitaly Buka
[lldb] Fix leak in test

Test leaks if we run
tools/lldb/unittests/Host/HostTests without --gtest_filter

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104091
The file was modifiedlldb/include/lldb/Host/linux/HostInfoLinux.h
The file was modifiedlldb/source/Host/linux/HostInfoLinux.cpp
The file was modifiedlldb/unittests/Host/HostInfoTest.cpp
Commit 0d5af7a4caaf19ff97ca90e9ca7f2b78a858ab07 by phosek
Revert "[CMake] Don't use libc++ by default on Windows yet"

This reverts commit b413e44200e715c254fa9a41f6a86f8761c9b362.
The file was modifiedclang/cmake/caches/Fuchsia.cmake
The file was modifiedclang/cmake/caches/Fuchsia-stage2.cmake
Commit 22f194909ae24aed817976fb54b759550e90db36 by phosek
Revert "[Driver] Support libc++ in MSVC"

This reverts commit 9625d61eb66c12388875e081b63ebed7e42c6bbb since
libc++ currently has issues with disabled exceptions which breaks
the runtimes build.
The file was removedclang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/.keep
The file was modifiedclang/lib/Driver/ToolChains/MSVC.cpp
The file was removedclang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/x86_64-pc-windows-msvc/c++/v1/.keep
The file was removedclang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/x86_64-pc-windows-msvc/.keep
The file was modifiedclang/include/clang/Driver/Options.td
The file was removedclang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/c++/v1/.keep
The file was removedclang/test/Driver/msvc-libcxx.cpp
The file was removedclang/test/Driver/Inputs/msvc_libcxx_tree/usr/bin/.keep
Commit c4a0969b9c14acc795ae9e841b8289c3d36220b1 by sjoerd.meijer
Function Specialization Pass

This adds a function specialization pass to LLVM. Constant parameters
like function pointers and constant globals are propagated to the callee by
specializing the function.

This is a first version with a number of limitations:
- The pass is off by default, so needs to be enabled on the command line,
- It does not handle specialization of recursive functions,
- It does not yet handle constants and constant ranges,
- Only 1 argument per function is specialised,
- The cost-model could be further looked into, and perhaps related,
- We are not yet caching analysis results.

This is based on earlier work by Matthew Simpson (D36432) and Vinay Madhusudan.
More recently this was also discussed on the list, see:

https://lists.llvm.org/pipermail/llvm-dev/2021-March/149380.html.

The motivation for this work is that function specialisation often comes up as
a reason for performance differences of generated code between LLVM and GCC,
which has this enabled by default from optimisation level -O3 and up. And while
this certainly helps a few cpu benchmark cases, this also triggers in real
world codes and is thus a generally useful transformation to have in LLVM.

Function specialisation has great potential to increase compile-times and
code-size.  The summary from some investigations with this patch is:
- Compile-time increases for short compile jobs is high relatively, but the
  increase in absolute numbers still low.
- For longer compile-jobs, the extra compile time is around 1%, and very much
  in line with GCC.
- It is difficult to blame one thing for compile-time increases: it looks like
  everywhere a little bit more time is spent processing more functions and
  instructions.
- But the function specialisation pass itself is not very expensive; it doesn't
  show up very high in the profile of the optimisation passes.

The goal of this work is to reach parity with GCC which means that eventually
we would like to get this enabled by default. But first we would like to address
some of the limitations before that.

Differential Revision: https://reviews.llvm.org/D93838
The file was addedllvm/lib/Transforms/Scalar/FunctionSpecialization.cpp
The file was modifiedllvm/lib/Transforms/Utils/SCCPSolver.cpp
The file was addedllvm/test/Transforms/FunctionSpecialization/function-specialization5.ll
The file was addedllvm/test/Transforms/FunctionSpecialization/function-specialization.ll
The file was addedllvm/test/Transforms/FunctionSpecialization/function-specialization2.ll
The file was addedllvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/include/llvm/LinkAllPasses.h
The file was modifiedllvm/lib/Transforms/IPO/SCCP.cpp
The file was modifiedllvm/lib/Transforms/IPO/IPO.cpp
The file was modifiedllvm/lib/Transforms/Scalar/CMakeLists.txt
The file was modifiedllvm/include/llvm/InitializePasses.h
The file was modifiedllvm/lib/Passes/PassRegistry.def
The file was modifiedllvm/include/llvm/Transforms/IPO.h
The file was modifiedllvm/include/llvm/Transforms/Utils/SCCPSolver.h
The file was modifiedllvm/lib/Transforms/IPO/PassManagerBuilder.cpp
The file was modifiedllvm/include/llvm/Transforms/Scalar/SCCP.h
The file was addedllvm/test/Transforms/FunctionSpecialization/function-specialization-recursive.ll
The file was modifiedllvm/include/llvm/Transforms/IPO/SCCP.h
The file was modifiedllvm/lib/Transforms/Scalar/SCCP.cpp
The file was addedllvm/test/Transforms/FunctionSpecialization/function-specialization3.ll
Commit eac994e227dcc0eeb02c6d4d7c221b1c2fb0b9e2 by llvmgnsyncbot
[gn build] Port c4a0969b9c14
The file was modifiedllvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
Commit f98b7796142d996861cbba824f3cacef0b446ef8 by akuegel
[mlir] Refactor ComplexOps.td [NFC]

Create a ComplexUnaryOp base class and use it for AbsOp, ReOp and ImOp.
Sort all ops in lexicographic order.

Differential Revision: https://reviews.llvm.org/D104095
The file was modifiedmlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
Commit 47d138c93992f779a5dd0810b0e7402e043df61d by dmitry.polukhin
[clang-tidy] LIT test fix for Remark diagnostic

There is a followup fix for a unit test introduced at D102906. The test file was placed into a temp folder and test assumed that it would be visible without the full path specification.

This behaviour can be changed in future and it would be good to specify full path to the file at the test.

Test Plan:
```
ninja check-clang-tools
```

Reviewed By: DmitryPolukhin

Differential Revision: https://reviews.llvm.org/D104021
The file was modifiedclang-tools-extra/test/clang-tidy/infrastructure/remarks.cpp
Commit 6455418d3d2a2de1a8251cc2ccf2e87b9ae3112d by srhines
[compiler-rt] [builtins] [AArch64] Add missing AArch64 data synchronization barrier (dsb) to __clear_cache

https://developer.arm.com/documentation/den0024/a/Caches/Cache-maintenance
covers how to properly clear caches on AArch64, and the builtin
implementation was missing a `dsb ish` after clearing the icache for the
selected range.

Reviewed By: kristof.beyls

Differential Revision: https://reviews.llvm.org/D104094
The file was modifiedcompiler-rt/lib/builtins/clear_cache.c
Commit ca964b40e6e5d20fb658f2d36238b46a35dd860f by sven.vanhaastregt
[OpenCL][NFC] Reorganize ClangOpenCLBuiltinEmitter comments

Since 8866793b4e0a ("[OpenCL] Add OpenCL builtin test generator",
2021-06-09) there are two emitters in this file, so move the
file-level comment to the appropriate class.
The file was modifiedclang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
Commit d789ed11ea01b30a69e8cd9612ebd336398ef3ec by llvm-dev
Fix implicit dependency on <string> header. NFCI.
The file was modifiedllvm/tools/llvm-rust-demangle-fuzzer/llvm-rust-demangle-fuzzer.cpp
Commit 5e6bfb661e8b51b440eda04d0be0c9a00b8713e9 by llvm-dev
[Analysis] Pass RecurrenceDescriptor as const reference. NFCI.

We were passing the RecurrenceDescriptor by value to most of the reduction analysis methods, despite it being rather bulky with TrackingVH members (that can be costly to copy). In all these cases we're only using the RecurrenceDescriptor for rather basic purposes (access to types/kinds etc.).

Differential Revision: https://reviews.llvm.org/D104029
The file was modifiedllvm/include/llvm/Analysis/TargetTransformInfo.h
The file was modifiedllvm/include/llvm/Analysis/TargetTransformInfoImpl.h
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
The file was modifiedllvm/lib/Analysis/TargetTransformInfo.cpp
The file was modifiedllvm/include/llvm/Transforms/Utils/LoopUtils.h
The file was modifiedllvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
The file was modifiedllvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
Commit f0a68bbc967ab851e9b678feaf9015a2bfadb12e by llvm-dev
SampleProf.h - fix spelling mistake in assert message. NFC.
The file was modifiedllvm/include/llvm/ProfileData/SampleProf.h