[Clang][Sema] Improve diagnostic when using imag with non complex as lvalue (#223510)
Improve the Clang diagnostic when the unary `__imag` operator with a
non-complex type operand is used as an lvalue
Issue #222383
[libc][mathvec] Fix sinf unit test failures (#224339)
Since mathvec compares directly to the scalar math result, and scalar
sinf has a specific LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT
implementation. Mathvec unit tests fail when that flag is set, as there
is currently no mathvec equivalent.
This patch disables the sinf unit tests when the
LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT flag is set until such
implementation is created.
[lldb][windows] add assert frame recognizer Windows (#224269)
This patch implements `AssertFrameRecognizer` on Windows.
Since the Windows C Runtime can be either statically or dynamically
linked, lldb can't match the module name to be able to support both.
Therefore, the matches on `abort` and `_wassert` do not check the name
of the module.
The `assert.test` test was also relaxed to check the Windows error
format (`Exception 0xc0000409`), since Windows surfaces `__fastfail` as
a `STATUS_STACK_BUFFER_OVERRUN` exception rather than a POSIX signal.
rdar://175328961
---
This relands https://github.com/llvm/llvm-project/pull/197282, reverted
in https://github.com/llvm/llvm-project/pull/198263 for two buildbot
[13 lines not shown]
Partially revert "RegisterPressure: Remove dead defs correctly"
This partially reverts the lane-mask collector change from #222627
(bde5e74309f6). That flipped the dead-def reconciliation in both
RegisterOperandsCollector::collectInstr (register units) and
collectInstrLanes (lane masks). Instead of removing units covered by a
live def from the dead def set, it removed units covered by a dead def
from the live def set.
The flip regressed targets that track subregister liveness, which use the
lane-mask collector path. When a live sub-register def overlaps a dead
super-register def, the shared register unit is flagged live on one
operand and dead on another. Removing the live def then drops the
genuinely-live unit, so the cached PressureDiff under-counts it and trips
the EXPENSIVE_CHECKS pressure cross-check in GCNSchedStrategy.
Restore the original lane-mask path while keeping the new behavior on the
register-unit path, which is enough to preserve the X86 fixes from #222627.
This is a targeted workaround. Deadness here is still taken from the operand
[7 lines not shown]
[flang][semantics] Diagnose numeric storage size on use (#220779)
Only give a warning about NUMERIC_STORAGE_UNIT when it is actually used.
Prevents warnings about it's not well defined status from popping up
when it has been excluded from or is just imported by happenstance.
[libc] Add struct group header and group line parser (#224208)
Introduce the POSIX struct group header and grp_utils parser module for
colon-delimited group records.
Unlike struct passwd, struct group carries a null-terminated char**
member pointer array (gr_mem). parse_line<struct group> handles placing
the gr_mem pointer array into the aligned scratch span directly:
* Fixed-buffer callers (such as reentrant lookups) report ERANGE if the
provided scratch span cannot hold the member pointers.
* Growable DynamicBuffer callers grow the buffer when parse_line returns
ERANGE and retry before parsing in place.
* Add struct_group header in hdr/types/struct_group.h
* Expose libc.include.grp in Linux arm and i386 headers.txt
* Add grp_utils parser and database helpers in src/grp/
* Add unit tests in test/src/grp/grp_utils_test.cpp
Assisted-by: Automated tooling, human reviewed.
[CodeGen][AArch64] Avoid duplicate hints in register allocation (#219007)
Duplicate register allocation hints cause AllocationOrder to yield
duplicate physical register candidates. For fixed-capacity eviction
advisors like MLEvictAdvisor (MaxInterferences = 32), this leads to
out-of-bounds array indexing and assertion failures.
In commit 0756e5985f0c, TargetRegisterInfo::getRegAllocationHints was
hoisted to the top of AArch64RegisterInfo::getRegAllocationHints, but
fallthrough paths invoked it a second time on an already-populated Hints
vector, duplicating copy hints for standard GPRs.
This patch:
1. Returns ConsiderOnlyHints on fallthrough in
AArch64RegisterInfo::getRegAllocationHints instead of calling
TargetRegisterInfo::getRegAllocationHints a second time.
2. In TargetRegisterInfo::getRegAllocationHints, deduplicates directly
against Hints instead of using a transient local set.
3. Adds regression test coverage for AArch64 MLRegAlloc eviction
[9 lines not shown]
[CI] Bump python dependencies (#224349)
Otherwise when we try the upgrade to ubuntu 24.04 we end up rebuilding
some packages that have native artifacts that don't have prebuilt
packages on pypi for Python 3.14. This is slow and also causes issues as
some necessary features are not enabled like the CLoader submodule of
PyYAML.
Mix bits in FileID::getHashValue() (#223794)
FileID's identity hash was fine under DenseMap's old quadratic probing,
but #200595 switched DenseMap to linear probing with backward-shift
deletion. FileID's bucket index under an identity hash is just its low
bits, so two runs of file IDs can map to the same buckets, which can
turn into a long clustered probe chain under linear probing.
Multiply by 37 to spread the low bits, which matches
SourceLocation::getHashValue(). This fixes a 2.6x compile-time
regression observed with -Wdocumentation on an ObjC++ file.
rdar://187026883
Co-authored-by: Fred Riss <friss at apple.com>
[libc] Read passwd records into a growable buffer (#224149)
Switch getpwent, getpwnam, and getpwuid to use DynamicBuffer so that
passwd records of arbitrary length are supported without fixed size
limits.
A single static DynamicBuffer and struct passwd are reused across
getpwent, getpwnam, and getpwuid per POSIX, and endpwent closes the file
stream without freeing the buffer so pointers returned prior to endpwent
remain valid.
The reentrant lookups (getpwnam_r and getpwuid_r) remain non-allocating
and return ERANGE when the caller's buffer is too small.
* Switch non-reentrant pwd lookups and iteration to DynamicBuffer
* Remove fixed 1024-byte buffer limit from pwd_utils
* Keep getpwnam_r and getpwuid_r non-allocating
* Update hermetic unit tests for long passwd records
Assisted-by: Automated tooling, human reviewed.
[libcxx][libc] Update LLVM-libc/compiler-rt config (#224160)
The config libc++ uses to build with LLVM-libc uses compiler-rt, but
previously wasn't building the compiler-rt atomic library. This PR
updates the config to tell compiler-rt to build its atomic library.
[ConstantFolding] Fold vector.partial.reduce.add constants (#212112)
This patch adds constant folding support for `llvm.vector.partial.reduce.add`.
The intrinsic leaves the grouping of input elements into result lanes
unspecified. This implementation uses the deterministic grouping
selected by
the generic lowering in `TargetLowering::expandPartialReduceMLA`: input
element `I` is accumulated into result lane `I % NumAccElts`.
Tests cover:
* Constant accumulator and input vectors
* Non-constant accumulator and input operands
* Poison and undef elements
* Different reduction ratios
* Negative values
* Integer wraparound
Fixes #211558
[BoundsSafety][NFC] Allow CountAttributedType's count to be filled in later (#223267)
Prepare CountAttributedType so its count expression can be supplied
after the node is created, which the new late-parsed counted_by
mechanism needs: the type is built when the attribute is seen, but its
argument isn't parsed until the enclosing record is complete.
- Drop the TrailingObjects coupled-decl storage in favour of an
ASTContext-allocated array held by the ArrayRef the base class already
has, so the decls can be attached after construction.
- Add CountAttributedType::setCountExpr for in-place completion.
- Add ASTContext::getIncompleteCountAttributedType (count-less, not
uniqued) and completeCountAttributedType. Incomplete nodes are not
registered in ASTContext.Types until completed, so a node abandoned with
a null count is never reachable.
No functional change: getCountAttributedType still builds a
fully-formed, count-carrying type as before.
[9 lines not shown]
[IR] Provide intrinsics for speculative loads (#179642)
Introduce two new intrinsics to enable vectorization of loops with early
exits that have potentially faulting loads.
1. `@llvm.speculative.load` - perform a load that may access memory
beyond the allocated object. It must be used in combination with
`@llvm.can.load.speculatively` to ensure the load is guaranteed to not
trap. The number of accessible bytes must be provided, either as IR value
or via an oracle function.
2. `@llvm.can.load.speculatively` - Returns true if it's safe to
speculatively load a given number of bytes from a pointer. The semantics
are target-dependent. On some targets, this may check that the access
does not cross page boundaries, or stricter checks for example on
AArch64 with MTE, which limits the access size to 16 bytes.
`@llvm.speculative.load` is lowered to a regular load in SelectionDAG
without MODereferenceable.
[15 lines not shown]
[GlobalISel] Drop poison flags by default in combiners (#218306)
GlobalISel TableGen combiners were implicitly copying poison-generating
flags from the root instruction to newly-created instructions. This is
unsafe because the replacement instruction may not preserve the same
`nuw`/`nsw` guarantees.
Drop those flags by default for combiners, while keeping explicit
`MIFlags` preservation intact.
Fixes #210470
[RISCV][P-ext] Support Packed Subvector Join (#224233)
This PR adds support for the Packed Subvector Join intrinsics:
- `__riscv_pjoin2_i8x8`
- `__riscv_pjoin2_u8x8`
- `__riscv_pjoin2_i16x4`
- `__riscv_pjoin2_u16x4`
[CIR] Report errorNYI for function signatures involving atomic types (#221371)
CIR currently has no way to represent atomic types. In most cases this
has no meaningful effect, but it can lead to incorrect argument and
return type classification during calling convention lowering. This
change adds a diagnostic when we are processing function signatures with
atomic types.
Assisted-by: Cursor / Grok 4.6
[flang][OpenACC] Attach a source location to the skipped-directive warning (#224348)
Follow-up to #223579.
Fix the source location of "compiler directive ignored: it appears
between loop levels of a collapsed or tiled loop nest" warning. Harden
`flang/test/Lower/OpenACC/acc-loop-collapse-directive-between-loops.f90`
test.
Assisted-by: AI
[CIR] Implement musttail cleanup handling (#224169)
A musttail call can occur within a cleanup scope if (and only if) the
cleanup is a lifetime end marker or a stack restore. These can be safely
omitted by a direct return such as is needed for a tail call.
This change adds error checking to verify that only these cleanups are
on the EH stack when a musttail call is encountered and updates the CFG
flattening pass to add special handling that avoids routing musttail
call returns through the cleanup handler.
Assisted-by: Cursor / claude-opus-5
WebAssembly: Partially clean up subtarget construction (#224307)
There should be just one getSubtargetImpl(Function&) override like every
other target, but this is relying on the global subtarget. Remove the
argumentless form since it's unnecessary.
WebAssemblyCoalesceFeaturesAndStripAtomics doesn't really need to
construct a full new subtarget for its purpose and can directly take the global
subtarget feature bits. This pass is also doing quite a lot of other bad things,
like mutating the TargetMachine.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[clang] Handle single-element vectors in the Swift calling convention (#223961)
Single-element vectors hit an assertion before reaching the
target-specific Swift ABI checks, even though some targets support them.
Relax the element-count assertion and scalarize single-element vectors
when they are not legal for the target ABI.
Fixes #223871.
Assisted-by: OpenAI GPT-6
[CostModel][X86] Add vXi16/vXi32 costs for smulh/umulh intrinsics (#224342)
pmulhw/pmulhuw can be used directly for vXi16 types and pmuldq/pmuludq almost directly for vXi32 types
[Clang] Fix padding clearing logic for packed boolean vectors in big endian
The memory layout of packed boolean vectors in big endian mode is quite
involved. This patch adds support for determining the occupied bits of
this type in big endian mode, so that the correct bits are cleared as
padding.