575331 Commits

Author SHA1 Message Date
Simon Pilgrim
8991ce9cff
[AMDGPU] Add basic clmul test coverage (#190205) 2026-04-02 16:41:34 +00:00
Tony Guillot
42b6a6faaa
[Clang] Fixed the behavior of C23 auto when an array type was specified for a char * (#189722)
At the time of the implementation of
[N3007](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3007.htm) in
Clang, when an array type was specified, an error was emitted unless the
deduced type was a `char *`.
After further inspection in the C standard, it turns out that the
inferred type of an `char[]` should be deduced to a `char *`, which
should emit an error if an array type is specified with `auto`.

This now invalidates the following cases:
```c
auto s1[] = "test";
auto s2[4] = "test";
auto s3[5] = "test";
```

Fixes #162694
2026-04-02 18:40:21 +02:00
Graham Hunter
deaef1c1b7
[LV] Adjust exit recipe detection to run on early vplan (#183318)
Splitting out some work from #178454; this covers the enums for
early exit loop type (none, readonly, readwrite) and the style
used (readonly with multiple exit blocks, or masking with the
last iteration done in scalar code), along with changing the early
exit recipe detection to suit moving the transform for handling
early exit readwrite loops earlier in the vplan pipeline.
2026-04-02 17:25:35 +01:00
Timm Baeder
ef409e649c
[clang][bytecode] Add an assertion in initScope() op (#189972)
I've run into a problem in a branch lately that would've benefitted from
this assertion.
2026-04-02 17:49:46 +02:00
Chinmay Deshpande
5ecc7e1e57
[AMDGPU][NFC] Update gating target feature for SWMMAC instructions (#190012) 2026-04-02 08:39:59 -07:00
Florian Hahn
97dbf38c9c
[SCEVExpander] Add SCEVUseVisitor and use it in SCEVExpander (NFC) (#188863)
Add SCEVUseVisitor, a new visitor class where all visit methods receive
a SCEVUse instead of a const SCEV*. Use it for SCEVExpander, so it can
use use-specific flags in the future.

PR: https://github.com/llvm/llvm-project/pull/188863
2026-04-02 15:08:01 +00:00
Kartik Ohlan
87104ee514
[Clang] [Sema] Diagnose returning an initializer list from a lambda with a return type of void (#188904)
We previously didn’t diagnose attempts to return an initializer list from
a lambda with an explicit return type of `void`. This patch fixes that. It also 
cleans up the error message so it actually says "lambda" instead of "block".

Fixes #188661

Signed off by: Kartik
2026-04-02 14:55:54 +00:00
Ramkumar Ramachandra
bb2a63a673
[VPlan] Use m_Isa to improve code (NFC) (#190149) 2026-04-02 15:53:05 +01:00
zGoldthorpe
e9a62c7698
[DAG] computeKnownFPClass: handle ISD::FABS (#190069)
Use `KnownFPClass::fabs` to handle `ISD::FABS`.

This case will help with updating #188356 to use `computeKnownFPClass`.
2026-04-02 14:48:54 +00:00
Trung Nguyen
9dc1da6e87
[clang] Add support for MSVC force inline attrs (#185282)
Add support for `[[msvc::forceinline]]` and
`[[msvc::forceinline_calls]]`.

`[[msvc::forceinline]]` is equivalent to Microsoft's `__forceinline`
when placed before a function declaration.
Unlike `__forceinline`, `[[msvc::forceinline]]` works with lambdas.

`[[msvc::forceinline_calls]]` is simliar to `[[clang::always_inline]]`
but only works on statements.

Both are implemented as aliases of `[[clang::always_inline]]` with
special checks.

Fixes #186539.
2026-04-02 16:42:26 +02:00
Aditya Medhane
c1fd7d7a1f
[APINotes][BoundsSafety] Upstream API notes format for bounds-safety function parameters
Related: #183340
Upstream from swiftlang/llvm-project@721e6a3 with some modifications.

Since __counted_by and related attributes aren't supported upstream yet
in function signatures, this only upstreams the format part — YAML
parsing, binary serialization, and deserialization. Semantic application
is a follow-up.

Modifications from downstream:
- Renamed local YAML struct from `BoundsSafety` to `BoundsSafetyNotes`
to avoid name collision with `Param::BoundsSafety` field (downstream
fixed this in a subsequent commit)
- `Level` in `BoundsSafetyNotes` is now `std::optional<unsigned>` so we
can actually tell apart "user didn't write Level:" from "Level: 0"
- `asdf_sized` and `asdf_sized_n` use `void *buf` — makes more sense for
sized_by
- Added `asdf_counted_indirect` with `int **` and `Level: 1` to test the
indirection level path
- Removed a vacuous assert (`CountedBy == 0`, always true for unsigned)
- Added `operator!=` for `BoundsSafetyInfo` to match other types in
`Types.h`
- Added doc comments for `LevelAudited` and `Level`
2026-04-02 15:10:48 +01:00
Leandro Lupori
d59356aac5
Revert "Reland "[flang][OpenMP] Fix lowering of LINEAR iteration variables (#183794)"" (#190180)
Reverts llvm/llvm-project#188851
2026-04-02 11:09:30 -03:00
Charles Zablit
29c083a61f
[lldb][windows] simplify the ConPTY draining subprocess (#190178)
In some environments like swiftlang, the `''` causes the command used to
drain the init sequence of the ConPTY to fail. Replacing with a `cls`
invocation removes the need for quotation marks and works just as well.
2026-04-02 15:08:52 +01:00
Petar Avramovic
5226289b8e
Revert "AMDGPU: Codegen for v_dual_dot2acc_f32_f16/bf16 from VOP3" (#190159)
This reverts commit 47f6a19181b426baa03182ab6a7a41e16b35301d.
Breaks MIOpen, don't have propper fix yet.
2026-04-02 14:05:08 +00:00
Ryotaro Kasuga
75359e1e1f
[DA] Add static to analyzeCoefficientsForGCD (NFC) (#190172) 2026-04-02 14:04:31 +00:00
Simon Pilgrim
91b3b67a9e
[X86] known-pow2.ll - adjust pow2_trunc_vec to show failure to pass through demanded elts mask to determine pow2orzero mask (#190170) 2026-04-02 14:04:09 +00:00
lntue
3d359887c4
[libc] Add powerpc64le to libc-shared-tests precommit CI. (#190096) 2026-04-02 09:58:26 -04:00
Mehdi Amini
a36f821e77
[mlir][linalg] Add test for ReduceOp empty-input verifier; remove dead empty-output check (#189614)
Add a FileCheck test covering the 'expected at least one input' error in
ReduceOp::verify(). The companion 'expected at least one output' check
was dead code: SameVariadicOperandSize fires first whenever
inputs.size() \!= inits.size(), and when both are empty the input check
fires first; remove the unreachable branch.

Assisted-by: Claude Code
2026-04-02 15:57:53 +02:00
Jean-Didier PAILLEUX
0625467c63
[Flang] Fix lowering failure for some constructs inside a CHANGE TEAM (#184342)
This PR is here to fix the `CHANGE_TEAM` construct if it contains an
IF/ELSE (construct with a body too) in its body, for example.
2026-04-02 15:54:13 +02:00
Dhruv Chauhan
b87be02cc7
Revert "[mlir][tensor] Forward concat insert_slice destination into DPS provider" (#190143)
This reverts commit 1418f80.

The change can cause an infinite rewrite loop when
ForwardConcatInsertSliceDest interacts with
FoldEmptyTensorWithExtractSliceOp.
2026-04-02 14:48:44 +01:00
Alexey Bataev
c2f97c5917
[SLP] Do not skip tiny trees with gathered loads to vectorize
The isTreeTinyAndNotFullyVectorizable check for 2-node trees
(insertelement root + gather child) was too aggressive: it rejected
trees even when LoadEntriesToVectorize was non-empty, preventing
gathered loads from being vectorized into masked loads/strided loads, etc.

Reviewers: hiraditya, RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/190181
2026-04-02 09:47:01 -04:00
Charles Zablit
aff601aed8
[lldb][windows] fix duplicate OnLoadModule events (#189376) 2026-04-02 14:46:00 +01:00
Stefan Gränitz
60efb5c0a3
[llvm] Fix SupportHTTP linkage with libLLVM in unit-tests (#190097)
Since libSupportHTTP is part of the LLVM dylib, we must link it as a
component now. Fixes https://github.com/llvm/llvm-project/issues/189978
2026-04-02 15:37:08 +02:00
Ryotaro Kasuga
682a217d74
[DA] Extract the logic shared by the Exact SIV/RDIV test (#189951)
The Exact SIV test and the Exact RDIV test behave almost identically,
except that the Exact SIV test also explores the directions in the final
step. This patch consolidates the two duplicate implementations into a
single function that can be used by both tests. While this change
slightly affects things like debug output and metrics, it is not
intended to alter the actual test results.
2026-04-02 13:30:42 +00:00
Alexey Bataev
dc2d25f80b
Revert "[SLP] Do not skip tiny trees with gathered loads to vectorize"
This reverts commit 94ec7ffa46d351b86fbbe3a445ceef37f331c4a2 to fix
reported issue https://github.com/llvm/llvm-project/pull/190040#issuecomment-4177827078

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/190176
2026-04-02 09:26:31 -04:00
Rahul Joshi
99786f20ee
[LLVM][Intrinsics] Refactor IITDescriptor (#190011)
The main change is to eliminate the use of "Argument" terminology when
dealing with overloaded types since overloaded types can be either
argument or return values, and some additional renaming for clarity.

1. Rename `Tys` argument to various intrinsic APIs to `OverloadTys` to
better reflect its meaning.
2. Rename `IITDescriptorKind::Argument` to
`IITDescriptorKind::Overloaded` to better convey that it's an overloaded
type. Removed "Argument" suffix for other kinds for dependent types.
3. Rename `ArgKind` to `AnyKind`, `getArgumentNumber` to
`getOverloadIndex`, `getArgumentKind` to `getOverloadKind`,
`getRefArgNumber` to `getRefOverloadIndex`, and `IIT_ARG` to `IIT_ANY`.
4. Rename `IIT_ANYPTR` (used to represent a pointer qualified with
address space) to `IIT_PTR_AS` to clearly distinguish it from
`llvm_anyptr_ty`
5. Change the packing of [ref overload index & overload index] for
`VecOfAnyPtrsToElt` to pack the overload index into the lower bits, so
we can use the `getOverloadIndex` function to get the overload index.
2026-04-02 06:19:01 -07:00
Matt Arsenault
862ceaa793
clang/AMDGPU: Use f64 exp10 builtin in hip math headers (#185947) 2026-04-02 15:04:12 +02:00
Erich Keane
58b719660c
[CIR] Implement union aggregate init (#190057)
This ends up being a pretty trivial amount of work, since we just have
to forward the initialization for a union on to the 'active' field,
which this patch does.
2026-04-02 06:00:36 -07:00
Erich Keane
710d647586
[CIR] Implement 'null' function-pointer vtable entries (#190013)
This functionality is described in the Itanium C++ABI 2.5.2 (and is also
where the test comes from). See also VTableBuilder.cpp's documentation
on the declaration of IsOverriderUsed for further details.

However, the explaination is:
When B and C are declared, A is a primary base in each case, so although
vcall offsets are allocated in the A-in-B and A-in-C vtables, no this
adjustment is required and no thunk is generated. However, inside D
objects, A is no longer a primary base of C, so if we allowed calls to
C::f() to use the copy of A's vtable in the C subobject, we would need
to adjust this from C* to B::A*, which would require a third-party
thunk. Since we require that a call to C::f() first convert to A*,
C-in-D's copy of A's vtable is never referenced, so this is not
necessary.

The short of that is: there is no way to call these, so we just emit a
nullptr rather than the required thunk.
2026-04-02 06:00:23 -07:00
Steven Perron
905f23c9f8
[HLSL] Add CalculateLevelOfDetail methods to Texture2D (#188574)
This adds the CalculateLevelOfDetail and CalculateLevelOfDetailUnclamped
methods to Texture2D using the establish pattern used for other methods.
   
Assisted-by: Gemini
2026-04-02 08:58:11 -04:00
Ramkumar Ramachandra
b0230f5996
[VPlan] Cleanup and generalize VPPhiAccessors CastInfo (NFC) (#190027) 2026-04-02 13:47:44 +01:00
Balázs Benics
3200d64c33
[clang][ssaf] Fix nondeterministic test failures of clang/test/Analysis/Scalable/call-graph.cpp (#190155)
fixup! [clang][ssaf] Implement JSON format for CallGraph summary

The order of checks were unspecified in the test.
Consequently, "polymorphic" may have appeared before "caller" failing
the test.

This patch splits the test into separate files so these wouldn't
interfere.

Example bot failures:
https://lab.llvm.org/buildbot/#/builders/225/builds/4974
https://lab.llvm.org/buildbot/#/builders/144/builds/50732
https://lab.llvm.org/buildbot/#/builders/190/builds/39773
https://lab.llvm.org/buildbot/#/builders/46/builds/33213

Fixes up #189681
2026-04-02 13:11:16 +01:00
Mariya Podchishchaeva
329af7d2b7
[clang] Fix array filler lowering for _BitInt arrays (#189954)
Sometimes we use array of bytes to represent `_BitInt` types in memory.
When this is the case the lowered array filler expression reaches
`ConstantEmitter::emitForMemory` already with memory type which will be
array of i8 instead of a single iN, so `cast<llvm::ConstantInt>` was
failing within `ConstantEmitter::emitForMemory`. This patch fixes the
assertion failure by not attempting any type changes if the type is
right already.

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

Assisted-by: claude in FileCheck CHECK lines fixing
2026-04-02 14:01:45 +02:00
dibrinsofor
eaa3ef9ddc
[DAG] Propagate OrZero and DemandedElts for min/max in isKnownToBeAPowerOfTwo (#182369)
Fixes #181643 

For queries like `isKnownToBeAPowerOfTwo(V, OrZero=true)`, if an operand
is known to be "pow2-or-zero" but not strictly non-zero power-of-two,
the min/max case currently returns false even when the result remains
pow2-or-zero.

For instance:
- `A = select cond, 4, 0`  (A is pow2-or-zero)
- `R = umin(A, 16)`

`R` is always in `{0, 4}` and querying `isKnownToBeAPowerOfTwo(R,
OrZero=true)` should be true.

Added unitests for baseline and failing case and now propagating
correctly to `OrZero` and `DemandedElts`
2026-04-02 12:50:11 +01:00
Simon Pilgrim
7410a81fbd
[X86] LowerShiftByScalarImmediate - vXi8 shl(X,2) - prefer PADDB+PADDB pair over PSLLW+PAND (#186095)
For all targets, (V)PADDB is always as fast as (V)PSLLW (usually faster)
- and usually as fast as (V)PAND, and avoids having to load a mask - so
for shift lefts by 2, a pair of (V)PADDB is a better choice vs
(V)PSLLW+(V)PAND

This is only necessary if we're avoiding a (V)PAND mask - otherwise we
just need a single (V)PSLLW.
2026-04-02 12:48:18 +01:00
Balázs Benics
803d1d6609
[clang][ssaf] Implement JSON format for CallGraph summary (#189681)
rdar://170258016
2026-04-02 12:14:46 +01:00
Kseniya Tikhomirova
c4b0f9959a
[libsycl] Add device image registration & compatibility check (#187528)
This is part of the SYCL support upstreaming effort. The relevant RFCs
can be found here:


https://discourse.llvm.org/t/rfc-add-full-support-for-the-sycl-programming-model/74080
https://discourse.llvm.org/t/rfc-sycl-runtime-upstreaming/74479

---------

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
2026-04-02 13:06:44 +02:00
Nikita Popov
72e8c9b78f
[CodeGen] Move llc-start-stop.ll test to X86 (#190151)
The pass pipeline differs across targets, so make this test use
one specific pipeline, instead of trying to cater to cross-target
differences. Those differences are not relevant to the intent of
the test.
2026-04-02 13:04:29 +02:00
Alexandros Lamprineas
64b728128d
[BOLT][AArch64] Add minimal support for liveness analysis. (#183298)
In this patch I am adding the missing target hooks required for the
liveness analysis to run on AArch64. These are
 - getFlagsReg()
 - getRegsUsedAsParams()
 - getDefaultLiveOut()
 - getGPRegs()
 - isCleanRegXOR()

I am also introducing the following API in LivenessAnalysis
 - BitVector getLiveIn/Out(const MCInst &)
 - MCPhysReg scavengeRegFromState(BitVector &)
 
My intention is to allow the LongJmp pass scavenge usable registers when
injecting code.
2026-04-02 11:59:59 +01:00
Arseniy Zaostrovnykh
3468ee025e
fixup! [publish-sphinx-docs] Forward CTU-import failure conditions
Fix the Sphinx build failure
https://lab.llvm.org/buildbot/#/builders/45/builds/24533
introduced in e3cfcf48d0c966f163c9807839a900936af0e759 (PR #189064)
by using a dedicated group for CTU remarks.
2026-04-02 10:52:46 +00:00
Michael Kruse
bed2761bc0
[Polly] Print params with stmt tracing (#189362)
It was helpful for #189350.
2026-04-02 10:51:39 +00:00
Alexey Bataev
94ec7ffa46
[SLP] Do not skip tiny trees with gathered loads to vectorize
The isTreeTinyAndNotFullyVectorizable check for 2-node trees
(insertelement root + gather child) was too aggressive: it rejected
trees even when LoadEntriesToVectorize was non-empty, preventing
gathered loads from being vectorized into masked loads/strided loads, etc.

Reviewers: RKSimon, hiraditya

Pull Request: https://github.com/llvm/llvm-project/pull/190040
2026-04-02 06:47:53 -04:00
Hristo Hristov
5613f77293
[libc++][ranges] Updated ranges::to [[nodiscard]] tests (#173574)
- Updated and moved `ranges::to` `[[nodiscard]]` tests to the new
conventinional location.
- Removed libcxx/test/libcxx/diagnostics/ranges.nodiscard.verify.cpp,
which is now obsolete in favor of more specific test files.

# References:

- https://wg21.link/range.utility.conv
- https://wg21.link/range.utility.conv.to
- https://wg21.link/range.utility.conv.adaptors

Towards #172124
2026-04-02 13:46:06 +03:00
Naveen Seth Hanig
0ef3906aea
[clang][modules-driver] Avoid copy of -cc1 command & const correctness (NFC) (#190142) 2026-04-02 10:44:50 +00:00
Valeriy Savchenko
f51e343ed5
[AArch64] Select REV16 for zext(bswap(i16)) (#189576)
Extend the existing any_extend(bswap i16) -> rev16 combine to also
handle zero_extend. REV16 preserves a zero upper half, so for i16 loads
this saves one instruction: ldrh+rev+lsr#16 -> ldrh+rev16.
2026-04-02 11:32:39 +01:00
Michael Kruse
afb80bddf1
[Runtimes] Introduce variables containing resource dir paths (#177953)
Introduce common infrastructure for runtimes that determines compiler
resource path locations. These variables introduced are:

 * RUNTIMES_OUTPUT_RESOURCE_DIR
 * RUNTIMES_INSTALL_RESOURCE_PATH
 
That contain the location for the compiler resource path (typically
`lib/clang/<version>`) in the build tree and the install tree (the
latter relative to CMAKE_INSTALL_PREFIX).

Additionally, define

 * RUNTIMES_OUTPUT_RESOURCE_LIB_DIR
 * RUNTIMES_INSTALL_RESOURCE_LIB_PATH

as for the location of clang/flang version-locked libraries (typically
`lib${LLVM_LIBDIR_SUFFIX}/<targer-triple>`, but also depends on `APPLE`
and `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR`). This code is moved from
flang-rt and initially becomes its only user.

Refactored out of #171610 as requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2687382481).

Extracted `get_runtimes_target_libdir_common` from compiler-rt as
requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2689565634).
 
Added TODO comments to all runtimes as requested
[here](https://github.com/llvm/llvm-project/pull/171610#issuecomment-3789598635).
2026-04-02 10:32:14 +00:00
Henrich Lauko
57ee29a2a1
[CIR] Implement isMemcpyEquivalentSpecialMember for trivial copy/move ctors (#186700)
Implements isMemcpyEquivalentSpecialMember in CIR codegen so that
trivial copy/move constructors and defaulted union copy/move ops emit a
cir.copy directly instead of making a real constructor call. The logic
is shared with OG codegen by moving the implementation into ASTContext,
where it also gains the pointer field protection (PFP) check that was
previously missing in CIR.
2026-04-02 12:31:53 +02:00
Nerixyz
91b90652bb
Reland "[CodeView] Generate S_DEFRANGE_REGISTER_REL_INDIR" (#189401)
Initially added in #187709. It was reverted in #188833, because
[llvm-clang-x86_64-sie-win](https://lab.llvm.org/buildbot/#/builders/46/builds/32873)
was failing in
`cross-project-tests/debuginfo-tests/dexter-tests/nrvo.cpp`.

The test passed for me locally. After checking on another machine, I
found that `S_DEFRANGE_REGISTER_REL_INDIR` is only supported by
dbgeng/WinDbg from Windows 10.0 Build 19041 (released 2020) onwards.
SDKs before this will fail to read the value. That buildbot is on
Windows 10.0 Build 17763.

I'm not sure if we should make the generation of that record
conditional. Debuggers that can't read the record will skip it. They'll
still see that there's some local variable, but won't be able to display
the value.

As far as I know, users of older Windows 10 builds should be able to
install a newer Windows SDK and use the WinDbg from that version. But I
haven't tested that.
2026-04-02 12:15:11 +02:00
David Spickett
c329cc59d9
[lldb][test][NFC] Move register command tests (#190144)
For whatever reason we ended up with register/register but the first
register just had the second register folder in it.

Move the files up one level so we have register/<test files>.
2026-04-02 11:13:44 +01:00
Ricardo Jesus
9ff2ef9711
[AArch64][SVE] Define pseudos for arithmetic immediate instructions. (#188579)
This patch uses DestructiveBinaryShImmUnpred (which was previously
unused as far as I could tell) to define pseudos for arithmetic
immediate instructions such as ADD (immediate), which allows using
MOVPRFX with these instructions.
2026-04-02 11:07:46 +01:00