Revert "[RISCV] Make clang's -mcpu=help and -mtune=help accurate for RISC-V. (#243697)" (#244534)
This reverts commit 6a92538ef2a7103e62e66e490f5d2aafa354b767, which
broke check-flang because -mtune=help was changed to alias a new option
handled only in Clang's frontend, whereas Flang's frontend still checks
only the original option:
FAIL: Flang :: Driver/print-supported-cpus.f90
The failure log is at
https://github.com/llvm/llvm-project/actions/runs/44690702871/job/136135570988
Assisted-by: Antigravity
[libc++] Avoid copying locales throughout the library (#242392)
The normal `getloc()` returns a `locale` by value, which forces a copy
constructor and destructor call (for reference counting) in a lot of
places where we really just need to access the locale. This introduces a
private `__getloc()` to access the locale by reference, saving these
calls.
[libc++] Optimize std::streambuf::pubimbue (#243505)
Using `std::swap` on locales is more efficient than the naive swapping
algorithm, so we should use it.
[libc++] Fix std::invoke with address spaces (#243879)
#213403 improved the compile time of `std::invoke`. Part of that was
avoiding `std::declval`. However, this new version causes references
with `[[clang::address_space]]`s to error. We can just revert to
`std::declval` and keep the rest of the patch.
Fixes #243495
[mlir][gpu] Remove ApplyUnrollVectorsSubgroupMmaOp (#243894)
As discussed in #233408, vector unrolling ops will be replaced with a
single op. To unblock that refactoring, this PR removes
`transform.apply_patterns.gpu.unroll_vectors_subgroup_mma`.
This GPU Transform dialect op includes extensive vector unrolling
configuration that currently lacks test coverage. It also selects
unrolling sizes and traversal order based on hardware assumptions that
may not suit all intended uses.
If the removed functionality is needed, we can reintroduce it through a
higher-level Transform dialect op, similar in spirit to Linalg's
`transform.structured.vectorize_children_and_apply_patterns`.
[BOLT] Parse library options into a context and pass it to MC (#244336)
After #242689, options of LLVM libraries declared in
TableGen (e.g. X86MCOptions: -x86-align-branch-boundary,
-x86-align-branch, -x86-pad-max-prefix-size, ...) are only recognized by
cl::parseCommandLineOptions taking a LibraryOptionsContext, and the MC
layer reads them through MCTargetOptions::LibraryOptions.
llvm-bolt still used the legacy cl::ParseCommandLineOptions, so these
options became "Unknown command line argument" and the Intel JCC erratum
mitigation (-x86-align-branch*) could no longer be requested.
Parse command lines into
opts::LibraryOptionsCtx and point the MCTargetOptions used for
BinaryContext MCAsmInfo at it.
[RISCV] Probe residuals, small frames, call frames and realignment (#237170)
With inline stack probing ("probe-stack"="inline-asm", which
-fstack-clash-protection sets), the RISC-V prologue could leave more
than a probe interval of stack unprobed, so a sequence of frames could step
over a guard page:
- An allocation of at most the probe size, such as a whole frame under
4 KiB, was never probed, and neither was the residual left after the
probes of a larger one. A caller with a 10000-byte frame made its calls
3888 bytes below its last probe, and a callee with a 4064-byte local
array then stored first at the bottom of that array: 7952 bytes between
two stack accesses.
- Call frames smaller than the probe size were not probed.
- Realigning SP was probed at most once, and not at all with an RVV area
or a second SP adjustment of at least the probe size, although it moves
SP down by up to MaxAlign - StackAlign bytes: nearly 64 KiB for a 64 KiB
aligned local.
[17 lines not shown]
[SandboxVec][LoadStoreVec] Address review on mixed-type loads
Rename getLanesTypeFor to getSameBitWidthType and document that a wider
scalar spans several lanes. Drop the unused LoadInst cast, explain the
test data layout, and cover a reversed vector/scalar chain plus loads
with multiple uses.
Co-authored-by: Cursor <cursoragent at cursor.com>
[GitHub] Automatically apply the clang-repl label to PRs and Issues (#243473)
The clang-repl label exists, but it is only applied manually. This PR
adds rules to the issue and PR labelers so it is applied automatically.
Issues are labeled when "clang-repl" appears in the title. PRs are
labeled when they change the clang-repl sources, tests or tool.
Assisted by Claude Sonnet 5.5
[NFCI][LowerTypeTests] Reuse one DIBuilder per module for jump tables (#244484)
`createJumpTableDebugInfo` previously constructed and finalized a new
`DIBuilder` for every CFI jump table, copying and re-hashing an existing
`DICompileUnit`'s metadata arrays on each jump table. Reuse one
`DIBuilder`
(along with the `DICompileUnit`, `DIFile`, and `DISubroutineType`) per
`LowerTypeTestsModule` and finalize it once in
`~LowerTypeTestsModule()`,
matching the intended single-builder-per-module usage
(https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.html).
No meaningful compile-time improvement was measured under ThinLTO:
`ThinLTOBitcodeWriter` strips debug info from the split regular-LTO
module, so its `DICompileUnit` metadata arrays are empty and `DIBuilder`
accounts for a negligible fraction of link time (most overhead is DWARF
emission for the jump-table subprograms). This avoids repeated array
copying/re-hashing when a non-empty `DICompileUnit` is present (e.g.,
[2 lines not shown]
[GitHub] Wait for test merge commit in test-suite.yml (#244517)
Often times /test-suite is run right after a commit is pushed to a PR,
before the test merge commit is generated. This waits up to 5 minutes
for it to come through, which should avoid some "Failed to get
test-suite diff" errors.
Whilst we're here, also fix the "Failed to get test-suite diff" error
message clobbering the merge conflict error message.
Assisted-by: Opus 5.5
[CodeGen] Verify tied use and def have same subreg (#244279)
Extend the MachineVerifier to check that a tied use and def of the same
virtual register must either use the same subregister index or both use
no subregister. Otherwise the tie cannot be satisfied.
`TwoAddressInstructionPass` currently ignores subregister indices when
the virtual register is already identical. GreedyRA and RegAllocFast
both miscompile this shape.
No compilation pipeline seems to be using this shape at the moment.
This came up in the review of #237249.
---------
Signed-off-by: Lukas Sommer <lukas.sommer at amd.com>
[RISCV] Add command line options to disable register overlap for vector indexed load for SiFive erratum (#224739)
If a trap occurs on an element other than 0, some SiFive cores will
write a garbage value to that element and all active elements after it
in the destination register before running the trap handler. This is
normally allowed by the spec if restarting the instruction would
overwrite the elements with the correct results.
For a vector indexed load with overlapping source and destination,
writing the later elements with garbage corrupts some of the source
indices. This prevents the instruction from restarting correctly once
the fault has been handled.
This patch adds two options, `-m[no-]fix-sifive-mal-9174` and
`-m[no-]fix-sifive-mal-9191`, that allows users to opt out of
overlapping registers on these instructions. This gcc patch
https://gcc.gnu.org/pipermail/gcc-patches/2026-November/737556.html
will be updated to use the same names. mal-9174 and mal-9191 are the
names from our internal bug database.
[3 lines not shown]
[NewPM][Target] Mark pipeline overrides as protected (#244491)
Otherwise we are changing the visibility from the parent
CodeGenPassBuilder class to public.
This is flagged by misc-override-with-different-visibility, which is new
in clang-tidy as of v23.
[SandboxVec][LoadStoreVec] Address review on mixed-type loads
Rename getLanesTypeFor to getSameBitWidthType and document that a wider
scalar spans several lanes. Drop the unused LoadInst cast, explain the
test data layout, and cover a reversed vector/scalar chain plus loads
with multiple uses.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SandboxVec][LoadStoreVec] Support mixed-type load vectorization
Remove the restriction that every load in a top-level load chain must have the vector's element type. A chain of mixed types such as {i32, float} or {double, i32, i32} is loaded as a vector of integers (as chosen by VecUtils::getCombinedVectorTypeFor()), each original load is unpacked from the lanes it occupies, and then reinterpreted back to its own type with SameSizeReinterpret::reinterpretValue().
Chains involving a non-integral pointer are left alone, since such a pointer cannot be recovered from an integer lane.
SameSizeReinterpret is also used by createConstantVector() to pack constants of mixed types into a constant vector.
Co-authored-by: Cursor <cursoragent at cursor.com>