[alpha.webkit.NoDeleteChecker] Don't check base class fields in constructors (#242238)
The checker reported a constructor annotated with webkit.nodelete when
any field of its class, or of any of its base classes, has a default
constructor that is not known to be trivial. Neither base class fields
nor fields of a delegating constructor are constructed by the
constructor being checked:
struct Observer {
[[clang::annotate("webkit.nodelete")]] explicit Observer(int*);
WeakPtr<Context> m_context;
};
struct ActiveObject : Observer {
[[clang::annotate("webkit.nodelete")]] explicit ActiveObject(int* p)
: ActiveObject(p, Checked) { }
...
[[clang::annotate("webkit.nodelete")]] ActiveObject(int* p, CheckedType)
: Observer(p) { }
[19 lines not shown]
[lldb] Bound register writes from Mach-O process metadata (#239787)
RegisterContextUnifiedCore sized its register buffer by summing the
metadata register sizes into a uint32_t, then wrote the register values
without a bounds check. Sizes whose sum wraps around leave the buffer
smaller than the values written into it.
Grow the buffer as each value is written instead. Also reject register
entries that aren't dictionaries.
rdar://187065217
Assisted-by: Claude
[clangd] Omit C++ access specifiers from C hovers (#239877)
This PR addresses the access-specifier portion of clangd/clangd#2700.
Hovering over a C struct member currently shows C++ syntax such as
`public: int location`.
Only populate `HoverInfo::AccessSpecifier` in C++ mode so C hovers
show `int location` while preserving C++ access labels.
The issue discusses `::` in the `// In ...` scope annotation,
but the discussion leaves open whether that notation should change.
This PR addresses only the access-specifier behavior and
leaves scope formatting unchanged.
Validation:
- Added regression coverage for ordinary C structs, anonymous nested
C structs, and a C++ control case.
- All 37 `Hover.*` tests passed after rebasing and rebuilding.
[2 lines not shown]
[Verifier] Verify attributes for oracle-function in visitFunctionAttrs (#242063)
The behavior before this patch seems to be a historical artifact.
Function attributes/signature are a property of the function and should
be validated there rather than during their use inside of
llvm.speculative.load.
Assisted-By: LLM
[SPARC] Keep the %o7 restore in the delay slot of leaf tail calls (#242281)
The return address is restored in the delay slot of a tail call in a
leaf function. With the post-RA scheduler enabled another instruction
might be moved into that slot, and the restore could happen before the
call which causes %o7 to get overwritten. To prevent that, mark it as
FrameDestroy, and check for it in isSchedulingBoundary().
Assisted-by: Claude
[libc] Make alloca visible from stdlib.h (#241695)
Let `<stdlib.h>` also declare `alloca`. Some code assumes that it'll
be exposed through `<stdlib.h>` header, plus `<alloca.h>` is not
a standard header anyway and is missing on some platforms (e.g.
on BSD systems). Use YAML fragments, similar to what we do
for non-standard `<malloc.h>` header on GNU systems.
AI disclosure: this patch was written with Claude Code. I reviewed the
change and built it in a full build, and the include and header tests
pass
Assisted-by: Claude
[Clang][analyzer][NFC] Re-enable const variable redeclaration test (#241705)
`Analysis/redecl.c` already produces the expected `TRUE` result, but its
`-verify` run fails on an unannotated `'extern' variable has an
initializer` warning. Add the missing `expected-warning` and remove
`XFAIL: *`, retaining the original input and the existing `TRUE` check.
The test was added by 850361f6c1db6bd8a85b65a8c56e0e097eaa0635 (D46421,
April 23, 2019), which also changed the constant-variable lookup in
`RegionStoreManager::getBindingForVar` from `getInit()` to
`getAnyInitializer()`. Native X86 Release builds with assertions enabled
confirm the behavior change at that commit: its parent
330bc8af131c5b42efe120dbf70f47881d02d3a3 reports both `FALSE` and
`TRUE`, while the commit reports only `TRUE`. Both still emit the
extern-initializer warning, so the original test remains XFAIL even
after the analysis result is corrected.
This change annotates the warning and removes the XFAIL marker, allowing
the test to run normally again.
Prepared with assistance from Codex.
[libc] Have sys/time.h import certain symbols from sys/select.h (#241696)
Per https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_time.h.html,
`sys/time.h` should provide certain macro, types, and functions
that are also declared in `sys/select.h`. Use existing YAML fragment
machinery to support this.
Some programs like procps relies on it.
AI disclosure: this patch was written with Claude Code. I reviewed the
change and built it in a full build, and the include and header tests
pass
Assisted-by: Claude
[SPARC][Driver] Add -m(no-)app-regs flags (#242193)
Add GCC's -mapp-regs and -mno-app-regs. -mno-app-regs reserves the
application registers G2, G3 and G4, the same as passing -ffixed-g2
-ffixed-g3 -ffixed-g4. -mapp-regs is the default.
Fixes #18525
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Have netdb.h carry netinet/in.h (#241697)
See https://pubs.opengroup.org/onlinepubs/9799919799/ - which
states that `Inclusion of the <netdb.h> header may also make
visible all symbols from <netinet/in.h>`.
AI disclosure: this patch was written with Claude Code. I reviewed the
change and built it in a full build, and the include and header tests
pass
Assisted-by: Claude
IR: Answer mayHaveSideEffects with one switch
Previously this emitted 3 calls, each switching over the opcodes. Fold
to one which only needs to query attributes for calls.
CTMark instructions:u: O3 -0.13%, ThinLTO -0.17%.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[InstCombine] Simplify log(exp10(y)) to y * log(10) (#239581)
Updated `LibCallSimplifier::optimizeLog` to recognize the `llvm.exp10`
intrinsic while folding:
```
log(exp10(y)) -> y * log(10)
```
Changes:
- Updated the if statement to check the arguments for the intrinsic and
removed the "TODO" comment at the top of the statement
- Added two tests in `llvm/test/Transforms/InstCombine/log-pow.ll`:
* log_exp10_intrinsic
* log_exp10_intrinsic_not_fast (a negative test to ensure the transform
works only if the exp10 intrinsic has the fast flag)
Closes #226865
[llvm-strings] Call xcrun instead of relying on preset variables (#242580)
Suggested by llvm-beanz as some CMake setups will not pre-set those
variables.
DAG: Look through fp_extend/fp_round when folding bitcast of fcopysign
visitFCOPYSIGN strips these from the sign operand, but the bitcast may be
visited first, leaving the conversion live in the integer form. Strip it
in the fold too, so the result does not depend on visitation order.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DAG: Use shl of any_extend to place the sign bit when folding bitcast of fcopysign
When the sign operand is narrower than the result, only its sign bit is
used. Move it into place with a shift of an any_extend instead of a
sign_extend.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
fix: arith.maxui had incorrect bounds if one operand is negative (#238048)
Value bounds for `arith.maxui(-1, 2)` said it's `>= 2` which is wrong,
because it's actually `-1`.
DAG: Use shl of any_extend to place the sign bit when folding bitcast of fcopysign
When the sign operand is narrower than the result, only its sign bit is
used. Move it into place with a shift of an any_extend instead of a
sign_extend.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang][AST] Don't give `ObjCProtocolLoc` pointer identity in `DynTypedNode` (#237451)
`DynTypedNode` has stored `ObjCProtocolLoc` by value since the node was
added in 805f7a4fa4ce, but `NKI_ObjCProtocolLoc` was placed after
`NKI_LastKindWithoutPointerIdentity`, so `hasPointerIdentity()` returned
true for it. `getMemoizationData()` then returned (by chance?) the
stored `ObjCProtocolDecl` pointer. As a result, two references to the
same protocol at different locations compared equal through
`DynTypedNode`. This caused `ASTContext::getParents()` to behave
incorrectly.
This commit changes `ObjCProtocolLoc` to be considered as not having
pointer identity. Subsequently, we handle `ObjCProtocolLoc` in
`DynTypedNode::operator<`, `operator==` and `getHashValue`, using both
the protocol pointer and the source location.
To catch this class of mismatch at compile time, this commit also
introduces a `static_assert` to check that how it stores the node
matches `hasPointerIdentity()` for the node kind.
[clang] Remove unused declarations in CGDebugInfo (NFC) (#239487)
SaveAndRestoreLocation: The class was removed on January 14, 2015 in
commit 66e4197f07f6a3fe178f2b220fce62a1889b5fe6, leaving its friend
declaration in CGDebugInfo dangling.
CGDebugInfo::OCLNDRangeDITy: The last use was removed on February 16,
2017 in commit 58984e7087bc530ac2fae06b3ef15a4f1bc118f9.
CGDebugInfo::Int8_4PackedTy and CGDebugInfo::UInt8_4PackedTy: These
fields were added via HLSLPackedTypes.def on September 30, 2026 in
commit 9488c46651de0fbec038e6b8578c1e651d89e576 without any uses.
Note that CGDebugInfo becomes fully defined in CGDebugInfo.cpp once we
remove the friend declaration for SaveAndRestoreLocation. That in turn
causes -Wunused-private-field to diagnose the unused private fields
removed here.
Assisted-by: Antigravity
[MachineLICM] Track peak register pressure when hoisting
The pressure check in MachineLICM only looks at the estimates saved in
BackTrace. These record pressure at block boundaries, so they can miss an
earlier peak in the current BB or an ancestor BB. If pressure falls before the
candidate, the check can allow it to move even though its def then needs to stay
live across that earlier peak. This can push pressure beyond the limit and cause
spills.
This PR adds PeakPressure alongside RegPressure and saves the previous peak with
the existing boundary estimate in BackTrace. The pressure check considers the
current BB's peak and both saved estimates. Normal hoists adjust the current and
saved peaks, and scope exit restores the previous peak. Preheader scanning skips
peak updates and seeds the starting pressure from its final estimate.
Fixes LCOMPILER-3233.
This PR was assisted by AI but I reviewed all the changes.
[CodeGen] Honor -stress-regalloc in register pressure limits
RegisterClassInfo clips each allocation order for -stress-regalloc, but
computePSetLimit treats the removed entries as reserved registers. On
AMDGPU, their weight can exceed the target limit, so the underflow guard
returns the target limit and loses the stress restriction.
Use the weighted allocatable register count for the stress limit, bounded
by the target limit. Keep the normal calculation and zero-allocation
fallback.
Add a MIR test where hoisting a COPY needs a seventh VGPR unit. A stress
limit of six keeps it in the loop, while a limit of eight and the
unrestricted limit allow it. Update the affected AMDGPU stress test.
Validation: all 50 stress-regalloc tests pass with MachineLICM unchanged.
The new MIR test fails without the pressure-limit fix.
This PR was assisted by AI.
[sanitizer] Use clock_nanosleep_time64 for 32-bit Linux delays (#241663)
internal_usleep passes libc's struct timespec directly to the nanosleep
syscall. On 32-bit Linux with time64 musl, that structure does not match
the legacy syscall layout.
Use clock_nanosleep_time64 when its syscall number is available, with
explicit 64-bit seconds and nanoseconds.
clock_nanosleep_time64 was introduced in Linux 5.1. On older kernels,
ENOSYS triggers a DCHECK in debug builds.
OpenMP: Use getOrInsertFunction init callback for runtime functions (#242564)
Use the new overload to set up the function on first use. The
MD_callback check is dropped since a newly created function will never
have metadata.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>