SuccessChanges

Summary

  1. [sanitizer] Test HWASan + LAM via QEMU. (details)
Commit fccedba38905acda3d156ca84758de85e36538c3 by mascasa
[sanitizer] Test HWASan + LAM via QEMU.

Uses LAM-enabled full system QEMU emulation to test HWASan's LAM
support.

Depends on:
https://github.com/google/sanitizers/pull/1408
https://github.com/google/sanitizers/pull/1410

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D103296
The file was modifiedzorg/buildbot/builders/sanitizers/buildbot_qemu.sh (diff)

Summary

  1. [coro async] Add the swiftasync attribute to the resume partial function (details)
  2. [lld/mac] Address review feedback and improve a comment (details)
  3. [LoopStrengthReduce] Ensure that debug intrinsics do not affect LSR's output (details)
  4. [lld/mac] Don't strip explicit dylib also mentioned in LC_LINKER_OPTION (details)
  5. [lld/mac] Implement -needed_framework, -needed_library, -needed-l (details)
  6. [lld/mac] Implement -dead_strip (details)
  7. [OpenMP] Use new task type/flag for taskwait depend events. (details)
  8. [lld/mac] try to fix tests after a5645513dba (details)
  9. [libcxx][NFC] Tidy up calculation of __nbuf in num_put::do_put, and add comments (details)
  10. [OpenMP] Fix improper printf format specifier (details)
  11. Remove redundant comparisons (NFC) (details)
  12. Add missing CMake dependency for mlir/lib/Reducer (NFC) (details)
  13. Fix CMake error: TableGen targets must be in the DEPENDS list instead of LINK_LIBS (details)
  14. [x86] add test for sext-of-setcc; NFC (details)
  15. [SDAG] allow more cast folding for vector sext-of-setcc (details)
  16. [lldb] Preserve type sugar when using SBValue::Dereference on C++ references (details)
  17. [MLIR] Fix Standalone dialect test to work in out-of-tree builds (details)
  18. Add matchers for gtest's ASSERT_THAT, EXPECT_THAT, ON_CALL and EXPECT_CALL (details)
  19. Fix -Wsign-compare warning (NFC) (details)
  20. Improve performance when parsing symbol tables in mach-o files. (details)
  21. [SampleFDO] New hierarchical discriminator for FS SampleFDO (ProfileData part) (details)
  22. [mlir-lsp] Report range of potential identifier starting at location of diagnostic (details)
Commit f1a0c5d67ca9600d3a08d1d81ad1da9b75a60138 by aschwaighofer
[coro async] Add the swiftasync attribute to the resume partial function

Transfer the swiftasync attribute to the resume partial function according to
suspend.async specification. It's first argument denotes which argument is the
async context.

rdar://71499498

Differential Revision: https://reviews.llvm.org/D103285
The file was modifiedllvm/lib/Transforms/Coroutines/CoroSplit.cpp
The file was modifiedllvm/test/Transforms/Coroutines/coro-async.ll
Commit 476e4d65d482d75f789db092316327191f18dbcd by thakis
[lld/mac] Address review feedback and improve a comment

I forgot to move the message() call around as requested in D103428
before committing that change. Move it now.

Also, improve the ordinal uniq'ing comment. I hadn't realized that the
distinct-but-identical files happen with --reproduce and not in general.

No behavior change.

Differential Revision: https://reviews.llvm.org/D103522
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/MachO/DriverUtils.cpp
The file was modifiedlld/MachO/Writer.cpp
Commit 4316b0e59cfa4b65ce59f055ba271519679f9750 by stephen.tozer
[LoopStrengthReduce] Ensure that debug intrinsics do not affect LSR's output

During Loop Strength Reduce, if the terminating condition for the loop
is not immediately adjacent to the terminating branch and it has more
than one use, a clone of the condition will be created just before the
terminating branch and will be used as the branch condition. Currently,
whether the instructions are "immediately adjacent" is determined by
checking whether the next instruction after the condition is the
terminating branch; this is incorrect however, as the presence of a
debug intrinsic between the two will result in a change to the output.
This is fixed by using getNextNonDebugInstruction() instead.

Differential Revision: https://reviews.llvm.org/D103033
The file was addedllvm/test/Transforms/LoopStrengthReduce/X86/lsr-cond-dbg.ll
The file was modifiedllvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Commit e14fd7d8797b7a6c5ceb8a8dc832161a1c90c08e by thakis
[lld/mac] Don't strip explicit dylib also mentioned in LC_LINKER_OPTION

Noticed by Jez in D103499.

Differential Revision: https://reviews.llvm.org/D103521
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/test/MachO/dead-strip-dylibs.s
Commit 66a1ecd2cf905d6119477516601126f44be297a8 by thakis
[lld/mac] Implement -needed_framework, -needed_library, -needed-l

These allow overriding dead_strip_dylibs.

Differential Revision: https://reviews.llvm.org/D103499
The file was modifiedlld/MachO/InputFiles.h
The file was modifiedlld/MachO/Writer.cpp
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/MachO/Options.td
The file was modifiedlld/test/MachO/dead-strip-dylibs.s
Commit a5645513dba702216672bc31333e9c173b3a56c5 by thakis
[lld/mac] Implement -dead_strip

Also adds support for live_support sections, no_dead_strip sections,
.no_dead_strip symbols.

Chromium Framework 345MB unstripped -> 250MB stripped
(vs 290MB unstripped -> 236M stripped with ld64).

Doing dead stripping is a bit faster than not, because so much less
data needs to be processed:

    % ministat lld_*
    x lld_nostrip.txt
    + lld_strip.txt
        N           Min           Max        Median           Avg        Stddev
    x  10      3.929414       4.07692     4.0269079     4.0089678   0.044214794
    +  10     3.8129408     3.9025559     3.8670411     3.8642573   0.024779651
    Difference at 95.0% confidence
            -0.144711 +/- 0.0336749
            -3.60967% +/- 0.839989%
            (Student's t, pooled s = 0.0358398)

This interacts with many parts of the linker. I tried to add test coverage
for all added `isLive()` checks, so that some test will fail if any of them
is removed. I checked that the test expectations for the most part match
ld64's behavior (except for live-support-iterations.s, see the comment
in the test). Interacts with:
- debug info
- export tries
- import opcodes
- flags like -exported_symbol(s_list)
- -U / dynamic_lookup
- mod_init_funcs, mod_term_funcs
- weak symbol handling
- unwind info
- stubs
- map files
- -sectcreate
- undefined, dylib, common, defined (both absolute and normal) symbols

It's possible it interacts with more features I didn't think of,
of course.

I also did some manual testing:
- check-llvm check-clang check-lld work with lld with this patch
  as host linker and -dead_strip enabled
- Chromium still starts
- Chromium's base_unittests still pass, including unwind tests

Implemenation-wise, this is InputSection-based, so it'll work for
object files with .subsections_via_symbols (which includes all
object files generated by clang). I first based this on the COFF
implementation, but later realized that things are more similar to ELF.
I think it'd be good to refactor MarkLive.cpp to look more like the ELF
part at some point, but I'd like to get a working state checked in first.

Mechanical parts:
- Rename canOmitFromOutput to wasCoalesced (no behavior change)
  since it really is for weak coalesced symbols
- Add noDeadStrip to Defined, corresponding to N_NO_DEAD_STRIP
  (`.no_dead_strip` in asm)

Fixes PR49276.

Differential Revision: https://reviews.llvm.org/D103324
The file was addedlld/MachO/MarkLive.cpp
The file was modifiedlld/MachO/SymbolTable.cpp
The file was modifiedlld/MachO/SyntheticSections.cpp
The file was modifiedlld/MachO/ConcatOutputSection.cpp
The file was modifiedlld/MachO/CMakeLists.txt
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/test/MachO/sectcreate.s
The file was modifiedlld/MachO/InputSection.h
The file was modifiedlld/test/MachO/mh-header-link.s
The file was modifiedlld/MachO/Config.h
The file was addedlld/test/MachO/dead-strip.s
The file was modifiedlld/MachO/Writer.cpp
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/MachO/Symbols.cpp
The file was modifiedlld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libc++abi.tbd
The file was modifiedlld/MachO/UnwindInfoSection.h
The file was addedlld/MachO/MarkLive.h
The file was modifiedlld/MachO/Symbols.h
The file was modifiedlld/MachO/UnwindInfoSection.cpp
The file was modifiedlld/MachO/MapFile.cpp
The file was modifiedlld/MachO/SyntheticSections.h
The file was modifiedllvm/utils/gn/secondary/lld/MachO/BUILD.gn
The file was modifiedlld/MachO/Options.td
The file was modifiedlld/MachO/SymbolTable.h
Commit 7ba4e96ede0fdc73a9d12e42e51f81589213f7a2 by hansang.bae
[OpenMP] Use new task type/flag for taskwait depend events.

Differential Revision: https://reviews.llvm.org/D103464
The file was modifiedopenmp/runtime/test/ompt/callback.h
The file was modifiedopenmp/runtime/src/kmp_taskdeps.cpp
The file was modifiedopenmp/runtime/test/ompt/tasks/task_if0-depend.c
Commit 5ecfdb51230c55f987bff86c52c7e57adb0eae4f by thakis
[lld/mac] try to fix tests after a5645513dba

My linux system doesn't like the `grep` for some reason,
but FileCheck seems to work.
The file was modifiedlld/test/MachO/dead-strip.s
Commit 06e047227d71b2c1c477e280172abed0f1eed2c8 by Abhina.Sreeskantharajan
[libcxx][NFC] Tidy up calculation of __nbuf in num_put::do_put, and add comments

In 07ef8e679621 and 3ed9f6ebdeeb, `__nbuf` started to diverge from the amount
of space that was actually needed for the buffer. For 32-bit longs for example,
we allocate a buffer that is one larger than needed. Moreover, it is no longer
clear exactly where the extra +1 or +2 comes from - they're just numbers pulled
from thin air. This PR cleans up how `__nbuf` is calculated, and adds comments
to further clarify where each part comes from.

Specifically, it corrects the underestimation of the max size buffer needed
that the above two commits had to compensate for. The root cause looks to be
the use of signed type parameters to numeric_limits<>::digits. Since digits
only counts non-sign bits, the calculation was acting as though (for a signed
64-bit type) the longest value we would print was 2^63 in octal. However,
printing in octal treats values as unsigned, so it is actually 2^64. Thus,
using unsigned types and changing the final +2 to a +1 is probably a better
option.

Reviewed By: #libc, ldionne, Mordante

Differential Revision: https://reviews.llvm.org/D103339
The file was modifiedlibcxx/include/locale
Commit f7655f3df394d90a340dc09465fbb752bef4bae6 by jonathan.l.peyton
[OpenMP] Fix improper printf format specifier
The file was modifiedopenmp/runtime/src/ompt-general.cpp
Commit fcfaed4ae6d718ebfe18eef7f5ddbef2a23ef413 by Adrian Prantl
Remove redundant comparisons (NFC)
The file was modifiedllvm/lib/IR/DebugInfo.cpp
Commit e598ab1c06dd663535f69a1a52116df1ca9024f4 by joker.eph
Add missing CMake dependency for mlir/lib/Reducer (NFC)

The `OptReductionPass.cpp` file depends on the TableGen generated
`mlir/Reducer/Passes.h.inc` file.
The file was modifiedmlir/lib/Reducer/CMakeLists.txt
Commit 90f207a781518e6210d3c99ab35d7dfc8f84a292 by joker.eph
Fix CMake error: TableGen targets must be in the DEPENDS list instead of LINK_LIBS
The file was modifiedmlir/lib/Reducer/CMakeLists.txt
Commit 8349ac9aa944525e2da5ebd4c7a09b9a98aab0eb by spatel
[x86] add test for sext-of-setcc; NFC

D103462
The file was modifiedllvm/test/CodeGen/X86/sext-vsetcc.ll
Commit ede3982792dfc6c00a4f185f88ce0e799e2545af by spatel
[SDAG] allow more cast folding for vector sext-of-setcc

This is a follow-up to D103280 that eases the use restrictions,
so we can handle the motivating case from:
https://llvm.org/PR50055

The loop code is adapted from similar use checks in
ExtendUsesToFormExtLoad() and SliceUpLoad(). I did not see an
easier way to filter out non-chain uses of load values.

Differential Revision: https://reviews.llvm.org/D103462
The file was modifiedllvm/test/CodeGen/X86/sext-vsetcc.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit 0ec761c3fc2a4bf8319c6eb38e46f9a201b79141 by Raphael Isemann
[lldb] Preserve type sugar when using SBValue::Dereference on C++ references

When checking for type properties we usually want to strip all kind of type
sugar from the type. For example, sugar like Clang's ElaboratedType or typedefs
rarely influence the fundamental behaviour of a type such as its byte size.

However we always need to preserve type sugar for everything else as it does
matter for users that their variable of type `size_t` instead of `unsigned long`
for example.

This patch fixes one such bug when trying to use the SBValue API to dereference
a type.

Reviewed By: werat, shafik

Differential Revision: https://reviews.llvm.org/D103532
The file was addedlldb/test/API/lang/cpp/dereferencing_references/Makefile
The file was addedlldb/test/API/lang/cpp/dereferencing_references/main.cpp
The file was modifiedlldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
The file was addedlldb/test/API/lang/cpp/dereferencing_references/TestCPPDereferencingReferences.py
Commit b532455ac7038bfb59b858a1bbcb6d2941f5dbcc by joker.eph
[MLIR] Fix Standalone dialect test to work in out-of-tree builds

When LLVM and MLIR are built as subprojects (via add_subdirectory),
the CMake configuration that indicates where the MLIR libraries are is
not necessarily in the same cmake/ directory as LLVM's configuration.
This patch removes that assumption about where MLIRConfig.cmake is
located.

(As an additional none, the %llvm_lib_dir substitution was never
defined, and so find_package(MLIR) in the build was succeeding for
other reasons.)

Reviewed By: stephenneuendorffer

Differential Revision: https://reviews.llvm.org/D103276
The file was modifiedmlir/test/CMakeLists.txt
The file was modifiedmlir/test/lit.site.cfg.py.in
The file was modifiedmlir/test/Examples/standalone/test.toy
The file was modifiedmlir/test/Examples/standalone/lit.local.cfg
Commit d0e159334f9d1285ec35cf71465358c47141618c by yitzhakm
Add matchers for gtest's ASSERT_THAT, EXPECT_THAT, ON_CALL and EXPECT_CALL

This patch adds support for matching gtest's ASSERT_THAT, EXPECT_THAT, ON_CALL and EXPECT_CALL macros.

Reviewed By: ymandel, hokein

Differential Revision: https://reviews.llvm.org/D103195
The file was modifiedclang/unittests/ASTMatchers/GtestMatchersTest.cpp
The file was modifiedclang/lib/ASTMatchers/GtestMatchers.cpp
The file was modifiedclang/include/clang/ASTMatchers/GtestMatchers.h
Commit 8c948b18e9d899a36e819a282ce60f196ab73376 by joker.eph
Fix -Wsign-compare warning (NFC)
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
Commit b0572abf72fd4aafbb56bc41350e41bdfd96cdde by gclayton
Improve performance when parsing symbol tables in mach-o files.

Some larger projects were loading quite slowly with the current LLDB on macOS and macOS simulator builds. I did some instrument traces and found 3 main culprits:
- a LLDB timer that was put into a function that was called too often
- a std::set that was keeping track of the address of symbols that were already added
- a unnamed function generator in ObjectFile that was going slow due to allocations

In order to see this in action I ran the latest LLDB on a large application with many frameworks using the following method:

(lldb) script import time; start_time = time.perf_counter()
(lldb) file Large.app
(lldb) script print(time.perf_counter() - start_time)

I first range "sudo purge" to clear the system file caches to simulate a cold startup of the debugger, followed by two iterations with warm file caches.

Prior to this fix I was seeing the following timings:

17.68 (cold)
14.56 (warm 1)
14.52 (warm 2)

After this fix I was seeing:

11.32 (cold)
8.43 (warm 1)
8.49 (warm 2)

Differential Revision: https://reviews.llvm.org/D103504
The file was modifiedlldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
The file was modifiedlldb/source/Symbol/ObjectFile.cpp
The file was modifiedlldb/source/Core/Module.cpp
Commit 6745ffe4fa1c35778f88cffd671b7a7a936fb4d9 by xur
[SampleFDO] New hierarchical discriminator for FS SampleFDO (ProfileData part)

This patch was split from https://reviews.llvm.org/D102246
[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO
This is mainly for ProfileData part of change. It will load
FS Profile when such profile is detected. For an extbinary format profile,
create_llvm_prof tool will add a flag to profile summary section.
For other format profiles, the users need to use an internal option
(-profile-isfs) to tell the compiler that the profile uses FS discriminators.

This patch also simplified the bit API used by FS discriminators.

Differential Revision: https://reviews.llvm.org/D103041
The file was addedllvm/test/Transforms/SampleProfile/Inputs/fsafdo.extbinary.afdo
The file was modifiedllvm/lib/Target/X86/X86InsertPrefetch.cpp
The file was modifiedllvm/lib/ProfileData/SampleProfReader.cpp
The file was modifiedllvm/include/llvm/CodeGen/MIRFSDiscriminator.h
The file was modifiedllvm/include/llvm/ProfileData/SampleProfReader.h
The file was modifiedllvm/include/llvm/Support/Discriminator.h
The file was modifiedllvm/unittests/ProfileData/SampleProfTest.cpp
The file was modifiedllvm/include/llvm/CodeGen/Passes.h
The file was modifiedllvm/lib/CodeGen/MIRFSDiscriminator.cpp
The file was modifiedllvm/lib/ProfileData/SampleProf.cpp
The file was modifiedllvm/include/llvm/ProfileData/SampleProf.h
The file was modifiedllvm/lib/ProfileData/SampleProfWriter.cpp
The file was addedllvm/test/Transforms/SampleProfile/Inputs/fsafdo.prof
The file was addedllvm/test/Transforms/SampleProfile/fsafdo_test.ll
The file was modifiedllvm/include/llvm/IR/DebugInfoMetadata.h
The file was modifiedllvm/lib/CodeGen/TargetPassConfig.cpp
The file was modifiedllvm/lib/Transforms/IPO/SampleProfile.cpp
Commit 644f722b369d9d7e0bef3694d11c48d7d333d36a by jpienaar
[mlir-lsp] Report range of potential identifier starting at location of diagnostic

Currently the diagnostics reports the file:line:col, but some LSP
frontends require a non-empty range. Report either the range of an
identifier that starts at location, or a range of 1. Expose the id
location to range helper and reuse here.

Differential Revision: https://reviews.llvm.org/D103482
The file was modifiedmlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
The file was modifiedmlir/test/mlir-lsp-server/diagnostics.test
The file was modifiedmlir/include/mlir/Parser/AsmParserState.h
The file was modifiedmlir/lib/Parser/AsmParserState.cpp