574733 Commits

Author SHA1 Message Date
Farid Zakaria
cf3a0f2553
[lld] update maintainers (#183803)
As a new contributor, it helps to correctly see the right maintainer.
2026-03-28 22:21:13 -07:00
Brian Cain
670de1f522
[compiler-rt][msan] Fix 32-bit overflow in CheckMemoryLayoutSanity (#189199)
Use start + (end - start) / 2 instead of (start + end) / 2 to compute
the midpoint address. The original expression overflows when start + end
exceeds UPTR_MAX, which happens on 32-bit targets whose memory layout
includes regions above 0x80000000.
2026-03-28 22:14:52 -05:00
Brian Cain
89d57d03bf
[compiler-rt][sanitizer] Add struct_rlimit64_sz for musl (#189197)
On musl, rlimit64 is an alias for rlimit rather than a distinct type
provided by glibc. Add a SANITIZER_MUSL elif branch so that
struct_rlimit64_sz is defined for musl-based Linux targets.
2026-03-28 22:13:32 -05:00
Victor Chernyakin
6ead6868e7
[clang-tidy][NFC] Run performance-faster-string-find over the codebase (#189202) 2026-03-28 18:41:48 -07:00
Michael Kruse
458f1aae8d
[Polly] Forward VFS from PassBuilder for IO sandboxing (#188657)
#184545 default-enables the IO sandbox in assert-builds. This causes
Clang using Polly to crash (#188568).

The issue is that `PassBuilder` uses `vfs::getRealFileSystem()` by
default which is considered a IO sandbox violation in the Clang process.
With this PR store the VFS from the `PassBuilder` from the original
`registerPollyPasses` call for creating other `PassBuilder` instances.

This PR also adds infrastructure for running Polly in `clang` (in
addition in `opt`). `opt` does not enable the sandbox such that we need
separate tests using Clang.

Closes: #188568
2026-03-28 23:55:05 +01:00
LLVM GN Syncbot
191a9a911c [gn build] Port c0bd2f9084d7 2026-03-28 21:31:51 +00:00
Björn Schäpers
c0bd2f9084 [clang-format][NFC] Extract some alignment tests
FormatTest.cpp is too huge, extract some tests to mitigate this a bit.
2026-03-28 22:31:32 +01:00
Florian Hahn
617ec39fd0
[VPlan] Add printing test for dissolving replicate regions. (#189192)
Add VPlan printing test for
 https://github.com/llvm/llvm-project/pull/186252
 https://github.com/llvm/llvm-project/pull/189022
2026-03-28 21:01:42 +00:00
Alexey Bataev
4450891580 [SLP] Check if potential bitcast/bswap candidate is a root of reduction
Need to check if the potential bitcast/bswap-like construct is a root of
the reduction, otherwise it cannot represent a bitcast/bswap construct.

Fixes #189184
2026-03-28 13:58:22 -07:00
Florian Hahn
ba6041bfbd
[Matrix] Handle load/store with different AS in getNonAliasingPointer. (#188721)
If a load and a store have different address spaces, we cannot create a
runtime check. Instead, always copy the data to an alloca matching the
store address space.

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

PR: https://github.com/llvm/llvm-project/pull/188721
2026-03-28 20:52:54 +00:00
Nishant Patel
9f3a9ea6ae
[MLIR][XeGPU] Add distribution patterns for vector step, shape_cast & broadcast from sg-to-wi (#185960)
This PR adds distribution patterns for vector.step, vector.shape_cast &
vector.broadcast in the new sg-to-wi pass
2026-03-28 10:00:04 -07:00
Pranshu Goyal
9d6b92e29f
[DAG] SelectionDAG::isKnownToBeAPowerOfTwo - add ISD::TRUNCATE handling and tests (#184365)
Closes #181654
2026-03-28 16:50:19 +00:00
Björn Schäpers
3f42ec658f
[clang-format] Fix annotation of references in function pointer typedefs (#188860)
Fixes #188695
2026-03-28 16:00:53 +00:00
Björn Schäpers
0ac35ecc0b
[clang-format] Fix breaking enum braces when combined with export (#189128)
This fixes #186684.

Also fix (not) breaking variables declared on the same line as the
closing brace.

And adapt whitesmith to that changes.
2026-03-28 15:55:52 +00:00
Shikhar Soni
f0ce26d06d
[libc][math][c23] Add log2p1f16 C23 math function (#186754)
Signed-off-by: Shikhar Soni <shikharish05@gmail.com>
2026-03-28 11:34:42 -04:00
Joseph Huber
15940b130a [libcxx] Update GPU cache files to use the proper loader
Summary:
These were renamed and the aliases removed, fix running the tests.
2026-03-28 08:47:55 -05:00
Twice
e568136e94
[MLIR][Python] Add more field specifiers to Python-defined operations (#188064)
This PR adds two new field specifiers (`operand` and `attribute`) and
extends the existing one (`result`):
- `default_factory` parameter is added for `result` and `attribute` to
specify default value via a lambda/function
- `kw_only` parameter is added for all these three specifiers, to make a
field a keyword-only parameter (without giving a default value).

```python
def result(
    *,
    infer_type: bool = False,
    default_factory: Optional[Callable[[], Any]] = None,
    kw_only: bool = False,
) -> Any: ...


def operand(
    *,
    kw_only: bool = False,
) -> Any: ...


def attribute(
    *,
    default_factory: Optional[Callable[[], Any]] = None,
    kw_only: bool = False,
) -> Any: ...
```

Examples about how to use them:
```python
class OperandSpecifierOp(TestFieldSpecifiers.Operation, name="operand_specifier"):
    a: Operand[IntegerType[32]] = operand()
    b: Optional[Operand[IntegerType[32]]] = None
    c: Operand[IntegerType[32]] = operand(kw_only=True)

class ResultSpecifierOp(TestFieldSpecifiers.Operation, name="result_specifier"):
    a: Result[IntegerType[32]] = result()
    b: Result[IntegerType[16]] = result(infer_type=True)
    c: Result[IntegerType] = result(
        default_factory=lambda: IntegerType.get_signless(8)
    )
    d: Sequence[Result[IntegerType]] = result(default_factory=list)
    e: Result[IntegerType[32]] = result(kw_only=True)

class AttributeSpecifierOp(
    TestFieldSpecifiers.Operation, name="attribute_specifier"
):
    a: IntegerAttr = attribute()
    b: IntegerAttr = attribute(
        default_factory=lambda: IntegerAttr.get(IntegerType.get_signless(32), 42)
    )
    c: StringAttr["a"] | StringAttr["b"] = attribute(
        default_factory=lambda: StringAttr.get("a")
    )
    d: IntegerAttr = attribute(kw_only=True)
```

---------

Co-authored-by: Rolf Morel <rolfmorel@gmail.com>
2026-03-28 21:46:21 +08:00
Mehdi Amini
3b76b85b15
[MLIR] Fix crash in test-bytecode-roundtrip when test dialect is absent (#189163)
When invoking `-test-bytecode-roundtrip=test-dialect-version=X.Y` on a
module that contains no test dialect operations, the reader type
callback in `runTest0` called
`reader.getDialectVersion<test::TestDialect>()` and then immediately
asserted that it succeeded. However, if the test dialect was never
referenced in the bytecode (because no test dialect types appear in the
module), the dialect's version information is not stored in the
bytecode, so `getDialectVersion` legitimately returns failure.

When the test dialect version is unavailable in the bytecode being read,
the module contains no test dialect types, so no "funky"-group overrides
are needed and the callback can safely skip by returning `success()`.

A regression test is added with a module that has no test dialect ops,
exercising the `test-dialect-version=2.0` path that previously crashed.

Fixes #128321
Fixes #128325

Assisted-by: Claude Code
2026-03-28 12:54:43 +00:00
Corentin Jabot
16e06589e9 [Clang][NFC] Trivial relocation is no longer a c++26 feature 2026-03-28 11:08:56 +01:00
Mehdi Amini
00c6b4dabd
[MLIR][Vector] Fix crash in foldDenseElementsAttrDestInsertOp on poison index (#188508)
When a dynamic index of -1 (the kPoisonIndex sentinel) was folded into
the static position of a vector.insert op,
foldDenseElementsAttrDestInsertOp would proceed to call
calculateInsertPosition, which returned -1. The subsequent iterator
arithmetic (allValues.begin() + (-1)) was undefined behaviour, causing
an assertion in DenseElementsAttr::get.

Fix by bailing out early in foldDenseElementsAttrDestInsertOp when any
static position equals kPoisonIndex, consistent with how
InsertChainFullyInitialized already guards this case.

Fixes #188404

Assisted-by: Claude Code
2026-03-28 10:08:23 +00:00
Corentin Jabot
64d2f702ce [Clang][NFC] Add the list of C++26 papers approved in Kona and Croydon 2026-03-28 10:53:17 +01:00
lonely eagle
1efef761c5
Revert "[mlir][reducer] Add eraseRedundantBlocksInRegion and getSuccessorForwardOperands API to BranchOpInterface" (#189150)
Reverts llvm/llvm-project#187864, because it is causing same build bot
failures. See https://lab.llvm.org/buildbot/#/builders/138/builds/27662
and
https://lab.llvm.org/buildbot/#/builders/169/builds/21376/steps/11/logs/stdio
for memory leak issues.
2026-03-28 08:51:01 +00:00
Jorn Tuyls
5ae2fe75c3
[mlir][vector] Reject alignment attribute on tensor-level gather/scatter (#188924) 2026-03-28 09:06:19 +01:00
Baranov Victor
ad91a2f036
[clang-tidy] Fix rvalue-reference-param-not-moved FP on implicit functions (#189113)
Fixes https://github.com/llvm/llvm-project/issues/187716.
2026-03-28 10:44:46 +03:00
lonely eagle
eb53972051
[mlir][reducer] Add eraseRedundantBlocksInRegion and getSuccessorForwardOperands API to BranchOpInterface (#187864)
To simplify the output of the reduction-tree pass, this PR introduces
the eraseRedundantBlocksInRegion. For regions containing multiple
execution paths, this functionality selects the shortest 'interesting'
path. Additionally, this PR adds the getSuccessorForwardOperands API to
BranchOpInterface. This allows us to extract the ForwardOperands for a
specific path chosen from multiple alternatives, enabling the creation
of a cf.br operation for the redirected jump.
2026-03-28 15:22:46 +08:00
Timm Baeder
097abb3d64
[clang][bytecode] Handle strcmp() not pointing to primitive arrays (#188917) 2026-03-28 06:13:18 +01:00
Timm Baeder
cb8b65e320
[clang][bytecode] Add support for objc array- and dictionary literals (#189058) 2026-03-28 05:52:23 +01:00
Timm Baeder
fb094491ac
[clang][bytecode] Skip rvalue subobject adjustments for global temporaries (#189044)
We only did this for local variables but were were missing it for
globals.
2026-03-28 05:22:55 +01:00
Yaxun (Sam) Liu
7f48ead4e6
[Driver][HIP] Fix bundled -S emitting bitcode instead of assembly for device (#189140)
[Driver][HIP] Fix bundled -S emitting bitcode instead of assembly for
device

PR #188262 added support for bundling HIP -S output under the new
offload driver, but the device backend still entered the
bitcode-emitting path in ConstructPhaseAction. The condition at the
Backend phase checked for the new offload driver and directed device
code to emit TY_LLVM_BC, without excluding the -S case. This caused
the device section in the bundled .s to contain LLVM bitcode instead
of textual AMDGPU assembly.

This broke the HIP UT CheckCodeObjAttr test which greps
copyKernel.s for "uniform_work_group_size" — a string that only
appears in textual assembly, not in bitcode.

Fix by excluding -S (without -emit-llvm) from the new-driver
bitcode path, so the device backend falls through to emit TY_PP_Asm
(textual assembly). Also add a missing lit test check that the
device backend produces assembler output for the bundled -S case.

Fixes: LCOMPILER-553
2026-03-27 23:15:18 -04:00
Md Abdullah Shahneous Bari
8e59c3a816
[XeVM] Fix the cache-control metadata string generation. (#187591)
Previously, it generated extra `single` quote marks around the outer
braces (i.e., `'{'` `6442:\220,1\22` `'}'`). SPIR-V backend does not
expect that. It expects `{6442:\220,1\22}`.
2026-03-27 21:18:18 -05:00
Ruiling, Song
c6fa976d5b
AMDGPU: Make VarIndex WeakTrackingVH in AMDGPUPromoteAlloca (#188921)
The test used to look all good, but actually not. The WeakVH just make
itself null after the pointed value being replaced. So a zero value was
used because VarIndex become null. The test checks looks all good.

Actually only the WeakTrackingVH have the ability to be updated to new
value.

Change the test slightly to make that using zero index is wrong.
2026-03-28 09:50:25 +08:00
Henrik G. Olsson
bc12c38af9
[Clang] remove redundant uses of dyn_cast (NFC) (#189106)
This removes dyn_cast invocations where the argument is already of the
target type (including through subtyping). This was created by adding a
static assert in dyn_cast and letting an LLM iterate until the code base
compiled. I then went through each example and cleaned it up. This does
not commit the static assert in dyn_cast, because it would prevent a lot
of uses in templated code. To prevent backsliding we should instead add
an LLVM aware version of
https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-casting.html
(or expand the existing one).
2026-03-27 17:11:23 -07:00
Brian Cain
5bb4eea8dd
[Hexagon] Add coverage tests for AsmPrinter and misc CodeGen (#183953)
Add tests targeting assembly printing and miscellaneous CodeGen areas
with low coverage:

- asm-printer-cpool.ll: HexagonAsmPrinter exercising constant pool entry
emission.

- asm-operand-modifiers.ll: Inline asm operand modifier printing paths
(lo/hi/mem).

- target-objfile-sdata.ll, split-double-volatile.ll, reg-info-types.ll:
Miscellaneous CodeGen coverage for HexagonTargetObjectFile small data
classification, HexagonSplitDouble volatile load handling, and
HexagonRegisterInfo register class queries.

- constext-store-imm.ll: HexagonConstExtenders store-immediate
optimization paths.
2026-03-27 18:59:52 -05:00
Matt Arsenault
9be0cc173d
AMDGPU: Skip last corrections and scaling for afn llvm.sqrt.f64 (#183697)
Device libs has a fast sqrt macro implemented this way.
2026-03-27 23:59:25 +00:00
Kamran Yousafzai
1264ffc4cc
[clang][RISC-V] fixed fp calling convention for fpcc eligible structs for risc-v (#110690)
The code generated for calls with FPCC eligible structs as arguments
doesn't consider the bitfield, which results in a store crossing the
boundary of the memory allocated using alloca, e.g.
For the code:
```
struct __attribute__((packed, aligned(1))) S {
   const float  f0;
   unsigned f1 : 1;
};
unsigned  func(struct S  arg)
{
    return arg.f1;
} 
```
The generated IR is:
```
 define dso_local signext i32 @func(
 float [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0:[0-9]+]] {
  [[ENTRY:.*:]]
    [[ARG:%.*]] = alloca [[STRUCT_S:%.*]], align 1
    [[TMP2:%.*]] = getelementptr inbounds nuw { float, i32 }, ptr [[ARG]], i32 0, i32 0
    store float [[TMP0]], ptr [[TMP2]], align 1
    [[TMP3:%.*]] = getelementptr inbounds nuw { float, i32 }, ptr [[ARG]], i32 0, i32 1
    store i32 [[TMP1]], ptr [[TMP3]], align 1
    [[F1:%.*]] = getelementptr inbounds nuw [[STRUCT_S]], ptr [[ARG]], i32 0, i32 1
    [[BF_LOAD:%.*]] = load i8, ptr [[F1]], align 1
    [[BF_CLEAR:%.*]] = and i8 [[BF_LOAD]], 1
    [[BF_CAST:%.*]] = zext i8 [[BF_CLEAR]] to i32
    ret i32 [[BF_CAST]]
```
Where, `store i32 [[TMP1]], ptr [[TMP3]], align 1` can be seen crossing
the boundary of the allocated memory. If, the IR is seen after
optimizations (EarlyCSEPass), the IR left is:
```
 define dso_local noundef signext i32 @func(
 float [[TMP0:%.*]], i32 [[TMP1:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
  [[ENTRY:.*:]]
    ret i32 0
```
The patch trims the second member of the struct after taking into
consideration the bitwidth to decide the appropriate integer type and
the test shows the results of this patch.

Note that the bug is seen only when `f` extension is enabled for FPCC
eligibility.

Co-authored-by: muhammad.kamran4 <muhammad.kamran@esperantotech.com>
2026-03-27 16:55:11 -07:00
Roland McGrath
c4847d250b
[Fuchsia] Set LIBCXX_ABI_UNSTABLE instead of LIBCXX_ABI_VERSION (#189123)
Use the generic switch rather than encoding the version number it
currently corresponds to.
2026-03-27 23:25:25 +00:00
PiJoules
a5fa4dba6e
[compiler-rt] Add interceptors for free_[aligned_]sized for asan+hwasan (#189109) 2026-03-27 23:16:52 +00:00
Matt Arsenault
15bc5b0267
libclc: Simplify fract implementation (#189080) 2026-03-28 00:16:07 +01:00
Alexey Samsonov
ae63230c23
[libc] Remove more header template files (#189066)
Get rid of several .h.def files which were used to ensure that the
macro definitions from llvm-libc-macro would be included in the public
header. Replace this logic with YAML instead - add entries to the
"macros" list that point to the correct "macro_header" to ensure it
would be included.

For C standard library headers, list several standard-define macros
to document their availability. For POSIX/Linux headers, only reference
a handful of macro, since more planning is needed to decide how to
represent platform-specific macro in YAML.
2026-03-27 16:06:39 -07:00
Wenju He
7be9972cb2
[libclc] Fix llvm-spirv dependency when llvm-spirv is built in-tree (#188896)
When SPIRV-LLVM-Translator is built in-tree (i.e., placed in
llvm/projects folder), llvm-spirv target exists.

Drop legacy llvm-spirv_target dependency (was for non-runtime build) and
add llvm-spirv to runtimes dependencies.
2026-03-28 07:06:23 +08:00
Farzon Lotfi
89ae675f59
[SPIRV][Matrix] Legalize store of matrix to array of vector memory layout (#188139)
fixes #188131

This change address stylistic changes @bogners requested in
https://github.com/llvm/llvm-project/pull/186215/ It also adds the
`storeMatrixArrayFromVector`. to
SPIRVLegalizePointerCast.cpp when we detect the matrix array of vector
memory layout
Changes to storeArrayFromVector were cleanup

Assisted-by Github Copilot for test case check lines
2026-03-27 19:01:56 -04:00
Ilija Tovilo
1128d74438
[LLD][skip ci] Fix typo in linker_script.rst (#148867) 2026-03-27 15:50:25 -07:00
Luke Wren
efba01ae12
[RISCV] Allocate feature bits for Zifencei and Zmmul (#143306)
As proposed in
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/110.

No real compiler-rt implementation as Linux does not list these
extensions in hwprobe.

Signed-off-by: Luke Wren <wren6991@gmail.com>
2026-03-27 15:47:57 -07:00
Stanislav Mekhanoshin
a2d84b5d8d
[AMDGPU] Remove neg support from 4 more gfx1250 WMMA (#189115)
These are previously covered by AMDGPUWmmaIntrinsicModsAllReuse.
2026-03-27 15:20:14 -07:00
Cristian Assaiante
044876423b
[ProfInfo] Fix integer overflow in getDisjunctionWeights (#189079)
This PR fixes an integer overflow in
[`getDisjunctionWeights`](https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/ProfDataUtils.h#L241)
and adds a regression test to cover the failing case. Casting branch
weights before the computations solved the issue.

Issue https://github.com/llvm/llvm-project/issues/189021
2026-03-27 15:19:53 -07:00
Jeff Bailey
d6ff5e7778
[libc][docs] Parse inline macro_value from YAML in docgen (#189118)
The docgen script was previously hardcoded to assume all implemented
macros must be placed in a *-macros.h header. This updates docgen to
read inline macro_value properties directly from the source YAML files,
correctly recognizing them as implemented.
2026-03-27 22:19:29 +00:00
Jeff Bailey
0aba82eb70
[libc] Add missing POSIX macros to cpio.h (#188840)
Define the POSIX cpio.h header and its standard macros in the libc build
system. Configure the macros directly in the YAML specification to allow
automated header generation without a custom definition template.
2026-03-27 22:08:13 +00:00
fineg74
563d3f6865
[OFFLOAD] Disable tests that may cause hangs in CI (#189116) 2026-03-27 21:32:25 +00:00
Sergei Barannikov
01768d3b95
[lldb] Fix the order of arguments in the StackFrame constructor call (#189108)
`pc` and `cfa` arguments were swapped.
2026-03-28 00:28:25 +03:00
Matt Arsenault
e825f42427
AMDGPU: Improve fsqrt f64 expansion with ninf (#183695) 2026-03-27 22:25:32 +01:00