Changes

Summary

  1. [MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while) (details)
  2. [www] Add cxx_status tracking for C++23. (details)
  3. BPF: Implement TTI.getCmpSelInstrCost() properly (details)
  4. [Clang][Attributes] Allow not_tail_called attribute to be applied to virtual function. (details)
  5. Add more historic DWARF vendor extensions (details)
  6. [Remarks] Emit remarks for "auto-init" !annotations (details)
  7. [Remarks] Provide more information about auto-init stores (details)
  8. [Remarks] Provide more information about auto-init calls (details)
  9. [gn build] Port 4753a69a316b (details)
  10. Add Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg. (details)
  11. [Clang][ASan] Correct AsanDtorKindToString to return non-void in default case (details)
  12. [dfsan] Conservative solution to atomic load/store (details)
  13. [Android] Use -l:libunwind.a with --rtlib=compiler-rt (details)
  14. BPF: Add LLVMTransformUtils in CMakefile LINK_COMPONENTS (details)
  15. [ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections (details)
  16. [RISCV] Support fixed vector extract_element for FP types. (details)
  17. Revert 7a0da8894348, "scudo: Support memory tagging in the secondary allocator." (details)
  18. [clang] Print 32 candidates on the first failure, with -fshow-overloads=best. (details)
Commit a813e9be5bc91203508bde239c1a15c5b8f8c0cc by rob.suderman
[MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)

Includes a lowering for tosa.const, tosa.if, and tosa.while to Standard/SCF dialects. TosaToStandard is
used for constant lowerings and TosaToSCF handles the if/while ops.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D97352
The file was addedmlir/test/Conversion/TosaToSCF/tosa-to-scf.mlir
The file was addedmlir/lib/Conversion/TosaToSCF/CMakeLists.txt
The file was addedmlir/lib/Conversion/TosaToSCF/TosaToSCF.cpp
The file was modifiedmlir/lib/Conversion/CMakeLists.txt
The file was addedmlir/lib/Conversion/TosaToStandard/CMakeLists.txt
The file was addedmlir/include/mlir/Conversion/TosaToStandard/TosaToStandard.h
The file was addedmlir/test/Conversion/TosaToStandard/tosa-to-standard.mlir
The file was modifiedmlir/lib/Conversion/PassDetail.h
The file was addedmlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
The file was modifiedmlir/include/mlir/Conversion/Passes.h
The file was addedmlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
The file was addedmlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
The file was addedmlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
The file was modifiedmlir/include/mlir/Conversion/Passes.td
Commit d95c6d3b69219d7b3049732f4081e3bb6ca70016 by richard
[www] Add cxx_status tracking for C++23.

Convert the list of standards to a table; it's starting to get unwieldy.
The file was modifiedclang/www/cxx_status.html
Commit 1959ead525b8830cc8a345f45e1c3ef9902d3229 by yhs
BPF: Implement TTI.getCmpSelInstrCost() properly

The Select insn in BPF is expensive as BPF backend
needs to resolve with conditionals.  This patch set
the getCmpSelInstrCost() to SCEVCheapExpansionBudget
for Select insn to prevent some Select insn related
optimizations.

This change is motivated during bcc code review for
   https://github.com/iovisor/bcc/pull/3270
where IndVarSimplifyPass eventually caused generating
the following asm code:
  ;       for (i = 0; (i < VIRTIO_MAX_SGS) && (i < num); i++) {
      14:       16 05 40 00 00 00 00 00 if w5 == 0 goto +64 <LBB0_6>
      15:       bc 51 00 00 00 00 00 00 w1 = w5
      16:       04 01 00 00 ff ff ff ff w1 += -1
      17:       67 05 00 00 20 00 00 00 r5 <<= 32
      18:       77 05 00 00 20 00 00 00 r5 >>= 32
      19:       a6 01 01 00 05 00 00 00 if w1 < 5 goto +1 <LBB0_4>
      20:       b7 05 00 00 06 00 00 00 r5 = 6
  00000000000000a8 <LBB0_4>:
      21:       b7 02 00 00 00 00 00 00 r2 = 0
      22:       b7 01 00 00 00 00 00 00 r1 = 0
  ;       for (i = 0; (i < VIRTIO_MAX_SGS) && (i < num); i++) {
      23:       7b 1a e0 ff 00 00 00 00 *(u64 *)(r10 - 32) = r1
      24:       7b 5a c0 ff 00 00 00 00 *(u64 *)(r10 - 64) = r5
Note that insn #15 has w1 = w5 and w1 is refined later but r5(w5) is
eventually saved on stack at insn #24 for later use. This cause
later verifier failures.

With this change, IndVarSimplifyPass won't do the above
transformation any more.

Differential Revision: https://reviews.llvm.org/D97479
The file was modifiedllvm/lib/Target/BPF/BPFTargetTransformInfo.h
Commit 4500f0a7321d75a061d09d92987b522e9cc09517 by zequanwu
[Clang][Attributes] Allow not_tail_called attribute to be applied to virtual function.

It would be beneficial to allow not_tail_called attribute to be applied to
virtual functions. I don't see any drawback of allowing this.

Differential Revision: https://reviews.llvm.org/D96832
The file was modifiedclang/include/clang/Basic/AttrDocs.td
The file was modifiedclang/test/SemaCXX/attr-notail.cpp
The file was modifiedclang/lib/Sema/SemaDecl.cpp
The file was modifiedclang/test/CodeGenCXX/attr-notail.cpp
Commit 00b3f2f310b4bc607563c472cd726aaaf9fcb1d4 by Adrian Prantl
Add more historic DWARF vendor extensions

The maintainer of libdwarf kindly provided this patch with a bunch of
historic DWARF extensions that are missing from Dwarf.def. This list
is helpful to avoid potential conflicts in the user-defined vendor
extension space in the future.

Patch by David Anderson!

[Relanded with an updated test.]

Differential Revision: https://reviews.llvm.org/D97242
The file was modifiedllvm/include/llvm/BinaryFormat/Dwarf.def
The file was modifiedllvm/test/ObjectYAML/MachO/DWARF5-abbrevValues.yaml
The file was modifiedllvm/include/llvm/BinaryFormat/Dwarf.h
Commit c49b600b2f8242612f60637ca9bdbc4e2b31f800 by francisvm
[Remarks] Emit remarks for "auto-init" !annotations

Using the !annotation metadata, emit remarks pointing to code added by
`-ftrivial-auto-var-init` that survived the optimizer.

Example:

```
auto-init.c:4:7: remark: Initialization inserted by -ftrivial-auto-var-init. [-Rpass-missed=annotation-remarks]
  int buf[1024];
      ^
```

The tests are testing various situations like calls/stores/other
instructions, with debug locations, and extra debug information on
purpose: more patches will come to improve the reporting to make it more
user-friendly, and these tests will show how the reporting evolves.

Differential Revision: https://reviews.llvm.org/D97405
The file was addedllvm/test/Transforms/Util/trivial-auto-var-init-store.ll
The file was modifiedllvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
The file was addedllvm/test/Transforms/Util/trivial-auto-var-init-call.ll
The file was addedllvm/test/Transforms/Util/trivial-auto-var-init-unknown.ll
Commit 4753a69a316b7705fc1b1442ad88afac059d542f by francisvm
[Remarks] Provide more information about auto-init stores

This adds support for analyzing the instruction with the !annotation
"auto-init" in order to generate a more user-friendly remark.

For now, support the store size, and whether it's atomic/volatile.

Example:

```
auto-init.c:4:7: remark: Store inserted by -ftrivial-auto-var-init.Store size: 4 bytes. [-Rpass-missed=annotation-remarks]
  int var;
      ^
```

Differential Revision: https://reviews.llvm.org/D97412
The file was addedllvm/lib/Transforms/Utils/AutoInitRemark.cpp
The file was modifiedllvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
The file was modifiedllvm/lib/Transforms/Utils/CMakeLists.txt
The file was modifiedllvm/test/Transforms/Util/trivial-auto-var-init-store.ll
The file was addedllvm/include/llvm/Transforms/Utils/AutoInitRemark.h
Commit fee9abe69c0eb5529984f5573cf6a5d881f80649 by francisvm
[Remarks] Provide more information about auto-init calls

This now analyzes calls to both intrinsics and functions.

For intrinsics, grab the ones we know and care about (mem* family) and
analyze the arguments.

For calls, use TLI to get more information about the libcalls, then
analyze the arguments if known.

```
auto-init.c:4:7: remark: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 4096 bytes. [-Rpass-missed=annotation-remarks]
  int var[1024];
      ^
```

Differential Revision: https://reviews.llvm.org/D97489
The file was modifiedllvm/test/Transforms/Util/trivial-auto-var-init-unknown.ll
The file was modifiedllvm/lib/Transforms/Utils/AutoInitRemark.cpp
The file was modifiedllvm/test/Transforms/Util/trivial-auto-var-init-call.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/AutoInitRemark.h
The file was modifiedllvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
The file was modifiedllvm/test/Other/new-pm-O0-defaults.ll
Commit 52c781f6f183c4c9f2feb11e340dc4c1f1c119e4 by llvmgnsyncbot
[gn build] Port 4753a69a316b
The file was modifiedllvm/utils/gn/secondary/llvm/lib/Transforms/Utils/BUILD.gn
Commit 24539f1ef2471d07bd87f833cb0288fc0f251f4b by jyknight
Add Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg.

And then push those change throughout LLVM.

Keep the old signature in Clang's CGBuilder for now -- that will be
updated in a follow-on patch (D97224).

The MLIR LLVM-IR dialect is not updated to support the new alignment
attribute, but preserves its existing behavior.

Differential Revision: https://reviews.llvm.org/D97223
The file was modifiedllvm/lib/IR/AutoUpgrade.cpp
The file was modifiedllvm/include/llvm/CodeGen/AtomicExpandUtils.h
The file was modifiedllvm/lib/Transforms/Instrumentation/InstrOrderFile.cpp
The file was modifiedllvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
The file was modifiedllvm/lib/CodeGen/AtomicExpandPass.cpp
The file was modifiedllvm/include/llvm/IR/IRBuilder.h
The file was modifiedllvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
The file was modifiedclang/lib/CodeGen/CGBuilder.h
The file was modifiedmlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
The file was modifiedllvm/lib/IR/Core.cpp
Commit 41751b637317bd9c97b0506ba77075694cd2d9cf by kostyak
[Clang][ASan] Correct AsanDtorKindToString to return non-void in default case

Post D96572, a warning started showing up for me:
`clang/lib/Basic/Sanitizers.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]`

So this adds a default to the case to return invalid, which seems appropriate,
and appears to correct the issue.

Differential Revision: https://reviews.llvm.org/D97496
The file was modifiedclang/lib/Basic/Sanitizers.cpp
Commit c88fedef2a5d3f4c69cc668984bb93c8889890c2 by jianzhouzh
[dfsan] Conservative solution to atomic load/store

DFSan at store does store shadow data; store app data; and at load does
load shadow data; load app data.

When an application data is atomic, one overtainting case is

thread A: load shadow
thread B: store shadow
thread B: store app
thread A: load app

If the application address had been used by other flows, thread A reads
previous shadow, causing overtainting.

The change is similar to MSan's solution.
1) enforce ordering of app load/store
2) load shadow after load app; store shadow before shadow app
3) do not track atomic store by reseting its shadow to be 0.
The last one is to address a case like this.

Thread A: load app
Thread B: store shadow
Thread A: load shadow
Thread B: store app

This approach eliminates overtainting as a trade-off between undertainting
flows via shadow data race.

Note that this change addresses only native atomic instructions, but
does not support builtin libcalls yet.
   https://llvm.org/docs/Atomics.html#libcalls-atomic

Reviewed-by: morehouse

Differential Revision: https://reviews.llvm.org/D97310
The file was modifiedllvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
The file was addedllvm/test/Instrumentation/DataFlowSanitizer/atomics.ll
The file was addedcompiler-rt/test/dfsan/atomic.cpp
Commit 91f8aacc040f5a458cfc2a10c4039e0028931455 by rprichard
[Android] Use -l:libunwind.a with --rtlib=compiler-rt

On Android, the unwinder isn't part of the C++ STL and isn't (in older
versions) exported from libc.so. Instead, the driver links the static
unwinder archive implicitly. Currently, the Android NDK implicitly
links libgcc.a to provide both builtins and the unwinder.

To support switching to compiler-rt builtins and libunwind, make
--rtlib=compiler-rt behave the same way on Android, and implicitly pass
-l:libunwind.a to the linker.

Adjust the -ldl logic. For the Android NDK, the unwinder (whether
libgcc.a or libunwind.a) is linked statically and calls a function in
the dynamic loader for finding unwind tables (e.g. dl_iterate_phdr).
On Android, this function is in libc.a for static executables and
libdl.so otherwise, so -ldl is needed. (glibc doesn't need -ldl because
its libc.so exports dl_iterate_phdr.)

Differential Revision: https://reviews.llvm.org/D96403
The file was modifiedclang/lib/Driver/ToolChain.cpp
The file was modifiedclang/lib/Driver/ToolChains/CommonArgs.cpp
Commit 6d102f15a3af0a44cf2e26677e260bee425312f3 by yhs
BPF: Add LLVMTransformUtils in CMakefile LINK_COMPONENTS

Commit 1959ead525b8 ("BPF: Implement TTI.getCmpSelInstrCost()
properly") introduced a dependency on LLVMTransformUtils
library. Let us encode this dependency explicitly in
CMakefile to avoid build error.
The file was modifiedllvm/lib/Target/BPF/CMakeLists.txt
Commit 4bbcd63eea4950c38e29f9e29b1d11b7d7894469 by i
[ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections

For one metadata section usage, each text section references a metadata section.
The metadata sections have a C identifier name to allow the runtime to collect them via `__start_/__stop_` symbols.

Since `__start_`/`__stop_` references are always present from live sections, the
C identifier name sections appear like GC roots, which means they cannot be
discarded by `ld --gc-sections`.

To make such sections GCable, either SHF_LINK_ORDER or a section group is needed.

SHF_LINK_ORDER is not suitable for the references can be inlined into other functions
(See D97430:
Function A (in the section .text.A) references its `__sancov_guard` section.
Function B inlines A (so now .text.B references `__sancov_guard` - this is invalid with the semantics of SHF_LINK_ORDER).

In the linking stage,
if `.text.A` gets discarded, and `__sancov_guard` is retained via the reference from `.text.B`,
the output will be invalid because `__sancov_guard` references the discarded `.text.A`.
LLD errors "sh_link points to discarded section".
)

A section group have size overhead, and is cumbersome when there is just one metadata section.

Add `-z start-stop-gc` to drop the "__start_/__stop_ references retain
non-SHF_LINK_ORDER non-SHF_GROUP C identifier name sections" rule.
We reserve the rights to switch the default in the future.

Reviewed By: phosek, jrtc27

Differential Revision: https://reviews.llvm.org/D96914
The file was modifiedlld/docs/ld.lld.1
The file was modifiedlld/ELF/Config.h
The file was modifiedlld/ELF/MarkLive.cpp
The file was modifiedlld/ELF/Driver.cpp
The file was modifiedlld/test/ELF/gc-sections-metadata-startstop.s
Commit d7fca3f0bf176536fc8769ad02a18884d993d7ce by craig.topper
[RISCV] Support fixed vector extract_element for FP types.
The file was modifiedllvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
Commit 9678b07e42ee4cfabbc7405441ccc8ac493df4b5 by peter
Revert 7a0da8894348, "scudo: Support memory tagging in the secondary allocator."

We measured a 2.5 seconds (17.5%) regression in Android boot time
performance with this change.
The file was modifiedcompiler-rt/lib/scudo/standalone/linux.cpp
The file was modifiedcompiler-rt/lib/scudo/standalone/secondary.h
The file was modifiedcompiler-rt/lib/scudo/standalone/primary64.h
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
The file was modifiedcompiler-rt/lib/scudo/standalone/common.h
The file was modifiedcompiler-rt/lib/scudo/standalone/tsd_exclusive.h
The file was modifiedcompiler-rt/lib/scudo/standalone/memtag.h
The file was modifiedcompiler-rt/lib/scudo/standalone/allocator_config.h
The file was modifiedcompiler-rt/lib/scudo/standalone/tests/combined_test.cpp
The file was modifiedcompiler-rt/lib/scudo/standalone/tsd_shared.h
The file was modifiedcompiler-rt/lib/scudo/standalone/combined.h
The file was modifiedcompiler-rt/lib/scudo/standalone/fuchsia.cpp
Commit c90dac27e94ec354a3e8919556ac5bc89b62c731 by justin.lebar
[clang] Print 32 candidates on the first failure, with -fshow-overloads=best.

Previously, -fshow-overloads=best always showed 4 candidates.  The
problem is, when this isn't enough, you're kind of up a creek; the only
option available is to recompile with different flags.  This can be
quite expensive!

With this change, we try to strike a compromise.  The *first* error with
more than 4 candidates will show up to 32 candidates.  All further
errors continue to show only 4 candidates.

The hope is that this way, users will have *some chance* of making
forward progress, without facing unbounded amounts of error spam.

Differential Revision: https://reviews.llvm.org/D95754
The file was modifiedclang/lib/Sema/SemaOverload.cpp
The file was modifiedclang/lib/Sema/Sema.cpp
The file was modifiedclang/test/SemaCXX/ambiguous-conversion-show-overload.cpp
The file was modifiedclang/test/SemaCXX/overloaded-builtin-operators.cpp
The file was modifiedclang/include/clang/Basic/Diagnostic.h