LLVM/project 9d69e21llvm/utils/lit/lit worker.py run.py

[lit] Address scaling problems with ProcessPoolExecutor (#214853)

The executor implementation failed to account for how work distributes
across high core count machines. Up to about 64 cores/threads scaling
progresses linearly. However, beyond that the polling overhead, and lack
of scheduling, caused a major regression in high core count machines.

This PR addresses those issues in two ways. First, removes IPC events by
using a SimpleQueue with callbacks, which only fire on events and
removes many polling updates. Second, it batches tests to further limit
the amount of IPC events being tracked. Empirically, even a batch_size
of 2 was enough to dramatically improve overall throughput. This is
tunable through the LIT_BATCH_SIZE environment variable.

Additionally, we change SUBMISSION_WINDOW_PER_WORKER from 4 to 8, as
this was a better balance across both low and high core count machines.

On an AMD Ryzen Threadripper PRO 3995WX 64-Cores, 128 thread, 256 GB RAM
The execution time for check-llvm went from 105.2s to 48.38s, making the

    [6 lines not shown]
DeltaFile
+72-30llvm/utils/lit/lit/run.py
+13-0llvm/utils/lit/lit/worker.py
+85-302 files

LLVM/project bda3efbllvm/lib/Transforms/Vectorize VPlanTransforms.h VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize vplan-based-stride-mv-cfg.ll

Disable epilogue vectorization when performing VPlan-based stride MV
DeltaFile
+75-0llvm/test/Transforms/LoopVectorize/vplan-based-stride-mv-cfg.ll
+4-0llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+1-1llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+1-0llvm/lib/Transforms/Vectorize/VPlanTransforms.h
+81-14 files

LLVM/project 8237c29llvm/include/llvm/ADT GenericUniformityInfo.h GenericUniformityImpl.h, llvm/lib/Transforms/Scalar Reassociate.cpp

[ADT][Reassociate] Invalidate stale UniformityInfo entries on instruction erase (#214719)

`GenericUniformityAnalysisImpl::UniformValues` never removes an entry
when its value is erased. Reassociate keeps one `UniformityInfo` for the
whole pass while creating and deleting instructions, so a new
instruction can reuse a freed one's address and inherit its stale
"uniform" verdict instead of the documented divergent default. This
makes rank-boosting depend on heap addresses

Add `forgetValue()` (following the same idea as
`ScalarEvolution::forgetValue`) and call it at Reassociate two erase
sites

As a result of this issue we have a side effect that is reproducible on
https://github.com/llvm/llvm-project/pull/214624: nondeterministic
operand ordering in Reassociate output, because a newly-created
instruction can spuriously be classified "uniform" instead of the
documented default of divergent depending on whether the allocator
happened to reuse a freed instruction address

    [3 lines not shown]
DeltaFile
+10-0llvm/include/llvm/ADT/GenericUniformityImpl.h
+4-0llvm/lib/Transforms/Scalar/Reassociate.cpp
+4-0llvm/include/llvm/ADT/GenericUniformityInfo.h
+18-03 files

LLVM/project 7214eb0mlir/include/mlir/Dialect/MemRef/IR MemRefOps.td, mlir/lib/Dialect/MemRef/IR MemRefMemorySlot.cpp

[MLIR][Mem2Reg] Add support for memref.alloca_scope (#214221)

This PR implements `PromotableRegionOpInterface` for
`memref.alloca_scope`. This widens the range of programs that can be
processed by Mem2Reg pass.
DeltaFile
+39-1mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
+21-0mlir/test/Dialect/MemRef/mem2reg.mlir
+8-7mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+68-83 files

LLVM/project e4293abflang/lib/Lower/OpenMP OpenMP.cpp, flang/test/Lower/OpenMP canonical-loop-trip-count.f90

[flang][OpenMP] Fold canonical loop trip counts during lowering (#215238)

Canonical loop lowering currently materializes the complete trip-count
arithmetic even when the loop bounds and step are compile-time
constants.

Use FirOpBuilder::createOrFold for the comparisons, selects,
subtraction, unsigned division, and addition in the trip-count prologue.
This folds constant trip counts while preserving the existing dynamic
lowering and overflow flags.

Add bare-unroll lowering coverage for ascending, descending, zero-trip,
non-unit-step, dynamic, and i64 loops.

I'm doing this because
1) Surprisingly, no canonicalization pass between lowering and LLVM-IR
   translation is doing this already. Folding here saves us building
   LLVM instructions just for the middle-end to fold it.
2) This could simplify some analysis for #214115

Assisted-by: Codex
DeltaFile
+138-0flang/test/Lower/OpenMP/canonical-loop-trip-count.f90
+39-28flang/lib/Lower/OpenMP/OpenMP.cpp
+177-282 files

LLVM/project 7384c30clang/include/clang/Options FlangOptions.td, flang/lib/Evaluate tools.cpp

[flang][Lower] Add complex sum reassociation (#214775)

Third part of generalisations requested in #207377.

Extend the experimental split-sum transformation to complex addition and
subtraction chains. Share the signed-term builder across explicitly
supported real and complex categories while keeping integer expressions
excluded.

There are no known effect on benchmarks as a result of this patch.

Assisted-by: Codex
DeltaFile
+52-46flang/lib/Evaluate/tools.cpp
+90-2flang/test/Lower/split-sum-expression-tree-lowering.f90
+43-0flang/test/Driver/sum-reassociation.f90
+0-27flang/test/Driver/real-sum-reassociation.f90
+14-9clang/include/clang/Options/FlangOptions.td
+6-4flang/test/Driver/driver-help.f90
+205-883 files not shown
+212-959 files

LLVM/project 9ee4dd8llvm/test/CodeGen/RISCV llvm.sincos.ll

spelling

Co-authored-by: Craig Topper <craig.topper at sifive.com>
DeltaFile
+1-1llvm/test/CodeGen/RISCV/llvm.sincos.ll
+1-11 files

LLVM/project 5417c6flldb/source/ValueObject DILEval.cpp, lldb/test/API/commands/frame/var-dil/expr/SizeOf main.cpp TestFrameVarDILExprSizeOf.py

Forbid sizeof on bitfields
DeltaFile
+10-0lldb/test/API/commands/frame/var-dil/expr/SizeOf/TestFrameVarDILExprSizeOf.py
+9-0lldb/test/API/commands/frame/var-dil/expr/SizeOf/main.cpp
+5-0lldb/source/ValueObject/DILEval.cpp
+24-03 files

LLVM/project fa1af8blldb/test/API/commands/frame/var-dil/expr/SizeOf TestFrameVarDILExprSizeOf.py main.cpp

Add more tests cases, expand struct fields
DeltaFile
+8-4lldb/test/API/commands/frame/var-dil/expr/SizeOf/main.cpp
+4-0lldb/test/API/commands/frame/var-dil/expr/SizeOf/TestFrameVarDILExprSizeOf.py
+12-42 files

LLVM/project c585ac0lldb/source/Plugins/Language/CPlusPlus LibCxxVector.cpp, lldb/tools/lldb-dap/Protocol ProtocolEvents.cpp

[lldb] Fix MSVC warnings about missing return values (#215313)

MSVC warns with
[C4715](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715)
about missing returns in functions where a `switch` over and enum
handles all names enumerators, because the enum could hold unnamed
values. For example, given an `enum class Foo { Bar, Baz }` a function
handles both `Bar` and `Baz` by returning a value, Clang and GCC won't
issue warnings, but MSVC will.

This handles the cases in the two locations I found.
DeltaFile
+3-0lldb/tools/lldb-dap/Protocol/ProtocolEvents.cpp
+3-0lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
+6-02 files

LLVM/project 965dc1allvm/lib/Transforms/Vectorize VPlanTransforms.cpp

Clarify cast users are defined outside VPlan
DeltaFile
+2-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+2-01 files

LLVM/project 6583c61llvm/docs/CommandGuide llvm-objcopy.rst, llvm/test/tools/llvm-objcopy/ELF binary-output-target.test cross-arch-headers.test

[AMDGPU] Add AMDGPU support for llvm-objcopy (#190020)

llvm-objcopy does not support AMDGPU currently. It does not get target
names where all other tools do but has it's own list. Update the list to
support amdgpu.

https://reviews.llvm.org/D143539
https://github.com/llvm/llvm-project/pull/92066

---------

Co-authored-by: Aakanksha Patil <paakan at amd.com>
DeltaFile
+10-0llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test
+8-0llvm/test/tools/llvm-objcopy/ELF/binary-output-target.test
+2-0llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+1-0llvm/docs/CommandGuide/llvm-objcopy.rst
+21-04 files

LLVM/project 240288ellvm/lib/Transforms/Vectorize VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize vplan-based-stride-mv-btc.ll vplan-based-stride-mv.ll

Expand in VPStridesCheckVPBB
DeltaFile
+44-44llvm/test/Transforms/LoopVectorize/vplan-based-stride-mv.ll
+23-23llvm/test/Transforms/LoopVectorize/VPlan/vplan-based-stride-mv.ll
+12-12llvm/test/Transforms/LoopVectorize/vplan-based-stride-mv-btc.ll
+6-4llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+85-834 files

LLVM/project fa3119cclang/lib/Sema SemaAMDGPU.cpp, clang/test/CIR/CodeGenHIP builtins-amdgcn-extended-image.hip

clang/AMDGPU: Add half typed image gather4 builtin (#213613)

Follow along with the precedent of using an f32 suffix
for the coordinate type. We probably should have had one
builtin that detected the coordinate type.

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+30-0clang/test/CodeGen/builtins-extended-image.c
+15-0clang/test/SemaOpenCL/builtins-extended-image-param-gfx1100-err.cl
+6-2clang/lib/Sema/SemaAMDGPU.cpp
+8-0clang/test/CIR/CodeGenHIP/builtins-amdgcn-extended-image.hip
+5-0clang/test/SemaOpenCL/builtins-extended-image-err.cl
+5-0clang/test/Sema/builtins-amdgcn-d16-image-16bit-error.c
+69-23 files not shown
+72-29 files

LLVM/project 82ce34dclang/docs ReleaseNotes.md, clang/lib/Sema SemaDeclCXX.cpp

[clang][constexpr] Allow IndirectGotoStmt in constexpr functions for C++23 (#213449)

### Summary
P2242R3 relaxed `constexpr` function requirements in C++23 to allow jump
statements such as `goto` and labels inside `constexpr` functions. In
`CheckConstexprFunctionStmt`, `GotoStmtClass` and `LabelStmtClass` were
added, but `IndirectGotoStmtClass` (GNU computed goto) was missed.

This patch adds `case Stmt::IndirectGotoStmtClass:` alongside
`GotoStmtClass` in `CheckConstexprFunctionStmt`.

### Details
- Before this patch, writing `goto *p;` inside a `constexpr` function
resulted in `error: statement not allowed in constexpr function` because
`IndirectGotoStmtClass` fell through to the `default` case in
`CheckConstexprFunctionStmt`.
- With this patch, indirect gotos behave identically to standard gotos
in `constexpr` function bodies:
  - Allowed in C++23 mode.

    [13 lines not shown]
DeltaFile
+17-0clang/test/SemaCXX/gnu-constexpr-computed-goto.cpp
+3-1clang/docs/ReleaseNotes.md
+1-0clang/lib/Sema/SemaDeclCXX.cpp
+21-13 files

LLVM/project b733297llvm/include/llvm/ProfileData SampleProfWriter.h SampleProfReader.h, llvm/lib/ProfileData SampleProfReader.cpp SampleProfWriter.cpp

[SampleProfile] Support Eytzinger layout in SecFuncOffsetTable (#213829)

This patch supports writing SecFuncOffsetTable as an array of
fixed-length uint32_t file offsets parallel to the Eytzinger spans in
SecNameTable for ExtBinary sample profiles.

Without this patch, SecFuncOffsetTable stores pairs of variable-length
ULEB128 integers for GUIDs and file offsets, requiring us to eagerly
load and decode the entire section into an in-memory map.

This patch implements parallel arrays to avoid eager loading:

- In the writer, when -sample-profile-write-eytzinger-name-tables is
set,
  SecFuncOffsetTable holds only an array of uint32_t offsets into
SecLBRProfile. The k-th offset entry corresponds to the k-th GUID in the
  CSKeys or FlatKeys Eytzinger span of SecNameTable.

- In the reader, when SecFlagEytzinger is set on SecFuncOffsetTable, the

    [10 lines not shown]
DeltaFile
+79-5llvm/lib/ProfileData/SampleProfWriter.cpp
+58-4llvm/lib/ProfileData/SampleProfReader.cpp
+59-3llvm/include/llvm/ProfileData/SampleProfReader.h
+11-2llvm/test/tools/llvm-profdata/eytzinger-split-nametable-partition.test
+5-1llvm/include/llvm/ProfileData/SampleProfWriter.h
+3-0llvm/test/tools/llvm-profdata/cs-sample-profile.test
+215-151 files not shown
+218-157 files

LLVM/project 1376d06bolt/lib/Rewrite RewriteInstance.cpp, bolt/test/X86 reloc-data-symbol-negative-addend.s

[BOLT] Skip non-code relocs as function references (#215028)

handleRelocation looked up the referenced function from the resolved
"symbol + addend" address, ignoring the symbol's section. With biased
array indexing the compiler folds a constant into the displacement, e.g.
```
movq const_int_rtx-0x3fe00(,%rax,8), %r14   # R_X86_64_32S const_int_rtx-0x3fe00
```
so the unbiased displacement is not a live address (only disp + rax*8
is), yet it can land inside an unrelated function. BOLT re-anchored the
relocation onto that function and dropped the addend, then during
disassembly registered an interprocedural reference to a mid-instruction
address, producing:

```
BOLT-WARNING: corrupted control flow detected in function ...: an external
branch/call targets an invalid instruction in function ... ; ignoring both
```


    [6 lines not shown]
DeltaFile
+40-0bolt/test/X86/reloc-data-symbol-negative-addend.s
+7-2bolt/lib/Rewrite/RewriteInstance.cpp
+47-22 files

LLVM/project 0a06bbcllvm/docs/tutorial/MyFirstLanguageFrontend LangImpl04.rst

[docs] [kaleidoscope] Remove misplaced backslash from JIT tutorial (#213483)

In order to represent names starting with the string
"InitializeNativeTarget", use `InitializeNativeTarget*` rather than
`InitializeNativeTarget\*`.
DeltaFile
+1-1llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
+1-11 files

LLVM/project 319f0a2clang/lib/StaticAnalyzer/Core HTMLDiagnostics.cpp, clang/test/Analysis/html_diagnostics highlight-range-mapping.cpp

[analyzer] Fix -analyzer-output=html assert on reversed and macro ranges

HTMLDiagnostics::HighlightRange guarded against a reversed range by
comparing line numbers, so a same-line reversal - which is what the piece for
an implicit copy constructor carries - reached html::HighlightRange.
Its scan walks from begin to end, ran off the end of the buffer, and asserted:
https://godbolt.org/z/sTb5qfjjd

  Invalid position to insert! (RewriteRope.h)

It also added the end token's length itself and then passed a token range to
html::HighlightRange, which measured the token again, this time from the
interior. For most tokens the two cancel, but where the tail re-lexes longer
the highlight reached past the end of the range, e.g. over a trailing ';'.

Use getExpansionRangeInFile(), which rejects reversed and cross-file ranges,
then convert once and tell html::HighlightRange the range is already
char-granular.


    [4 lines not shown]
DeltaFile
+43-0clang/test/Analysis/html_diagnostics/highlight-range-mapping.cpp
+8-27clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+51-272 files

LLVM/project d54a0a5clang/lib/StaticAnalyzer/Core SarifDiagnostics.cpp, clang/test/Analysis/diagnostics sarif-macro-expansion.c

[analyzer] Fix -analyzer-output=sarif crash on macro-expanded ranges

A path piece whose range ends inside a macro expansion aborted the whole
document: https://godbolt.org/z/61vWYcsWj

  Cannot create a physicalLocation from invalid SourceRange!

convertTokenRangeToCharRange() built the end with
Lexer::getLocForEndOfToken(), which returns an invalid location for a macro
ID that is not at the end of its expansion, and used it unchecked. The
analyzer's own test corpus hits this in nine files; text and plist output
were unaffected because both already map such ranges to the expansion.

- Use getExpansionRangeInFile(), so the region covers the macro use like the
  other two outputs.
- Fall back to a caret when the range is unusable. A thread flow needs a
  location per piece, so dropping one would truncate the reported path. This
  also stops reversed ranges producing regions with endColumn < startColumn.


    [4 lines not shown]
DeltaFile
+22-21clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
+35-0clang/test/Analysis/diagnostics/sarif-macro-expansion.c
+57-212 files

LLVM/project 4a1bea0clang/include/clang/Frontend DiagnosticRenderer.h, clang/lib/Frontend DiagnosticRenderer.cpp

[clang] Reject ranges getExpansionRangeInFile cannot represent (#214461)

getExpansionRangeInFile was extracted verbatim and inherited two
shortcomings
of the original loop, fixed here before the analyzer's SARIF and HTML
consumers
depend on it:

- It mapped the end with getExpansionRange(SourceLocation), which always
reports a token range, so a char-range input was widened by a whole
token.
Now using the getExpansionRange(CharSourceRange) overload, which keeps
the flag.
- It passed reversed ranges through. Consumers walk begin->end; now
returning
  nullopt for those, as Lexer::makeFileCharRange already does.

Separate from the extraction so that stays NFC, and out of the consumer
fixes

    [7 lines not shown]
DeltaFile
+94-0clang/unittests/Frontend/TextDiagnosticTest.cpp
+6-0clang/lib/Frontend/DiagnosticRenderer.cpp
+2-1clang/include/clang/Frontend/DiagnosticRenderer.h
+102-13 files

LLVM/project b4497a7clang/lib/CIR/Dialect/Transforms LoweringPrepare.cpp, clang/test/CIR/CodeGenCUDA device-stub.cu

[CIR][HIP] Adjust HIP fatbin alignment to 4096
DeltaFile
+3-3clang/test/CIR/CodeGenCUDA/device-stub.cu
+5-1clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
+8-42 files

LLVM/project 3a019cellvm/lib/Target/AArch64 AArch64InstrFormats.td, llvm/test/MC/AArch64 basic-a64-diagnostics.s

[AArch64] Validate fixed-point SCVTF/UCVTF scale operands (#213490)

The fixed-point SCVTF/UCVTF operands are missing the ParserMatchClass
used by
fixedpoint_i32/i64. Symbolic scales can therefore reach the encoder and
hit
its MO.isImm() assertion, while out-of-range scales can alias valid
encodings.

Use Imm1_32Operand and Imm1_64Operand for these operands and add
diagnostics
for both source widths and symbolic scales.

Addresses the scvtf/ucvtf part of #185358. The ext case is tracked by
#185361.
DeltaFile
+37-0llvm/test/MC/AArch64/basic-a64-diagnostics.s
+2-0llvm/lib/Target/AArch64/AArch64InstrFormats.td
+39-02 files

LLVM/project dfe2f8aflang/lib/Lower/OpenMP OpenMP.cpp, flang/test/Lower/OpenMP groupprivate.f90

[Flang][OpenMP][MLIR]  Materialize groupprivate for target without teams (#214316)

Prior to this change, `groupprivate` variables were only materialized
for teams constructs. A `groupprivate` variable used inside a bare
target region was not materialized.

This commit materializes the `groupprivate` copy on the target construct
itself when target does not contain a teams construct. Making the
behavior equivalent to target teams num_teams(1).

Assisted-by: Opus 4.8
DeltaFile
+54-0flang/test/Lower/OpenMP/groupprivate.f90
+23-0mlir/test/Target/LLVMIR/omptarget-groupprivate.mlir
+16-1flang/lib/Lower/OpenMP/OpenMP.cpp
+93-13 files

LLVM/project 957c1f6lld/ELF Relocations.cpp, lld/test/ELF aarch64-reloc-pauth-undef-weak.s aarch64-reloc-pauth-undef-weak-pie.s

Address review comments
DeltaFile
+50-20lld/test/ELF/aarch64-reloc-pauth-undef-weak-dso.s
+2-2lld/test/ELF/aarch64-reloc-pauth-undef-weak.s
+2-2lld/test/ELF/aarch64-reloc-pauth-undef-weak-pie.s
+1-2lld/ELF/Relocations.cpp
+55-264 files

LLVM/project a4bb442llvm/lib/Target/AArch64 AArch64SchedHIP12.td, llvm/test/CodeGen/AMDGPU amdgcn.bitcast.1024bit.ll

Merge remote-tracking branch 'origin/main' into vplan-based-stride-mv-rt-guard
DeltaFile
+6,869-0llvm/test/tools/llvm-mca/AArch64/HiSilicon/hip12-sve-instructions.s
+5,269-0llvm/test/tools/llvm-mca/AArch64/HiSilicon/hip12-writeback.s
+1,980-2,100llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+3,354-0llvm/lib/Target/AArch64/AArch64SchedHIP12.td
+3,159-0llvm/test/tools/llvm-mca/AArch64/HiSilicon/hip12-neon-instructions.s
+2,519-0llvm/test/tools/llvm-mca/AArch64/HiSilicon/hip12-basic-instructions.s
+23,150-2,1001,226 files not shown
+68,056-24,8331,232 files

LLVM/project c931195clang/lib/CodeGen CGOpenMPRuntimeGPU.cpp, clang/test/OpenMP target_reduction_debug_codegen.c

[OpenMP] Fix reduction helper debug location

Don't attach parent func debug loc to instructions in helper func.
Fix invalid IR uncovered by
https://github.com/llvm/llvm-project/pull/211566.

Fixes https://github.com/llvm/llvm-project/issues/215297.

Claude assisted with this patch.
DeltaFile
+41-0clang/test/OpenMP/target_reduction_debug_codegen.c
+14-0clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+55-02 files

LLVM/project 6236340llvm/docs ReleaseNotes.md

[ReleaseNotes][SystemZ] Add notes for SystemZ

Add the release notes for the SystemZ backend.
DeltaFile
+39-0llvm/docs/ReleaseNotes.md
+39-01 files

LLVM/project 1b621bbmlir/include/mlir/Dialect/SCF/Utils Utils.h

[mlir] Remove dead declaration getSCFMinMaxExpr (#215188)

The corresponding function definition was removed on August 25, 2021
in commit 2de2dbef2a9a0c774acc8bf1ce17d024da5c145e.
DeltaFile
+0-9mlir/include/mlir/Dialect/SCF/Utils/Utils.h
+0-91 files

LLVM/project 4f70753libc/config/linux/arm entrypoints.txt, libc/test/src/unistd read_write_test.cpp

[libc] Relax read errno check (#215053)

read_write_test was failing on the libc-arm32-qemu-debian-dbg bot due to
a different errno number. Even though the test has a qemu branch, it did
not kick in because the bot does not set CMAKE_CROSSCOMPILING_EMULATOR
(I assume the tests get run via binfmt_misc).

While we could fix this in the bot config, and the different error
*might* be considered a qemu bug, I don't think this is particularly
relevant for this test, as we're merely forwarding the error number from
the kernel (as such, the errno expectation is more of a test for the
kernel that for libc). I think this okay to relax the check to expect
one of the two reasonable error messages.
DeltaFile
+5-5libc/test/src/unistd/read_write_test.cpp
+1-0libc/config/linux/arm/entrypoints.txt
+6-52 files