[NFC][TSan] Move ObtainCurrentStack out of ThreadRegistryLock scope (#228794)
ObtainCurrentStack only reads the current thread's shadow stack and
allocates a VarSizeStackTrace buffer, which does not require
ThreadRegistryLock (and already runs outside ThreadRegistryLock in
ReportRace, SignalUnsafeCall, and ReportErrnoSpoiling).
Move ObtainCurrentStack (and dummy_pc in ReportDeadlock) before
ScopedReport in ReportMutexHeldWrongContext, ReportMutexMisuse,
ReportDeadlock, and ReportDestroyLocked so the stack trace buffers also
outlive ScopedReport and OutputReport (needed by #228795).
Assisted-by: Gemini
Merge tag 'keys-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull keys fixes from Jarkko Sakkinen:
- key_get_persistent() created a new persistent keyring if one did not
exist, but failed to set a timeout on it in an error path, preventing
GC.
Call key_set_timeout() regardless of key_link() result if a
persistent keyring was created.
- __key_create_or_update() made a copy of keyring->restrict_link before
holding keyring->sem, which could cause add_key() to be executed
against stale keyring restrictions. Fix it by copying the value only
after taking keyring->sem
* tag 'keys-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
KEYS: Fix add_key() race with keyring restriction
keys: finalize persistent keyring timeout after link attempt
[flang][PPC] Implement ieee_set_flag for Linux (#224039)
This patch implements the Linux PPC specific lowering for
`ieee_set_flag`.
Calling `feraiseexcept()` may deliver `SIGFPE` when the corresponding
floating-point exception trap is enabled. To avoid this, the lowering
updates the FPSCR exception status bits directly using
`llvm.ppc.readflm` and `llvm.ppc.setflm`.
Assisted-By: IBM Bob
[libFuzzer] Stop fuzzing if no new corpus were found within a specified period (#176177)
This patch adds a new command-line option `-stale_corpus_timeout=N`
which allows you to specify that the fuzzer should exit if it hasn't
found a new corpus within a certain amount of time. It also adds to
stats how many seconds a new path has not been found. An analog of
`AFL_EXIT_ON_TIME`.
sendfile: Fix build for kernels without INET or INET6
Don't cap the new low watermark to a TCP-specific setting in kernels
without TCP.
Fixes: 6948f4d5e2b2 ("sendfile: keep the lowat hack more conservative")
zstream: Downgrade -Watomic-alignment to a warning
Don't complain about unaligned atomic operations on i386. This
same approach is already used for libspl.
[NFC][TSan] Use in-class member initializers in tsan_report.h (#228780)
Use in-class member initializers for all structs and classes in
tsan_report.h and default constructors and destructor in
tsan_report.cpp.
Assisted-by: Gemini
[NFC][mlir][tosa] Use optnone for compliance initialization under ASan (#229292)
Similar to #223586 and #226310, compiling the ~5,000-line generated
initializer in `TosaProfileCompliance::TosaProfileCompliance()` is also
very slow under AddressSanitizer.
Mark the constructor with `optnone` under `LLVM_ADDRESS_SANITIZER_BUILD`
as well to skip expensive optimization and register allocation passes.
Assisted-by: Gemini
[X86] Let RegAllocFast lower tied operands (#228968)
... so the -O0 pipeline no longer runs TwoAddressInstructionPass.
Follow-ups will enable this for all targets that don't insert passes
with the TwoAddressInstructinPassID anchor.
https://llvm-compile-time-tracker.com/compare.php?from=8ad6c581709df648a2a1e468031a81106a7e00b4&to=33ea7b07c99b9a37f72409029867c50bd1d22a52&stat=instructions:u
-O0 -g, instructions:u geomean: -0.83% (stage1) and -0.85% (stage2).
In a llvm-test-suite build, 2088 of 2563 executables have identical
.text, while 400 have few instructions in total (-0.008%). None gained
extra instructions.
With -O2 -mllvm -regalloc=fast, .text shrinks by 0.12% but the
instruction count grows by 0.09%: RegAllocFast does not convert to
three-address form, so where a tied source stays live,
`leaq 1(%rsi), %rax` becomes `movq %rsi, %rax; incq %rax`.
Test updates:
[13 lines not shown]
[alpha.webkit.NoDeleteChecker] Handle CXXStdInitializerListExpr in trivial analysis (#224723)
TrivialFunctionAnalysisVisitor had no handler for
CXXStdInitializerListExpr, so a braced list bound to a
std::initializer_list fell through to VisitStmt and was conservatively
treated as non-trivial. This made any nodelete function containing e.g.
std::min({a, b, c}) report that it "contains code that could destruct an
object".
The backing array of a std::initializer_list is a temporary whose
lifetime ends in the enclosing function, so its elements really are
destructed there. Accept the node when the array's element type is
trivially destructible and recurse into the initializers, and keep
rejecting it otherwise.
[clang] Pass only CVR array index qualifiers to ASTContext (#225582)
ArrayType stores only the CVR index qualifiers, but array declarators
may also pass `__unaligned` or `_Atomic`, so getIncompleteArrayType and
getDependentSizedArrayType insert nodes whose profile doesn't match the
lookup. Mask the qualifiers in BuildArrayType and assert in ArrayType.
Fixes #223150
Aided by Opus 5.5
[SanitizerCoverage] Don't create comdat for unnamed functions (#228959)
MergeFunctions::mergeTwoFunctions may turn identical functions into a
private unnamed function, which trips `assert(F.hasName())`. Without
assertions, all unnamed functions share an empty-name IR comdat (which
yields no ELF section group per MCContext::getELFSection).
Fix #228820: Just drop comdat for unnamed functions. SanitizerCoverage
then retains the metadata sections via `llvm.used`. It's acceptable to
have redundat metadata sections with discarded associated text sections.
Improve comments at https://reviews.llvm.org/D97430 modified code.
[ELF] Error on non-TLS definition with TLS reference (#228658)
postParse() reports an error when a TLS definition has a non-TLS
reference. Extend it to cover non-TLS definition with a TLS reference,
which GNU ld also errors.
Before LTO, a TLS definition in a bitcode module asm still has a type of
STT_NOTYPE. Exempt TLS references in this case.
RelocScan-time error checking is not useful - assemblers set STT_TLS
when a symbol is used by a TLS relocation.
[SelectionDAG] Preserve cache hint metadata during legalization (#225273)
We want to preserve cache hint metadata everywhere that alias analysis
metadata is preserved. Even if an operation is expanded during
legalization, it makes sense to preserve cache hint metadata on each
part. For example, a load with an eviction policy should get expanded
into multiple loads with the same eviction policy. In the future it
might make sense to provide a TTI hook for how to propagate the
metadata, but this is simplest for now, and usually correct.
To propagate metadata, I introduced `getNonRangeMMOMetadata`. There are
probably some cases here where range metadata can be preserved, but I
don't want to touch that. That can be done as a follow-up.
There are 3 cases where we were not preserving `AAInfo` where we are
now.
[Expand to a bitconvert of the value to the integer type of the same
size, then a (misaligned) int
[7 lines not shown]
Update former maintainers (#229276)
b2ff0e8eae8236e7555afa6026e0cf251af8c4ae updated the
OpenMPOpt/Attributor maintainers but did not add Johannes to the former
maintainers list.
[InstCombine] Fix ProfCheck for canonicalizeClampLike (#229269)
We cannot know the profile in the general case (see the added comment),
so mark the selects unknown for now. In the case that C2 is at one of
the bounds we can, but I expect this case is rare enough that handling
it explicitly doesn't make much sense.
devfs_open: do not access dsw after dev_relthread()
Noted and reviewed by: markj
Fixes: 850d4562928e ("cdevsw: add D_NONPASSABLE flag")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D60393
[flang][cuda] Reject implicit transfer of assumed-size device arrays (#229128)
An assignment in host code whose right-hand side mixes device data with
host data or constants is lowered as an implicit data transfer: each
device object is copied whole to a host temporary created from its mold,
and the expression is evaluated on the host. The size of an assumed-size
array (an assumed-size dummy or a Cray pointee declared with `(*)`) is
unknown, so the temporary cannot be created and lowering crashed with an
invalid fir.convert:
double precision :: a(*)
pointer (ip, a)
attributes(device) :: a
h = h + a(3)*2.0d0
Report a semantic error instead when such an assignment references an
assumed-size device array. Assignments that do not need an implicit
transfer are still accepted: element transfers like `h = a(3)` and
host-to-device assignments like `a(3) = h*2.0d0`.
This align flang with the reference compiler.
[lldb] Unload Wasm modules the stub no longer reports (#227814)
When a Wasm engine such as JavaScriptCore reloads a page, the modules it
ran go away and new instances take their place. LLDB kept two kinds of
stale module around.
ProcessGDBRemote::LoadModules never unloads the target's executable,
which no library list includes. A Wasm target has no executable, so
Target::GetExecutableModule falls back to the first module, and the
first module the stub ever reported stayed in the image list for good.
Let the dynamic loader say whether the process runs a main executable,
and have the Wasm loader say it does not.
A module reloaded under the same name matched the module read from
memory at its old address, and LLDB then moved that module to the new
one. That trips an assertion in ObjectFileWasm::SetLoadAddress, and
otherwise leaves a module whose image came from an instance that is
gone. A module read from memory now only matches a spec at the address
it was read from, like ModuleSpec::Matches already does for two specs.
rdar://175013476