549049 Commits

Author SHA1 Message Date
Helena Kotas
eb3d88423d
[HLSL] Global resource arrays element access (#152454)
Adds support for accessing individual resources from fixed-size global resource arrays.

Design proposal:
https://github.com/llvm/wg-hlsl/blob/main/proposals/0028-resource-arrays.md

Enables indexing into globally scoped, fixed-size resource arrays to retrieve individual resources. The initialization logic is primarily handled during codegen. When a global resource array is indexed, the
codegen translates the `ArraySubscriptExpr` AST node into a constructor call for the corresponding resource record type and binding.

To support this behavior, Sema needs to ensure that:
- The constructor for the specific resource type is instantiated.
- An implicit binding attribute is added to resource arrays that lack explicit bindings (#152452).

Closes #145424
2025-08-18 18:20:46 -07:00
Mariusz Borsa
0c512f7897
[Sanitizers][Test] narrower constraint for XFAIL (#154245)
It's a followup to https://github.com/llvm/llvm-project/pull/154189 ,
which broke test on android bot. Making sure XFAIL only happen on darwin
bots

rdar://158543555

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-08-18 18:17:25 -07:00
ZhaoQi
3acb7093c2
[LoongArch][NFC] Add tests for fixing missed addsub relocs when enabling relax (#154108) 2025-08-19 09:15:23 +08:00
Lang Hames
ee7a6a45bd
[ORC-RT] Initial check-in for a new, top-level ORC runtime project. (#113499)
Includes CMake files and placeholder header, library, test tool, regression
test and unit test.

The aim for this project is to create a replacement for the existing ORC
Runtime that currently resides in `llvm-project/compiler-rt/lib/orc`. The new
project will provide a superset of the original features, and the old runtime
will be removed once the new runtime is sufficiently developed.

See discussion at
https://discourse.llvm.org/t/rfc-move-orc-executor-support-into-top-level-project/81049
2025-08-19 10:56:18 +10:00
Mel Chen
1dac302ce7
[LV] Explicitly disallow interleaved access requiring gap mask for scalable VFs. nfc (#154122)
Currently, VPInterleaveRecipe::execute does not support generating LLVM
IR for interleaved accesses that require a gap mask for scalable VFs.
It would be better to detect and prevent such groups from being
vectorized as interleaved accesses in
LoopVectorizationCostModel::interleavedAccessCanBeWidened, rather than
relying on the TTI function getInterleavedMemoryOpCost to return an
invalid cost.
2025-08-19 08:42:39 +08:00
Jordan Rupprecht
fb4450c459
[bazel] Add more load statements for C++ rules (#154207)
Same thing as #149584, but for more elements of cc_rules (e.g.
`CcInfo`), and applying it to some files that were added since then
(build files under mlir/examples).

Command: `buildifier --lint=fix
--warnings=native-cc-binary,native-cc-import,native-cc-library,native-cc-objc-import,native-cc-objc-library,native-cc-shared-library,native-cc-test,native-cc-toolchain,native-cc-toolchain-suite,native-cc-fdo-prefetch-hints,native-cc-fdo-profile,native-cc-memprof-profile,native-cc-propeller-optimize,native-cc-common,native-cc-debug-package-info,native-cc-info,native-cc-shared-library-info,native-cc-shared-library-hint-info`
2025-08-18 19:41:49 -05:00
Muhammad Bassiouni
523c3a0197
[libc][math] fix coshf16 build errors. (#154226) 2025-08-19 03:39:24 +03:00
Oliver Hunt
62d2a8e682
[NFC][Clang][Docs] Update Pointer Authentication documentation (#152596)
This updates the pointer authentication documentation to include a
complete description of the existing functionaliy and behaviour, details
of the more complex aspects of the semantics and security properties,
and the Apple arm64e ABI design.

Co-authored-by: Ahmed Bougacha
Co-authored-by: Akira Hatanaka
Co-authored-by: John Mccall

---------

Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org>
Co-authored-by: Akira Hatanaka <ahatanak@gmail.com>
Co-authored-by: John Mccall <rjmccall@apple.com>
2025-08-18 17:27:36 -07:00
Craig Topper
6c0518a88f
[RISCV] Prioritize zext.h/zext.w over XTheadBb th.extu. (#154186)
Fixes #154125.
2025-08-18 16:56:57 -07:00
Craig Topper
396dfdf7be
[RISCV] Remove -O0 from rv32xandesperf.ll. NFC (#154224)
Invert icmp conditions in test input to make the tests generate the expected branch instructions.
2025-08-18 16:56:38 -07:00
Wenju He
a450dc80bf
[libclc] Implement __clc_get_local_size/__clc_get_max_sub_group_size for amdgcn (#153785)
This simplifies downstream refactoring of libspirv workitem function in
https://github.com/intel/llvm/tree/sycl/libclc/libspirv/lib/generic
2025-08-19 07:51:17 +08:00
Jesse Schwartzentruber
4d2288d318
[compiler-rt] [test] Add test for frame counter out of order. (#154190)
Add test for #148278. This was written with the aide of ChatGPT 5 and
tested on Linux x86_64.
2025-08-18 16:22:57 -07:00
Stanislav Mekhanoshin
3ef3b30c3c
Revert "[AMDGPU] Fold copies of constant physical registers into their uses (#154183)" (#154219)
This reverts commit 3395676a18ab580f21ebcd4324feaf1294a8b6d9.

Fails
libc/test/src/string/libc.test.src.string.memmove_test.__hermetic__
2025-08-18 16:22:47 -07:00
Florian Mayer
19474672e5
[UBSan] [min-rt] make minimal runtime handlers weak (#154220)
This allows people to override them, if they want.
2025-08-18 16:19:31 -07:00
Muhammad Bassiouni
2c79dc1082
[libc][math] Refactor coshf16 implementation to header-only in src/__support/math folder. (#153582)
Part of #147386

in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-08-19 02:08:07 +03:00
Andy Kaylor
7ac4d9bd53
[CIR] Add support for calling virtual functions (#153893)
This change adds support for calling virtual functions. This includes
adding the cir.vtable.get_virtual_fn_addr operation to lookup the
address of the function being called from an object's vtable.
2025-08-18 15:56:33 -07:00
Sergei Barannikov
61a859bf6f Use llvm::copy instead of append_range to work around MacOS build failure 2025-08-19 01:43:22 +03:00
Mariusz Borsa
4dc32df3ca
[Sanitizers][Test] XFAIL suppressions/fread_fwrite (#154189)
These tests are failing on current macOS version installed on Apple bot

rdar://158543555

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-08-18 15:37:06 -07:00
Mariusz Borsa
0d9346e5e9
[Sanitizers][Test] XFAIL array cookie tests on arm (#154031)
Poisoning of C++ array redzones is only implemented for x86 CPUs. New
arm64 bots are being brought up, where these test fail.

Original C++ arrays shadow poisoning change:

http://reviews.llvm.org/D4774

rdar://158025391

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-08-18 15:36:24 -07:00
Sergei Barannikov
0cd4ae9be0
Reland "[TableGen][DecoderEmitter] Store HW mode ID instead of name (NFC) (#154052)" (#154212)
This reverts commit 5612dc533a9222a0f5561b2ba7c897115f26673f.

Reland with MacOS build fixed.
2025-08-18 22:28:20 +00:00
Stanislav Mekhanoshin
a26c3e9491
[AMDGPU] User SGPR count increased to 32 on gfx1250 (#154205) 2025-08-18 15:04:56 -07:00
Daniel Paoliello
a4cff34f3f
[win][x64] Permit lea to adjust the stack when using unwind v2 (#154171)
In some cases `leaq` may be used to adjust the stack in an epilog, this
is permitted by unwind v2 and shouldn't raise an error.
2025-08-18 15:00:59 -07:00
Peter Klausler
50a40738d6
[flang] Catch semantic error with LBOUND/UBOUND (#154184)
The "ARRAY=" argument to these intrinsics cannot be scalar, whether
"DIM=" is present or not. (Allowing the "ARRAY=" argument to be scalar
when "DIM=" is absent would be a conceivable extension returning an
empty result array, like SHAPE() does with extents, but it doesn't seem
useful in a programming language without compilation-time rank
polymorphism apart from assumed-rank dummy arguments, and those are
supported.)

Fixes https://github.com/llvm/llvm-project/issues/154044.
2025-08-18 14:45:38 -07:00
Peter Klausler
638f8636df
[flang][runtime] Account for missing READ(SIZE=) characters (#153967)
One of the two formatted real input paths was failing to call GotChar()
to account for the characters that it consumes.

Fixes https://github.com/llvm/llvm-project/issues/153830.
2025-08-18 14:45:14 -07:00
Peter Klausler
9a7a16c8d5
[flang][runtime] Allow child NAMELIST input to advance records (#153963)
NAMELIST input in child I/O is rare, and it's not clear in the standard
whether it should be allowed to advance to later records in the parent
unit. But GNU Fortran supports it, and there's no good reason not to do
so since a NAMELIST input group that isn't terminated on the same line
is otherwise going to be a fatal error.

Fixes https://github.com/llvm/llvm-project/issues/153416.
2025-08-18 14:44:48 -07:00
Peter Klausler
ffec266980
[flang][runtime] Catch bad OPEN specifiers for unformatted files (#153707)
When an OPEN statement has specifiers that are allowed only for
formatted files, detect an error when the file turns out to be
unformatted.

Fixes https://github.com/llvm/llvm-project/issues/153480.
2025-08-18 14:44:23 -07:00
Peter Klausler
c53792b278
[flang][runtime] OPEN(existingUnit,POSITION=) (#153688)
Ensure that when a connected unit is reopened with POSITION='REWIND' or
'APPEND', and a STATUS='OLD' or unspecified, that it is actually
repositioned as requested.

Fixes https://github.com/llvm/llvm-project/issues/153426.
2025-08-18 14:44:00 -07:00
Peter Klausler
2cf982c0f5
[flang] Don't duplicate impure function call for UBOUND() (#153648)
Because the per-dimension information in a descriptor holds an extent
and a lower bound, but not an upper bound, the calculation of the upper
bound sometimes requires that the extent and lower bound be extracted
from a descriptor and added together, minus 1. This shouldn't be
attempted when the NamedEntity of the descriptor is something that
shouldn't be duplicated and used twice; specifically, it shouldn't apply
to NamedEntities containing references to impure functions as parts of
subscript expressions.

Fixes https://github.com/llvm/llvm-project/issues/153031.
2025-08-18 14:43:13 -07:00
Matthias Braun
48232594a0
llvm-profgen: Options cleanup / fixes (#147632)
- Add `cl::cat(ProfGenCategory)` to non-hidden options so they show up
  in `--help` output.
- Introduce `Options.h` for options referenced in multiple files.
2025-08-18 21:42:55 +00:00
Peter Klausler
50b55a5ee9
[flang][runtime] Fix AllocateAssignmentLHS for monomorphic LHS (#153073)
When the left-hand side of an assignment statement is an allocatable
that has a monomorphic derived type, and the right-hand side of the
assignment has a type that is an extension of that type, *don't* change
the incoming type or element size of the descriptor before allocating
it.

Fixes https://github.com/llvm/llvm-project/issues/152758.
2025-08-18 14:42:16 -07:00
Oliver Hunt
ec4e6aaac4
[clang][ObjC] Fix incorrect return type inference for discarded blocks (#154109)
When parsing a block expression we were not entering a new eval context
and as a result when parsing the block body we continue to treat any
return statements as discarded so infer a `void` result.

This fixes the problem by introducing an evaluation context around the
parsing of the body.
2025-08-18 14:38:50 -07:00
Shubham Sandeep Rastogi
5612dc533a Revert "[TableGen][DecoderEmitter] Store HW mode ID instead of name (NFC) (#154052)"
This reverts commit b20bbd48e8b1966731a284b4208e048e060e97c2.

Reverted due to greendragon failures:

20:34:43  In file included from /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/utils/TableGen/DecoderEmitter.cpp:14:
20:34:43  In file included from /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/utils/TableGen/Common/CodeGenHwModes.h:14:
20:34:43  In file included from /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/DenseMap.h:20:
20:34:43  In file included from /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/STLExtras.h:21:
20:34:43  In file included from /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/Hashing.h:53:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/algorithm:1913:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/chrono:746:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__chrono/convert_to_tm.h:19:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__chrono/statically_widen.h:17:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__format/concepts.h:17:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__format/format_parse_context.h:15:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/string_view:1027:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/functional:515:
20:34:43  In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/boyer_moore_searcher.h:26:
20:34:43  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:1376:19: error: object of type 'llvm::const_set_bits_iterator_impl<llvm::SmallBitVector>' cannot be assigned because its copy assignment operator is implicitly deleted
20:34:43              __mid =  __first;
20:34:43                    ^
20:34:43  /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/utils/TableGen/DecoderEmitter.cpp:2404:13: note: in instantiation of function template specialization 'std::vector<unsigned int>::assign<llvm::const_set_bits_iterator_impl<llvm::SmallBitVector>, 0>' requested here
20:34:43    HwModeIDs.assign(BV.set_bits_begin(), BV.set_bits_end());
20:34:43              ^
20:34:43  /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/BitVector.h:35:21: note: copy assignment operator of 'const_set_bits_iterator_impl<llvm::SmallBitVector>' is implicitly deleted because field 'Parent' is of reference type 'const llvm::SmallBitVector &'
20:34:43    const BitVectorT &Parent;
20:34:43                      ^
20:34:43  1 warning and 1 error generated.
2025-08-18 14:36:54 -07:00
Stanislav Mekhanoshin
668e6492b8
[AMDGPU] Support merging of flat GVS ops (#154200) 2025-08-18 14:31:41 -07:00
Sergei Barannikov
13dd65096b [TableGen][DecoderEmitter] Rename some variables for clarity (NFC) 2025-08-19 00:16:56 +03:00
Oleksandr T.
c2eb895c20
[Clang] improve -Wstring-concatenation to warn on every missing comma in initializer lists (#154018)
Fixes #153745

---

This PR addresses a limitation in `-Wstring-concatenation`, where only
the first missing comma in an initializer list was diagnosed.
2025-08-19 00:10:53 +03:00
Aiden Grossman
8a0b3cc089
[CI] Ignore upload artifact failures (#154196)
Some CI runs are seeing issues with failures running the artifact upload
step. They seem related to
https://github.com/actions/upload-artifact/issues/569. We should
continue the workflow and ignore errors in the upload artifact step if
it fails so that users do not see a red CI that is not due to their
changes.

Fixes #154155.
2025-08-18 14:10:23 -07:00
Mehdi Amini
89abccc9a6
[MLIR] Update GreedyRewriter to use the LDBG() debug log mechanism (NFC) (#153961)
Also improve a bit the LDBG() implementation
2025-08-18 21:05:34 +00:00
Mehdi Amini
8c605bd1f4
[MLIR] Add logging to eraseUnreachableBlocks (NFC) (#153968) 2025-08-18 21:02:53 +00:00
Stanislav Mekhanoshin
906c9e9542
[AMDGPU] Remove misplaced assert. (#154187)
The assert that RegScavenger required for long branching is now
placed below the code to use s_add_pc64, where it is actually
used.
2025-08-18 13:58:54 -07:00
Florian Hahn
79be94c984
[VPlan] Compute cost single-scalar calls in computeCost. (NFC)
Compute the cost of non-intrinsic, single-scalar calls directly in
VPReplicateRecipe::computeCost.

This starts moving call cost computations to VPlan, handling the
simplest case first.
2025-08-18 21:56:56 +01:00
Jonas Devlieghere
d8208b0575
Revert "[lldb] Relax the error message in TestProcessCrashInfo.py" (#154197)
Reverts llvm/llvm-project#153653 because older versions of macOS do not
use the same prefix.
2025-08-18 20:53:12 +00:00
Mehdi Amini
dfaebe7f48
[MLIR] Fix Liveness analysis handling of unreachable code (#153973)
This patch is forcing all values to be initialized by the
LivenessAnalysis, even in dead blocks. The dataflow framework will skip
visiting values when its already knows that a block is dynamically
unreachable, so this requires specific handling.
Downstream code could consider that the absence of liveness is the same
a "dead".
However as the code is mutated, new value can be introduced, and a
transformation like "RemoveDeadValue" must conservatively consider that
the absence of liveness information meant that we weren't sure if a
value was dead (it could be a newly introduced value.

Fixes #153906
2025-08-18 20:50:36 +00:00
Mehdi Amini
191e7eba93
[MLIR] Stop visiting unreachable blocks in the walkAndApplyPatterns driver (#154038)
This is similar to the fix to the greedy driver in #153957 ; except that
instead of removing unreachable code, we just ignore it.

Operations like:

```
%add = arith.addi %add, %add : i64
```

are legal in unreachable code.
Unfortunately many patterns would be unsafe to apply on such IR and can
lead to crashes or infinite loops.
2025-08-18 20:46:59 +00:00
Oliver Hunt
624b724ca6
[clang][PAC] ptrauth_qualifier and ptrauth_intrinsic should only be available on Darwin (#153912)
For backwards compatibility reasons the `ptrauth_qualifier` and
`ptrauth_intrinsic` features need to be testable with `__has_feature()`
on Apple platforms, but for other platforms this backwards compatibility
issue does not exist.

This PR resolves these issues by making the `ptrauth_qualifier` and
`ptrauth_intrinsic` tests conditional upon a darwin target. This also
allows us to revert the ptrauth_qualifier check from an extension to a
feature test again, as is required on these platforms.

At the same time we introduce a new predefined macro `__PTRAUTH__` that
answers the same question as `__has_feature(ptrauth_qualifier)` and
`__has_feature(ptrauth_intrinsic)` as those tests are synonymous and
only exist separately for compatibility reasons.

The requirement to test for the `__PTRAUTH__` macro also resolves the
hazard presented by mixing the `ptrauth_qualifier` flag (that impacts
ABI and security policies) with `-pedantics-errors`, which makes
`__has_extension` return false for all extensions.

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2025-08-18 20:29:26 +00:00
Charitha Saumya
9617ce4862
[vector][distribution] Bug fix in moveRegionToNewWarpOpAndAppendReturns (#153656) 2025-08-18 13:26:08 -07:00
Stanislav Mekhanoshin
13716843eb
[AMDGPU] Make s_setprio_inc_wg a scheduling boundary (#154188) 2025-08-18 13:20:38 -07:00
Thurston Dang
4220538e25
[msan] Handle multiply-add-accumulate; apply to AVX Vector Neural Network Instructions (VNNI) (#153927)
This extends the pmadd handler (recently improved in https://github.com/llvm/llvm-project/pull/153353) to three-operand intrinsics (multiply-add-accumulate), and applies it to the AVX Vector Neural Network Instructions.

Updates the tests from https://github.com/llvm/llvm-project/pull/153135
2025-08-18 13:18:27 -07:00
Jordan Rupprecht
462929183c
[bazel] Port #153497: reland clang modules scanner change (#154192) 2025-08-18 20:15:12 +00:00
Stanislav Mekhanoshin
3395676a18
[AMDGPU] Fold copies of constant physical registers into their uses (#154183)
With current codegen this only affects src_flat_scratch_base_lo/hi.

Co-authored-by: Jay Foad <Jay.Foad@amd.com>

Co-authored-by: Jay Foad <Jay.Foad@amd.com>
2025-08-18 13:07:36 -07:00
Stanislav Mekhanoshin
c328c5d911
[AMDGPU] Combine to bf16 reciprocal square root. (#154185)
Co-authored-by: Ivan Kosarev <Ivan.Kosarev@amd.com>

Co-authored-by: Ivan Kosarev <Ivan.Kosarev@amd.com>
2025-08-18 13:07:20 -07:00