571639 Commits

Author SHA1 Message Date
Jan Svoboda
ca155dbea6
[clang] Enable wrapping the FrontendAction for module builds (#184907)
This PR upstreams a piece of infrastructure from Swift's LLVM fork. This
allows adding custom wrappers around the `FrontendAction` that compiles
Clang modules from a module map into a PCM file. This will be used to
implement modules support in the CAS-based compilation caching mode.
2026-03-05 23:43:35 +00:00
Matt Arsenault
742008d4e0
libclc: Define work_group_barrier (#184780)
Previously only the old barrier name was implemented. Define this
as an indirection around the new name, and move it to common code.
The target implementations are already provided by
__clc_work_group_barrier,
so targets were unnecessarily duplicating these.

This also fixes the default scope, which should be
memory_work_group_scope. Previously this was guessing that
if the flags included global memory, it makes the scope
device which is not the case.
2026-03-05 23:36:40 +00:00
Matt Arsenault
ef3955dbde
libclc: Reimplement amdhsa dispatch size functions (#184885)
Assume cov5 and use new ABI.
2026-03-06 00:33:10 +01:00
Hanliang Xu (Leon)
03d453a51a
[libc][math] Fix FP add/sub for signed-zero operands (#183243)
(-0.0) + (-0.0) and (-0.0) - (+0.0) returned +0.0 instead of -0.0.

Ensure these cases comply with IEEE 754 §6.3 rule.
2026-03-05 18:30:42 -05:00
Sang Ik Lee
dcd1bfb0df
[MLIR][XeVM] Mark gpu.printf test with XFAIL. (#184215)
gpu.printf test is expect to fail until vararg handling issue with
SPIR-V backend is resolved.
2026-03-05 23:30:18 +00:00
Dave Lee
58c5252b28
[lldb] Automatic indexing for synthetic children of collections (#174885)
Synthetic providers for collection types use a child name format of
"[N]".

This `ValueObjectSynthetic` to automatically convert child names in this
convention to the index embedded in the subscript string. With this
change, synthetic formatters for collections will only need to implement
`GetIndexOfChildWithName` or `get_child_index` for non-indexed
collection children. Some examples of non-indexed children are
`$$dereference$$` support, or "hidden" children.

The automatic conversion applies to N values that are less than the
number of children reported by the synthetic provider.
2026-03-05 23:28:22 +00:00
Ryan Thomas Lynch
83bc933822
NFC: MLIR Indexing Utils comment fix (#183438)
the comment for delinearize was incorrect and swapped modulus and
division, updated comment to match code
2026-03-06 00:19:18 +01:00
Eugene Epshteyn
008dc8b5bf
[flang-rt] Fix EXECUTE_COMMAND_LINE() on Windows (#184875)
Detect cmd.exe special status code 9009 that indicates "command not
found" condition. Crash the process if "command not found" detected when
CMDSTAT was not specified.
2026-03-05 18:17:57 -05:00
Jason Molenda
c9555f6675
[lldb][Darwin] Don't try to insert breakpoint on corefiles (#184749)
lldb is printing an error that the kext-loaded notification breakpoint
can't be set when debugging a kernel corefile. The breakpoint only needs
to be inserted in live debug sessions.

rdar://170813438
2026-03-05 15:12:05 -08:00
Jianhui Li
34259b76bf
[MLIR][XeGPU] Refactoring Transpose OP Layout Propagation (#184702)
This PR refactors Transpose Op Layout Propagation: 
1. Add inferTransposeSourceLayout() to layout utility, enhance layout
propagation and conflict handling to use this function
2. Add Layout utility: TransposeDims()
3. Refactor IsTransposeOf() and fix minor bugs
4. Fix minor issue in dropSgLayoutAndData()
2026-03-05 15:03:49 -08:00
Matt Arsenault
11727c11f8
libclc: Implement get_enqueued_local_size (#184842) 2026-03-05 23:55:56 +01:00
Emmanuel Antonio
d624466345
[mlir][acc] Add Dialect Utils to OpenACCDialect deps (#184895) 2026-03-05 16:50:44 -06:00
Florian Hahn
b53adf4246
[VPlan] Always process all argmin/argmax reductions in plan.
Follow-up to https://github.com/llvm/llvm-project/pull/170223.
Instead of exiting early, continue processing remaining reductions in
the loop. This ensures all multi-use reductions are properly converted
or the plan is rejected if there are unconvertable patterns.

Fixes https://github.com/llvm/llvm-project/issues/184729.
2026-03-05 22:37:22 +00:00
Dave Lee
e87d342553
[lldb] Fix bytecode.test (#184903)
Follow up to #184714.

There are some other latent bugs here inside the formatter, but for now
this puts the test in a working state.
2026-03-05 22:30:48 +00:00
Miguel Saldivar
d414e8cac3
[flang] Reject PARAMETER constants in NAMELIST groups (#178960)
The Fortran standard does not allow `PARAMETERS` within a
`namelist-group-object`, it should only allow variables. An error should
be emitted when a `PARAMETER` is found within a `namelist-group-object`.

Fixes: #178955
2026-03-05 16:26:54 -06:00
Mohamed Emad
94a8ca1870
[libc][math] Optimize asinpif and acospif using estrin's scheme (#184286)
Optimize `asinpif` and `acospif` using [Estrin's
scheme](https://en.wikipedia.org/wiki/Estrin%27s_scheme).

## Benchmarking in **debug mode**
### **before**
**asinpif**

```
Ntrial = 40 ; Min = 0.000 + 350.920 clc/call; Median-Min = 450.477 clc/call; Max = 468.882 clc/call;
```

**acospif**
```
Ntrial = 40 ; Min = 0.000 + 309.248 clc/call; Median-Min = 384.386 clc/call; Max = 420.073 clc/call;
```

### **after**
**asinpif**
```
Ntrial = 40 ; Min = 0.000 + 258.178 clc/call; Median-Min = 318.840 clc/call; Max = 326.965 clc/call;
```
**acospif**
```
Ntrial = 40 ; Min = 0.000 + 217.385 clc/call; Median-Min = 260.928 clc/call; Max = 293.692 clc/call;
```
2026-03-06 00:17:58 +02:00
Andrzej Warzyński
b5be6599b9
[CIR][AArch64] Add missing lowerings for vceqz_* Neon builtins (#184893)
Implement the remaining CIR lowerings for the AdvSIMD (Neon)
`vceqz{|q|d|s}_*` intrinsic group (bitwise equal to zero).

The `vceqzd_s64` variant was already supported; this patch completes
the rest of the group [1].

Tests for these intrinsics are moved from:
  * test/CodeGen/AArch64/neon-misc.c
  
to:
  * test/CodeGen/AArch64/neon/intrinsics.c

The implementation largely mirrors the existing lowering in
CodeGen/TargetBuiltins/ARM.cpp.

`emitCommonNeonBuiltinExpr` is introduced to support these lowerings.
`getNeonType` is moved without functional changes.

Reference:
[1] https://arm-software.github.io/acle/neon_intrinsics/advsimd.html#bitwise-equal-to-zero
2026-03-05 22:07:41 +00:00
Ehsan Amiri
9143f210ce
[LoopFusion] Correction in the comments (NFC) (#184689)
The comments in the code should have been updated following the change
in https://github.com/llvm/llvm-project/pull/183353. This PR addresses
that issue.
2026-03-05 16:54:23 -05:00
Reid Kleckner
6695f1d97f
[docs] Add exception to AI tool policy for Bazel build fixer (#183408)
The Bazel RFC concluded earlier this month:
https://discourse.llvm.org/t/rfc-ai-assisted-bazel-fixer-bot/89178/93

I felt the best way to document this decision was to incorporate it into
this policy document.
2026-03-05 13:53:44 -08:00
Krzysztof Parzyszek
dc62e284fe
[flang][OpenMP] Implement utility to locate OmpClause in ODS, NFC (#184866)
Simplify looking for a specific clause in OmpDirectiveSpecification.
This is alternative to DirectiveStructureChecker::FindClause for when
the internal checker structures have not yet been updated in the AST
traversal.
2026-03-05 15:49:24 -06:00
Valentin Clement (バレンタイン クレメン)
275a215349
[flang][openacc] Relax semantic check on cache directive (#184887)
The specification doesn't really forbid the colon notation to be used to
specify the full array. Reference compiler accepts this and our lowering
can already handle it.
2026-03-05 13:45:16 -08:00
Brox Chen
a82e3a1925
[AMDGPU] add back the true16 pattern for cvt_pk_rtz (#184857)
I found that the `SupportedRoundMode` pattern for true16 mode is removed
in https://github.com/llvm/llvm-project/pull/177069 by mistake. Added it
back in this patch and add gfx11 to the test which runs true16 mode
2026-03-05 16:35:15 -05:00
Zorojuro
9548db811e
[libc][math] Refactor ffmaf128 into a header only. (#184751)
closes #175325 
part of #147386
2026-03-05 23:31:40 +02:00
khaki3
43adf57413
[flang][acc] Handle ViewLike ops with OutlineRematerializationOpInterface in OffloadLiveInValueCanonicalization (#184218)
`fir::ConvertOp` implements both `ViewLikeOpInterface` and
`OutlineRematerializationOpInterface`. `fir.convert` is also used for
ptr-to-int conversions like `(!fir.ref<i32>) -> i64`. That is not really
a "view" — it converts a pointer to an integer — but
`ViewLikeOpInterface` is still attached, so `getOriginalValue` traces
through it to the underlying value.

When the underlying value is not a rematerialization candidate (e.g.,
`fir.alloca`, a block argument, or a `fir.call` result),
`isRematerializationCandidate` returns false and the `fir.convert` is
left as a live-in. This prevents `ACCImplicitData` from tracing back to
the original pointer to create the data mapping.

This PR:
1. Registers `fir::ConvertOp` with
`OutlineRematerializationOpInterface`.
2. Adds a fallback in `isRematerializationCandidate`: when the traced
original op is not a candidate, check the direct defining op (the
`fir.convert` itself) for `OutlineRematerializationOpInterface`.

```fortran
subroutine test()
  integer :: x
  !$acc declare create(x)
  !$acc parallel
    x = 1
  !$acc end parallel
end subroutine
```

Before: CSE merges `fir.convert` outside the region; `ACCImplicitData`
cannot map the pointer.
After: `fir.convert` is sunk/rematerialized inside the ACC region
regardless of its input source.
2026-03-05 13:29:10 -08:00
Andrzej Warzyński
aabae9dcc3
[Clang][CIR][AArch64] NFC: Cleanups in AArch64 builtins lowering (#184404)
This patch performs small cleanups and fixes in the AArch64 builtins
lowering code, with the goal of aligning the CIR path more closely
with the existing Clang CodeGen implementation.

Changes include:
* Make sure that `noundef` is consistently matched using `{{.*}}`.
* Rename `AArch64BuiltinInfo` to `armVectorIntrinsicInfo` for better
  consistency with the original CodeGen implementation.
* Simplify `emitAArch64CompareBuiltinExpr`, fix an incorrect
  assert condition (missing `!`) and make sure to use the input `kind`
  condition instead of hard-coding `cir::CmpOpKind::eq`.
* Improve and clarify comments.

No functional changes intended (NFC).
2026-03-05 21:24:10 +00:00
Razvan Lupusoru
dfe7738690
[mlir][acc] Add acc.compute_region and acc.par_width operations (#184864)
Introduce two new codegen operations to the acc dialect that model GPU
compute region execution and parallel launch configuration:
- acc.par_width: specifies a parallel dimension.
- acc.compute_region: wraps a region of code for GPU execution,
capturing
launch configuration (from acc.par_width results) and input values as
block arguments.

These operations bridge the gap between high-level OpenACC compute
constructs (acc.parallel, acc.kernels, acc.serial) and gpu.launch. The
passes that do these transformations will soon follow.

---------

Co-authored-by: Scott Manley <rscottmanley@gmail.com>
2026-03-05 13:13:58 -08:00
Andy Kaylor
6bd8820704
[CIR] Add support for delete cleanup after new operators (#184707)
This adds support for calling operator delete when an exception is
thrown during initialization following an operator new call.

This does not yet handle the case where a temporary object is
materialized during the object initialization. That case is marked by
the "setupCleanupBlockActivation" diagnostic in deactivateCleanupBlock
and will be implemented in a future change.
2026-03-05 21:13:42 +00:00
Erick Ochoa Lopez
f2cdf3f3b0
Revert "[mlir][arith] Add exact to index_cast{,ui} (#183395)" (#184876)
This reverts commit 7ad2c6db54a0e77249f2edb3c589ccf4c930d455.

PR #183395 introduced the `exact` flag to `index_cast` and
`index_castui` and updated some canonicalization patterns.
These canonicalization patterns were found to be unsound. For example:

* `index_cast(index_cast(x)) -> x`
* where one first truncates and then widens x

the rewrite is unsound because information is lost on the first cast as
it **may** truncate the value of x, therefore losing information. The
`exact` flag was made to make this transformation sound. Its semantics
are that when the `exact` flag is present, then it is assumed that the
operand to index_cast does not lose information (i.e., fits perfectly in
the destination type).

In PR #183395, the canonicalization rule was rewritten such that would
only match where the inner index_cast had the `exact` flag set.

* `index_cast(index_cast(x, exact)) -> x`
* where source type and destination type are the same

A post-merge review
[highlighted](https://github.com/llvm/llvm-project/pull/183395#discussion_r2880422529)
that the pattern above also disallows the following correct pattern:

* `index_cast(index_cast(x)) -> x`
* when the first index widens and the second one truncates.

Unfortunately the semantics of `index` are such that its bitwidth is
target specific. Attempts were made in
https://github.com/llvm/llvm-project/pull/184631 to automatically add
annotations were possible but no agreement was reached on the best way
to do this. Adding to the disagreement are the following points:

* [there are other unsound patterns that assume index is
64](https://github.com/llvm/llvm-project/pull/184631/changes#r2885181291)
* [The semantics of index is
contested](https://discourse.llvm.org/t/index-type-and-assumption-about-bitwidth/88287)

This lead to the belief that a reversal and an RFC would be a good
approach to get some consensus from the community before proceeding
further.
2026-03-05 16:04:45 -05:00
Steven Perron
9767894b85
[HLSL] Implement Texture2D::Gather and Texture2D::GatherCmp (#183323)
Add the Gather functions for Texture2D. Variations for all components
are added (Red, Blue, Greed, Alpha). If targeting Vulkan then the
GatherCmp* function for a component other than 0 will result in an
error, as that will lead to invalid SPIR-V.

Part of https://github.com/llvm/llvm-project/issues/175630.

Assisted by: Gemini
2026-03-05 20:59:01 +00:00
Richard Smith
6ae0e6d5fb
Don't crash when given an empty input filename. (#184718)
Commands such as `clang -- ''` hit two different crash bugs: a buffer
overflow caused by using a `memcmp` that might be larger than the input,
and a bogus assert in the option parser when attempting typo correction.
2026-03-05 12:50:03 -08:00
Craig Topper
add7b711de
[RISCV] Add RISCVISD opcodes for PSHL/PSRL/PSRA and lower to them. (#184836)
We only support splat shift amounts. Previously we checked if the shift
amount was a splat_vector and considered it legal.

I don't think there is a guarantee that the splat_vector will stick
around as a splat_vector. It's safer if we capture the splat and create
a dedicated node with a scalar shift amount.
2026-03-05 12:41:45 -08:00
Craig Topper
85858f60e4
[RISCV] Use SSLAI for XLen saturating shift left by immediate on RV32. (#184848) 2026-03-05 12:41:19 -08:00
Matt Arsenault
ede065a682
clang/AMDGPU: Do not emit __oclc_ABI_version references with environment (#184868)
Assume a sufficently new code object version if the environment is set
to something indicating we should have a real library.
2026-03-05 20:29:34 +00:00
Jim Ingham
ecd6f8c22b Revert "Add the ability to "allow another thread to see the private state" mode. (#184272)"
This reverts commit 97572c1860efeeb97b5940927cee72081b61810a.

This patch seems to cause TestWatchpointCommandPython.py to time out
on the ubuntu buildbots (but nowhere else that I can find so far.)  The
timeout is weird too, the TEST FILE is timing out but the individual
tests aren't being shown and there's no other output.  Grrr...
Anyway I'll revert this and then see if I can do some guessing about
how this change might cause the test to fail.
2026-03-05 12:09:07 -08:00
Jim Ingham
c969b5fe76 Revert "Skip some tests on Windows. They were already expected fail and"
This reverts commit 894408ded44151e4e34a3402210f671355d66310.

These tests were added by 97572c1860efeeb97b5940927cee72081b61810a
and I am reverting that as well.
2026-03-05 12:09:07 -08:00
Jim Ingham
5d2560c1a9 Revert "When hijacking events, don't let the user thread that was allowed"
This reverts commit a8af467fad7e5fff71643a3d6f2d06ac4f637e66.

This was a follow-on to 97572c1860efeeb97b5940927cee72081b61810a which was me
trying to guess why the ubuntu bots were failing with an entirely unhelpful
failure mode.  I'll have to figure out how I can reproduce this somewhere so
I can look at it for real.
2026-03-05 12:09:07 -08:00
Michael Spencer
90fdad2001
[clang][modules] Add warning for module maps with ".." paths (#184279)
Implicitly discovered module maps that reference files outside their
module directory cause order dependent behavior when using implicitly
discovered module maps. This adds an off by default diagnostic about
these cases with the long term goal of removing import order dependent
behavior.

Module maps found via `-fmodule-map-file=` are not a problem because
they are all loaded at the start of translation.

Assisted-by: claude-opus-4.6
2026-03-05 11:29:31 -08:00
Florian Hahn
5e88b806e8
[VPlan] Use pragma pack(1) for VPIRFlags on AIX. (#184687)
Some compilers (e.g. on AIX) do not pack by default. Use LLVM_PACKED to
ensure the VPIRFlags struct is packed as expected on all platforms.

This matches what we already do in other places for AIX, e.g. in
llvm/include/llvm/CodeGen/SelectionDAGNodes.h (added in
844a02e509a4cc03f76ef5dd1c358c57ee164b71), although it uses the more
general LLVM_PACKED unconditionally

PR: https://github.com/llvm/llvm-project/pull/184687
2026-03-05 19:29:06 +00:00
Valentin Clement (バレンタイン クレメン)
520319e3e0
[flang][cuda] Copy type descriptor used in fir.alloca op (#184859)
Avoid error like: 

```
error: runtime derived type info descriptor was not generated 
```
2026-03-05 19:28:17 +00:00
Jim Ingham
a8af467fad When hijacking events, don't let the user thread that was allowed
to see the private state to do so until we are done hijacking.
2026-03-05 11:27:37 -08:00
Deric C.
e4ad8a6e38
[HLSL][Matrix] Add implicit matrix floating-point conversion checks (#179568)
Fixes #168944 
Depends on #178762 being merged first.

The commit adds implicit conversion warnings for HLSL matrix types in
Clang's semantic checker by extending SemaChecking.cpp to detect
precision loss when converting between matrix types (specifically,
ConstantMatrixType).
A new test validates float precision warnings, and an existing test was
updated to expect the new diagnostics.

Assisted-by: claude-opus-4.5
2026-03-05 11:26:11 -08:00
Jan Svoboda
eb6fb77731
[clang][deps] Move-construct optional to fix a bot (#184861)
This is a speculative fix for the openmp-offload-sles-build-only build
bot that fails after #184376 with:

```
clang/lib/Tooling/DependencyScanningTool.cpp:336:12: error: could not convert ‘CIWithContext’ from ‘clang::tooling::CompilerInstanceWithContext’ to ‘std::optional<clang::tooling::CompilerInstanceWithContext>’
     return CIWithContext;
            ^~~~~~~~~~~~~
```
2026-03-05 11:22:15 -08:00
Krzysztof Parzyszek
7187a1d9d2
[flang][OpenMP] Utilities to get uppercase directive/clause names (#184853)
It is a convention to use uppercase names of directives and clauses in
diagnostic messages, but getting such names is somewhat cumbersome:
```
parser::ToUpperCaseLetters(llvm::omp::getOpenMPDirectiveName(dirId));
parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(clauseId));
```

Implement `GetUpperName` (overloaded for clauses and directives) to
shorten it to
```
GetUpperName(dirId, version);
GetUpperName(clauseId, version);
```

This patch replaces existing instances of this pattern, adding the use
of OpenMP version where it was previously missing.
2026-03-05 13:20:01 -06:00
Demetrius Kanios
0a76568db0
[WebAssembly] Reapply "[WebAssembly] Incorporate SCCs into WebAssemblyFixIrreducibleControlFlow" (#181755) (#184441)
Re-application of #181755.

Includes fixes to issues found after the original's merge.
2026-03-05 11:13:43 -08:00
Dave Lee
9145a7484e
[lldb] Use "assemble" instead of "compile" in formatter_bytecode.py (#184714)
Replace "compile" with "assemble" in formatter_bytecode. This is in
preparation for the addition of a Python to formatter bytecode compiler.
It will be more clear to have one meaning for "compile".
2026-03-05 11:11:32 -08:00
Erich Keane
0bca18db8d
[CIR][NFC] Add 'matrix' type to CIRGenExprConstant.cpp switch (#184852)
This just adds this as an NYI, but this will suppress the Wswitch
warning.
2026-03-05 19:06:20 +00:00
Craig Topper
3ed12eb3ff
[RISCV][P-ext] Fix cannot select error for shlsat with i8 vector argument. (#184839)
We don't have instructions for an i8 sshlat.
2026-03-05 11:00:21 -08:00
Florian Hahn
f7560e1795
[LV] Add tests with loops with multiple argmin/argmax.
Add additional tests with multiple argmin/argmax reductions for
https://github.com/llvm/llvm-project/issues/184729.
2026-03-05 18:58:24 +00:00
Alexey Bataev
b7ed29df5d [SLP][NFC]Add a test with a loop with profiling info, NFC 2026-03-05 10:57:19 -08:00
Chinmay Deshpande
6811a83c81
[Clang] Ensure child classes export inherited constructors from base classes (#182706)
Inherited constructors in `dllexport` classes are now exported for ABI-compatible cases, 
matching MSVC behavior. Constructors with variadic arguments or callee-cleanup 
parameters are not yet supported and produce a warning.

This aims to partially resolve https://github.com/llvm/llvm-project/issues/162640.

Assisted by : Cursor // Claude Opus 4.6
2026-03-05 10:57:11 -08:00