[libc] Implement sysinfo (#217471)
Adds the public sysinfo function and tests. The internal wrapper already
existed. I decided to avoid defining `struct sysinfo` since it's a
kernel struct defined in the UAPI headers. Can revisit in future if
necessary.
Assisted-by: Automated tooling, human reviewed.
[clang][OpenMP] Fix thread count upper bound for target directives
Fix the UpperBound-computing ternary, which was inverted: std::min is
only reachable when UpperBound is 0, where it is a no-op, so any clause
with a bound to combine simply overwrites it.
Two consequences:
- A clause can raise the bound above a smaller one.
'target teams distribute parallel for thread_limit(8) num_threads(64)' gets a bound of 64.
- A non-constant clause pins the bound at 0 and discards every constant
clause after it, losing the bound entirely.
Additionally, let a construct split over separate 'target', 'teams' and
worksharing directives find its num_threads clause, so it agrees with
the combined spelling.
Note that the codegen changes in
`clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp` and
`clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp`
[5 lines not shown]
[lldb] Add MSVC STL formatter for std::expected (#217243)
Pretty-print MSVC STL `std::expected<T, E>` and `expected<void, E>`.
Engaged values show `Value`; unexpected alternatives show `Unexpected`.
The anonymous union is walked the same way as `optional` so PDB debug
info still finds `_Value` / `_Unexpected`.
Tests: generic C++23 MSVC STL coverage for engaged, unexpected, void,
and reference cases using PDB debug info.
Part of #24834
Assisted-by: Grok 4.6
Assisted-by: codex-5.6-high
---------
Co-authored-by: Bjorn Schobben <bjorn.schobben at aimsport.com>
[VPlan] Expand negated add operands as a subtract in VPSCEVExpander. (#215253)
Update VPSCEVExpander to try to expand adds of negative values as
subtract, instead of adding the negated operand. This matches IR
SCEVExpander behavior and improves expansions slightly.
It also avoids regressions when expanding more expressions.
Alive2 Proof: https://alive2.llvm.org/ce/z/Emgeqv
Depends on https://github.com/llvm/llvm-project/pull/215252
[clang][win] Fix __global_delete breaking __attribute__((used)) (#217753)
The `__empty_global_delete` fallback introduced in #209585 was marked
used via `llvm::appendToUsed()`, which creates a global named
"llvm.used" during codegen. `CodeGenModule::emitLLVMUsed()` later
unconditionally creates its own global of that same name at end-of-TU,
so the name collision renamed the latter to "llvm.used.1" -- a name LLVM
ignores. The result was that every `__attribute__((used))` global in the
TU silently lost its used semantics whenever a `__global_delete` wrapper
was emitted, letting those symbols be dropped.
Mark the fallback used via `CodeGenModule::addUsedGlobal()` instead, so
it joins the single llvm.used that `emitLLVMUsed()` emits.
`emitLLVMUsed()` runs well after `emitGlobalDeleteForwardingBodies()` in
`Release()`, so the fallback is still recorded in time.
Fixes a regression reported on #209585.
[SSAF][EntityPointerLevel] Add an intermediate data structure DeclPointerLevel
A DeclPointerLevel differs from an EntityPointerLevel only in that it
retains the AST Decl node instead of abstracting it to an Entity. The
AST node carries more information, such as types, that can be used by
extractors before converting DeclPointerLevels to EntityPointerLevels.
E.g., PointerFlowExtractor can use it to compute the upper bound on
pointer levels for an entity. It is needed for fixing the bug reported
in rdar://183529483.
First step for:
rdar://183529483
[Verifier] Diagnose local scope chains that miss their DISubprogram
DILocalScope::getSubprogram() casts every parent to DILocalScope, so a
DILexicalBlock parented to a non-local scope such as a DIFile makes the
verifier abort on that cast before visitDILexicalBlockBase can report
"invalid local scope".
[libc++][tests] Enable 'simd_unary.pass.cpp' test for Armv7 Linux targets. (#217807)
Remove test's XFAIL for the `armv7-unknown-linux-gnueabihf` target
because the ARM codegen has been fixed and does not crash with the
assert anymore.
[compiler-rt] Adjust ASan Windows tests for mingw-w64 (#216585)
Add MinGW-specific configurations to the fuse-lld and unsymbolized
tests. Use the Clang driver and GNU-compatible LLD options instead of
the MSVC-oriented lld-link invocation, and account for differences in
the resulting symbolization output.
This change was split out of
https://github.com/llvm/llvm-project/pull/209902, which adds GCC support
to the sanitizer runtimes on Windows.
---------
Co-authored-by: Hannes Domani <ssbssa at yahoo.de>
[compiler-rt] Add libbacktrace support on Windows (#216584)
Allow the libbacktrace symbolizer on non-POSIX targets when libbacktrace
is supported and does not use malloc.
For Windows runtimes built with GCC, register libbacktrace before the
DbgHelp symbolizer instead of searching for llvm-symbolizer. Keep the
existing symbolizer selection for Clang builds.
This change was split out of
https://github.com/llvm/llvm-project/pull/209902, which adds GCC support
to the sanitizer runtimes on Windows.
Co-authored-by: Hannes Domani <ssbssa at yahoo.de>
[NFC][compiler-rt] Refactor Windows IN_SECTION declarations (#216582)
This refactors all uses of __declspec(allocate()) on Windows to use an
equivalent newly defined macro, IN_SECTION. Future work
(https://github.com/llvm/llvm-project/pull/209902) will generalize
IN_SECTION to work for GNU.
Co-authored-by: Hannes Domani <ssbssa at yahoo.de>
[NFC][clang] Update the diagnostic test of unexpected token after module name (#217987)
This PR fix the diagnostic test of unexpected token after module name.
This diagnostic changed by
https://github.com/llvm/llvm-project/pull/187846.
Signed-off-by: yronglin <yronglin777 at gmail.com>