[X86] madd.ll - add additional tests for matchPMADDWD folds that fail with larger source types (#205362)
matchPMADDWD handles sext/shl cases as well which don't fold either on SSE/AVX512 targets
[libc++][ranges] Backport P2711R1: Making multi-param constructors of views explicit (#190513)
As discussed in https://gcc.gnu.org/PR114298 - GCC and MSVC STL
implemented P2711R1 as a DR. This PR does the same for libc++.
Co-authored-by: A. Jiang <de34 at live.cn>
[docs] Fix typo in Docker.rst (#205346)
Small typo fix in the Docker documentation: Debian8 -> Debian12.
Signed-off-by: Felipe Novais <contact at felipenovais.com>
[clangd] fix preprocessor caching-lexer state tracking (#203716)
Fix `recomputeCurLexerKind` to avoid default fallback to
`CurLexerCallback = CLK_CachingLexer;`.
This prevents code-completion EOF handling from accidentally restoring
CLK_CachingLexer while a tentative parse is still active, which could
trigger a caching lexer re-entry assertion in clangd signature help.
Fixes https://github.com/llvm/llvm-project/issues/200677
---------
Signed-off-by: yronglin <yronglin777 at gmail.com>
[LegalizeTypes] Fix incorrect EVL1 clip in SplitVecRes_VP_SPLICE. (#205021)
We were incorrectly clipping EVL1 to be a valid index for the VT, in the
range [0, VT.getNumVectorElements() - 1]. It is legal for EVL1 to be
equal to VT.getNumVectorElements() here so that was incorrect.
In case it isn't clear, the clip is necessary to prevent turning poison
into UB by accessing outside the temporary stack object.
[RISCV][P-ext] Add mvd alias for padd.dw rd, zero, rs. Use for copy idiom. (#205223)
See https://github.com/riscv/riscv-p-spec/pull/304
I've refactored the MoveMerge code to use copyPhysReg to avoid duplication.
[clang][Dependency Scanning] Fix the Input File for By-Name Lookup's Input CC1 Command Line (#205214)
When the command line is a CC1 command, the scanner does not append the
fake input file to the command line when initializing the compiler
instance. This PR fixes that by passing the compiler instance
initialization the correct modified command line. Without specifying the
fake input file, clang picks up `-` as its input.
An observable behavior is that the diagnostics are pointing to incorrect
files for cc1 commands, hence a test is added to check the diagnostics
messages contain the correct file name.
Reland "[libc] Implement basename and dirname in libgen.h #204554" (#205352)
Added the POSIX standard functions basename and dirname under a new libgen.h header. The implementations modify the input path in-place using cpp::string_view to determine boundaries safely.
Added find_last_not_of to cpp::string_view to support trailing slash removal.
Implemented:
libc/include/libgen.yaml, libgen.h.def: Public API definitions.
libc/src/libgen/basename.cpp, dirname.cpp: Generic implementations.
libc/test/src/libgen/: Unit and hermetic tests.
Registered the new entrypoints for all active Linux targets (x86_64, aarch64, arm, riscv) and added docgen configuration.
The tests are skipped when using ASan because death tests do not currently work with them.
Assisted-by: Automated tooling, human reviewed.
[mlir][arith] Reject signful integer element types in `arith.constant` (#204937)
Update arith.constant verification to reject integer constants with
signed and unsigned element types including shaped constants like
tensors and vectors, as the arith dialect does not support
signed/unsigned types.
This incidentally address cases where further lowering would crash (e.g.
SPIR-V constant lowering used IntegerAttr::getInt() on an unsigned
integer attribute from tensor<2xui8>)
Fixes #204911
[Hexagon] Add KCFI support for forward-edge control flow integrity (#191746)
Add KCFI support for Hexagon. KCFI provides lightweight forward-edge CFI
for indirect calls by embedding a type hash before each function and
checking it before indirect calls, without requiring LTO.
[clang] Avoid per-builtin std::string allocation in initializeBuiltins (#205162)
`initializeBuiltins()` previously registered every builtin through an
allocated std::string every time a `CompilerInstance` initialized. This
was hot for module-heavy builds, where each built module re-registered
the full set.
Add `getBuiltinNameInto()`, which writes the name into a caller-provided
buffer and returns a `StringRef`, with no allocation when the shard has
no prefix (the common case). `Info::getName` now delegates to it so the
two cannot diverge. This change is output behavior-preserving.
Resolves: rdar://178672190
[clang] Update C++ DR status page (#205342)
The post-Brno draft will not be out for three more weeks, but Brno
updates for Core issues statuses are already trickling in.
Notably, [CWG507](https://cplusplus.github.io/CWG/issues/507.html)
"Ambiguity with built-in binary operator candidates for class object
convertible to built-in type", which used to be marked as a duplicate of
[CWG260](https://cplusplus.github.io/CWG/issues/260.html) "User-defined
conversions and built-in `operator=`", is open again, presumably because
it contains an example that goes beyond the scope of CWG260. Relatively
recent CWG thread that might be related (WG21 access required):
[link](https://lists.isocpp.org/core/2025/08/18478.php).
[orc-rt] Add ORC_RT_SPS_ALLOC_ACTION helper macro. (#205339)
ORC_RT_SPS_ALLOC_ACTION(Name, SPSArgs, Handle) is shorthand for defining
an allocation-action wrapper function whose arguments are SPS-encoded.
It expands to:
static orc_rt_WrapperFunctionBuffer Name(const char *ArgData,
size_t ArgSize);
with a body that deserializes ArgData via
SPSAllocActionFunction<SPSArgs...> and forwards the decoded arguments to
Handle.
SPSArgs is given as a parenthesized comma-separated list of SPS argument
types — e.g. (int32_t, int32_t) — stripped at expansion time via
ORC_RT_DEPAREN.
[libc] Add CPU_CLR(_S) macros (#204590)
This patch implements CPU_CLR and CPU_CLR_S macros following the
existing CPU_SET pattern. The macro just forwards to an internal entry
point.
Assisted by Gemini.
[analyzer] Allow SVals as llvm::Immutable{Map,Set} keys (#205319)
This will allow maps and sets being declared:
```
REGISTER_MAP_WITH_PROGRAMSTATE(MyMap, SVal, SVal)
REGISTER_SET_WITH_PROGRAMSTATE(MySet, SVal)
```
[CIR][NFC] Rename zero result flag variable (#205242)
###summary
This is a follow up of https://github.com/llvm/llvm-project/pull/202273
Just a light patch for renaming the zero result flag variable.
[libc++] P3798R1: The unexpected in std::expected (#204826)
Closes #204394
Implements P3798 and related tests.
Applies the paper as a Defect Report per https://wg21.link/P3798/github.
[AMDGPU][DAGCombiner] Fix UADDO/USUBO_CARRY carry-out miscompile and remove redundant AMDGPU combine (#204362)
performAddCarrySubCarryCombine in SIISelLowering folded:
uaddo_carry((x+y), 0, cc) -> uaddo_carry(x, y, cc)
usubo_carry((x-y), 0, cc) -> usubo_carry(x, y, cc)
Both produce the same value but differ in carry-out when x+y (or x-y)
wraps. The fold was missing a !N->hasAnyUseOfValue(1) guard, giving
wrong carry values to consumers. E.g. x=0xFFFFFFFF, y=1, cc=0:
original: ((x+y) mod 2^32 + cc) >= 2^32 = 0 (correct)
folded: (x+y+cc) >= 2^32 = 1 (wrong)
The generic visitUADDO_CARRY (DAGCombiner.cpp) already handles
the UADDO_CARRY/ADD fold with the correct guard. Since target combines
fire before generic ones, the AMDGPU ADD arm was a buggy duplicate.
The USUBO_CARRY/SUB arm is produced by AMDGPU's performAddCombine
which converts add(sub(v,a), sext(cmp)) -> usubo_carry(sub(v,a), 0,
[12 lines not shown]
[mlir][memref] Add SCFDialect dependency to RuntimeOpVerification (#205241)
Explicitly load SCFDialect as a dependent dialect in
RuntimeOpVerification to avoid unregistered dialect errors when
generating `scf.if`/`scf.yield` ops. Fixes #204295.
[orc-rt] Add MacroUtils.h header for general purpose macros. (#205337)
For now just contains ORC_RT_DEPAREN, a macro for stripping parentheses
from its argument. This will be used in an upcoming commit.
Reland "[clang][ssaf][NFC] Make SSAFOptions available in Builders and Extractors" (#205334)
The original version of this was reverted part of #205279 because I
didn't know if this or the other patch caused the Windows build
failures. It turns out this patch is fine. I'm relating this now.
---
Now that we have SSAFOptions, it would make it a lot more ergonomic if
it was accessible from builders and extractors.
This PR does exactly that.
Part of rdar://179151023
Co-authored-by: Jan Korous <jkorous at apple.com>
Co-authored-by: Claude Opus 4.7 <noreply at anthropic.com>
[AArch64] Add flag to conditionally write FPMR (#203911)
Add a AArch64 codegen flag to make llvm.aarch64.set.fpmr avoid writing
FPMR when it already contains the requested value.
By default, llvm.aarch64.set.fpmr continues to lower directly to an MSR
FPMR instruction. With -aarch64-conditional-fpmr-write, the backend
lowers the intrinsic to an MRS/MSR conditional branch sequence.
This is based on the initial implementation from:
https://github.com/llvm/llvm-project/pull/114248
However this PR keeps the conditional FPMR write sequence behind a
codegen flag. One reason to change the codegen lowering is because GCC
emits the conditional branch sequence unconditionally. LLVM preserves
the existing direct MSR lowering by default.