[clang] Silence warning in `WhitespaceManager` when building with MSVC (#187938)
This fixes:
```
[4544/7029] Building CXX object tools\clang\lib\Format\CMakeFiles\obj.clangFormat.dir\WhitespaceManager.cpp.obj
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveColons'::`2'::<lambda_1> &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveShortCaseStatements'::`2'::<lambda_1> &,3>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveDeclarations'::`2'::<lambda_1> &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveAssignments'::`2'::<lambda_1> &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveMacros'::`2'::<lambda_1> &,1>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`7'::<lambda_3> &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveColons'::`2'::<lambda_1>,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveAssignments'::`2'::<lambda_1>,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`5'::<lambda_1> &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveDeclarations'::`2'::<lambda_1>,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`5'::<lambda_1>,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveShortCaseStatements'::`2'::<lambda_1> &,2>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning C4715: '`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`7'::<lambda_3>,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
```
[AMDGPU] DPP implementations for Wave Reduction (#187214)
Add support for DPP wave reduction for floating
point numbers.
Supported Ops: `fmin`, `fmax`, `fadd`, `fsub`.
[ELF] Parallelize demoteAndCopyLocalSymbols. NFC (#187970)
Use parallelFor to process files in parallel, collecting Symbol*
pointers per-file, then merge into the symbol table serially.
Linking clang-14 (208K .symtab entries) is 1.04x as fast.
[clangd] [C++ Modules] Fix handling of relative paths in prebuilt mod… (#187654)
…ule files
When compile_commands.json contains relative paths in -fmodule-file=
arguments (as generated by CMake), clangd failed to find the BMI files
because it was looking for them relative to the wrong working directory.
This patch fixes the issue by converting relative paths to absolute
paths based on the compilation directory (CompileCommand.Directory)
before checking if the module file exists and is up to date.
Added a unit test that verifies the fix works correctly.
AI Assisted
[Mips] Add r5900 (PlayStation 2 Emotion Engine) FPU Support (#178942)
This PR adds basic FPU support for the MIPS R5900 processor used in the
PlayStation 2 Emotion Engine. The R5900 has a non-standard
single-precision-only FPU with limited functionality compared to
standard MIPS FPUs. Just like the previous r5900 PR, only existing
instructions are used to implement basic support first.
## Changes
### Infrastructure for single-precision-only FPU (ce13ddea7bc7)
- Add `isSingleFloat()` method to MipsAsmParser
- Add `SINGLE` FpABIKind to MipsABIFlagsSection
- Properly set CPR1Size and FpABI for single-float mode
- Exclude double-precision PseudoCVT instructions when using
single-float
### R5900 FPU support (13032c4d55b2)
- Switch R5900 from soft-float to single-float mode
[29 lines not shown]
[clangd] [C++ Modules] Enable content validation for module input files (#187653)
The IsModuleFileUpToDate function was not properly validating input
files for C++20 modules. By default, ASTReader skips input file
validation for StandardCXXModule files unless
ForceCheckCXX20ModulesInputFiles and ValidateASTInputFilesContent are
both set.
This change:
- Passes ValidateASTInputFilesContent=true to ASTReader constructor
- Uses ARR_OutOfDate flag for cleaner error handling
- Simplifies the validation logic (ReadAST already validates internally)
- Adds a test to verify header changes in module units are detected
Assised with AI.
[ELF] Always separate relative relocations regardless of -z combreloc (#187964)
Remove the combreloc guard from addReloc and mergeRels so that
relative relocations are always routed to relativeRelocs, even with -z
nocombreloc or --pack-dyn-relocs=android.
Update AndroidPackedRelocationSection::updateAllocSize to iterate
both relativeRelocs and relocs.
[LLD] [ELF] Make -z gcs=always implicitly warn on missing GCS, like force-bti (#186203)
This matches GNU ld, where gcs=always makes it implicitly warn about
missing GCS flags, by matching the existing code pattern used for BTI
and IBT.
Also test that warnings can be printed for both missing BTI and GCS for
the same object file.
This fixes #186173.
(cherry picked from commit 887d2d4bf7380113b27f199f323eeee883f17191)
[RISCV] Relax out of range Zibi conditional branches (#186965)
If `.Label` is not within +-4KiB range, we convert
```
beqi/bnei reg, imm, .Label
```
to
```
bnei/beqi reg, imm, 8
j .Label
```
This is similar to what is done for the RISCV conditional branches
and `Xqcibi` conditional branches.
---------
[2 lines not shown]
[SystemZ] Remove custom lowering of f16 IS_FPCLASS (#187532)
As pointed out in #187518 , currently, `__builtin_isnormal` returns
`true` for subnormal half precision floating point numbers on `s390x.
This is because there is a custom lowering defined which lowers an `f16`
`IS_FPCLASS` ISD node by extending the `f16` value to `f32`, and then
using SystemZ's "test data class" instruction to determine whether the
number is subnormal. However, a number that is subnormal in 16 bits of
precision will no longer be subnormal in 32 bits of precision, and so
the test always returns true, i.e. all subnormal numbers are classified
as normal.
This PR addresses this by removing the custom lowering and instead
relying on the generic expansion of `IS_FPCLASS`, which does not have
this error.
Fixes #187518 .
(cherry picked from commit 6eb5ac52ca56fd31c41a619a14093430b27132c3)
[LoongArch] Ensure .dwo sections do not contain relocations (#187429)
When linker relaxation is enabled, LoongArchAsmBackend may emit
relocations for same-section symbol differences, even when the fixup
is in a .dwo section. This leads to errors such as:
error: A dwo section may not contain relocations
Split DWARF (.dwo) sections must not contain relocations. Fix this by
resolving such fixups immediately when they are emitted into .dwo
sections, even if the referenced symbols are in relaxable sections.
This avoids generating invalid relocations in .debug_*.dwo sections
when compiling with -gsplit-dwarf and -mrelax.
Fixes #187428
(cherry picked from commit 89d8fe9d08c395875cf1201feaf9d213cadeea7a)
[ELF] Separate relative and non-relative dynamic relocations (#187959)
Previously, the flow was:
1. Parallel scan adds relative relocs to per-thread `relocsVec`
2. `mergeRels()` copies all into `relocs`
3. `partitionRels()` uses `stable_partition` to separate
Now, relative relocs are routed at `addReloc` time by checking
`reloc.type == relativeRel`. In `mergeRels`, sharded entries are
classified through the same `addReloc` path rather than blindly
appended. `relocsVec` may contain non-relative entries like
`R_AARCH64_AUTH_RELATIVE`.
This eliminates the `stable_partition` on the full relocation vector
(543K entries for clang) and avoids copying relative relocations into
`relocs` only to move them out again.
Linking an x86_64 release+assertions build of clang is 1.04x as fast.
[5 lines not shown]
[clang-tidy][NFC] Remove optimized container implementations in `misc-no-recursion` (#187630)
About half of this check's code is dedicated to implementing a pair of
set containers with optimizations for when the element count is small.
But the check only uses these containers while constructing the warning
message. That's not generally a hot path in any check. Just to confirm,
I ran the check over `clang/lib/Sema/Sema.cpp` and all its included
headers before and after, and saw no performance difference. So, these
containers seem like a false optimization.
[clang] On Windows, silence warning when building with MSVC (#187937)
This fixes:
```
[2124/7029] Building CXX object tools\clang\lib\AST\CMakeFiles\obj.clangAST.dir\TemplateBase.cpp.obj
C:\git\llvm-project\clang\lib\AST\TemplateBase.cpp(753): warning C4312: 'reinterpret_cast': conversion from 'clang::SourceLocation::UIntTy' to 'clang::TemplateArgumentLocInfo::LocOrPointer' of greater size
```
[mlir] Deterministic containers in BytecodeWriter (#187819)
Iteration over use lists in writeUseListOrders is non-deterministic as a
result of using a DenseMap. Replacing with a Vector-backed `MapVector`
restores deterministic behaviour.
[clangd] Code completion for declaration of class method (#165916)
Code completion previously could not tell apart the declaration of
a method from a call to it, and provided call-like behaviour even
in declaration contexts. This included things like not offering
completion for private methods, and inserting placeholders for
the parameters as though the user was going to fill in arguments.
This patch adds support to Parser and SemaCodeComplete to
detect and provide dedicated behaviour for declaration contexts.
In these contexts, the flag CodeCompletionResult::DeclaringEntity
is set, and createCodeCompletionString() is adjusted to handle this
flag, e.g. by inserting parameter declarations as text chunks rather
than placeholder chunks.
The DeclaringEntity flag is also available for consumers of
SemaCodeComplete, such as clangd, to customize their behaviour.
In addition, the patch tweaks the conditions under which the
[6 lines not shown]
[MLIR][XeGPU] Add distribution patterns for vector insert & extract ops in sg to wi pass (#184665)
This PR adds patterns for following vector ops in the new sg-to-wi pass
1. ExtractOp
2. ExtractStridedSliceOp
3. InsertStridedSliceOp
4. InsertOp
[Clang] Honour [[maybe_unused]] on private fields (#187940)
Before this commit, [[maybe_unused]] on private fields was ignored. In
conjunction with `-Wunused-private-field`, false warnings were emitted
by clang. This commit fixes this by checking if an unused private field
is annotated with [[maybe_unused]].
[VPlan] Add m_VPPhi pattern matcher and use in removeDeadRecipes (NFC).
Add m_VPPhi to match VPPhi instructions with exactly 2 operands.
Split off from https://github.com/llvm/llvm-project/pull/156262.
[llvm][ADT] Add PointerUnion benchmarks. NFC. (#187874)
Add microbenchmarks for `PointerUnion`'s `isa` and `isNull` operations
across union sizes of 2, 4, and 8 types. This it to establish baseline
performance numbers before making changes to the implementation.
I plan to refactor the implementation a bit and add support for more
variants using sparse encoding.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply at anthropic.com>