543217 Commits

Author SHA1 Message Date
Andrzej Warzyński
6ecb6a8a8c
[mlir][vector][nfc] Rename populateVectorTransferCollapseInnerMostContiguousDimsPatterns (#145228)
Renames `populateVectorTransferCollapseInnerMostContiguousDimsPatterns`
as `populateDropInnerMostUnitDimsXferOpPatterns` + updates the
corresponding comments.

This addresses a TODO and makes the difference between these two
`populate*` methods clearer:
 * `populateDropUnitDimWithShapeCastPatterns`,
 * `populateDropInnerMostUnitDimsXferOpPatterns`.
2025-07-02 20:07:35 +01:00
Jonas Devlieghere
ab0fa6c5dc
[lldb] Fix else-after-return in Breakpoint (NFC)
The LLVM Coding Standards [1] discourages the use of 'else' or 'else if'
after something that interrupts control flow. Bulk fix all instances as
I'm working on this part of LLDB.

[1] https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
2025-07-02 12:07:20 -07:00
Andrei Golubev
a63f572628
[mlir][bufferization] Return BufferLikeType in BufferizableOpInterface (#144867)
Support custom types (2/N): allow value-owning operations (e.g.
allocation ops) to bufferize custom tensors into custom buffers. This
requires BufferizableOpInterface::getBufferType() to return
BufferLikeType instead of BaseMemRefType.

Affected implementors of the interface are updated accordingly.

Relates to ee070d08163ac09842d9bf0c1315f311df39faf1.
2025-07-02 11:27:35 -07:00
Joshua Batista
2ed7b22f0c
[HLSL] Add -Gis option to clang-dxc (#146448)
This PR adds the `-Gis` option to clang-dxc, to instruct the behavior to
enable IEEE strict mode. The purpose is so that clang-dxc behaves as DXC
does when it takes the -Gis option.
Fixes https://github.com/llvm/llvm-project/issues/145589
2025-07-02 11:22:42 -07:00
Maksim Panchenko
218fd69261
[BOLT] Decouple new segment creation from PHDR rewrite. NFCI (#146111)
Refactor handling of PHDR table rewrite to make modifications easier.
2025-07-02 11:22:12 -07:00
bd1976bris
da01257c3a
[Test] Account for spaces in paths in the new dtlto/files.test (#146749)
This uses LIT substitutions in a response file that could contain spaces
in paths. This caused a failure on a build bot where the path to the
system Python executable was "C:\Program Files\Python310\python.exe", as
reported in #142757.

Add appropriate quoting to fix the issue.
2025-07-02 19:20:09 +01:00
Justin King
e3edc1bd87
asan: refactor new/delete interceptor macros (#146696)
Refactors new/delete interceptor macros per the discussion in #145087.

Signed-off-by: Justin King <jcking@google.com>
2025-07-02 11:18:55 -07:00
Jason Molenda
00e071d690 [lldb] remove do-nothing defaults in case statements,
unbreak gcc CI bots.
2025-07-02 11:16:04 -07:00
Michael Jones
77d95911a3
Revert "Fix wcpncpy() return value; add test." (#146752)
This reverts commit 988876cdd918d5b945a072a3d643b5fa22ae2917.
Was intended to be a PR
2025-07-02 11:08:21 -07:00
enh-google
988876cdd9
Fix wcpncpy() return value; add test. 2025-07-02 14:00:02 -04:00
Jorge Gorbe Moya
dfc5987fac [bazel] Add missing dep after 242996efee4aaa30dd0ddb4359675b8bc103294a 2025-07-02 10:52:38 -07:00
Steven Perron
832cd2df0b
[SPIRV] Add option to add all KHR extensions (#145535)
In DXC, there is an option to enable all KHR extension. I would like to
extend the existing `-spirv-ext` backend commandline option to have the
same capability. It is like the special case for `all` execept it only
adds the `SPV_KHR_*` extensions.

Part of https://github.com/llvm/llvm-project/issues/137650.
2025-07-02 13:50:48 -04:00
Abhina Sree
a4d517dc38
[SystemZ][z/OS] Fix error about const char in Text Encoding (#146727)
This patch fixes the following error:
```
llvm/lib/Support/TextEncoding.cpp:274:11: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
  274 |     char *Input = InputLength ? const_cast<char *>(Source.data()) : "";
      |           ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2025-07-02 13:45:52 -04:00
Kazu Hirata
5e6e51bbbe
[Sema] Remove an unnecessary cast (NFC) (#146703)
The only use of Receiver is to initialize RecExpr.  This patch renames
Receiver to RecExpr while removing the cast statement.
2025-07-02 10:39:33 -07:00
Simon Pilgrim
aa8e1bc0e9
[X86] Add BLEND/UNPCK shuffles to canCreateUndefOrPoisonForTargetNode/isGuaranteedNotToBeUndefOrPoisonForTargetNode (#146728)
None of these implicitly generate UNDEF/POISON
2025-07-02 18:38:00 +01:00
Davide Grohmann
bf016b930b
[mlir][spirv] Add support for SPV_ARM_tensors (#144667)
This patch introduces a new custom type `!spirv.arm.tensor<>` to the
MLIR SPIR-V dialect to represent
`OpTypeTensorARM` as defined in the `SPV_ARM_tensors` extension.

The type models a shaped tensor with element type and optional shape,
and implements the
`ShapedType` interface to enable reuse of MLIR's existing shape-aware
infrastructure.

The type supports serialization to and from SPIR-V binary as
`OpTypeTensorARM`, and emits the
required capability (`TensorsARM`) and extension (`SPV_ARM_tensors`)
declarations automatically.

This addition lays the foundation for supporting structured tensor
values natively in SPIR-V and
will enable future support for operations defined in the
`SPV_ARM_tensors` extension, such as
`OpTensorReadARM`, `OpTensorWriteARM`, and `OpTensorQuerySizeARM`.

Reference: https://github.com/KhronosGroup/SPIRV-Registry/pull/342

---------

Signed-off-by: Davide Grohmann <davide.grohmann@arm.com>
Signed-off-by: Mohammadreza Ameri Mahabadian <mohammadreza.amerimahabadian@arm.com>
2025-07-02 13:36:31 -04:00
Kazu Hirata
1626867ccd [lldb] Fix warnings
This patch fixes:

  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:415:7:
  error: label at end of compound statement is a C++23 extension
  [-Werror,-Wc++23-extensions]

  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:536:7:
  error: label at end of compound statement is a C++23 extension
  [-Werror,-Wc++23-extensions]

  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:672:7:
  error: label at end of compound statement is a C++23 extension
  [-Werror,-Wc++23-extensions]
2025-07-02 10:32:47 -07:00
Rahman Lavaee
6b623a6622
[SHT_LLVM_BB_ADDR_MAP] Remove support for versions 1 and 0 (SHT_LLVM_BB_ADDR_MAP_V0). (#146186)
Version 2 was added more than two years ago
(6015a045d7).
So it should be safe to deprecate older versions.
2025-07-02 10:31:52 -07:00
Tom Tromey
cbfc10260c
Fix lld crash caused by dynamic bit offset patch (#146701)
PR #141106 changed the debuginfo metdata to allow dynamic bit offsets
and sizes. This caused a crash in lld when using LTO.

The problem is that lazyLoadOneMetadata assumes that the metadata in
question can be cast to MDNode; but in the typical case where the offset
is a constant, this is not true.

This patch changes this spot to allow non-MDNodes through.

The included test case comes from the report in #141106.
2025-07-02 10:30:34 -07:00
Joseph Huber
50f40a5327
[libc] Fix internal alignment in allcoator (#146738)
Summary:
The allocator interface is supposed to have 16 byte alignment (to keep
it consistent with the CPU allocator. We could probably drop this to 8
if desires.) But this was not enforced because the number of bytes used
for the bitfield sometimes resulted in alignment of 8 instead of 16.
Explicitly align the number of bytes to be a multiple of 16 even if
unused.
2025-07-02 12:29:01 -05:00
Amr Hesham
e9be5286e1
[CIR] Implement NotEqualOp for ComplexType (#146129)
This change adds support for the not equal operation for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-02 19:25:25 +02:00
Zhuoran Yin
6a97b56ce5
[MLIR][AMDGPU] Redirect transfer read to masked load lowering (#146705)
This PR reworks https://github.com/llvm/llvm-project/pull/131803.
Instead of applying the optimization on transfer_read op, which is too
high level, it redirect the pre-existing pattern onto maskedload op.
This simplified the implementation of the lowering pattern. This also
allows moving the usage of the pass to a target dependent pipeline.

Signed-off-by: jerryyin <zhuoryin@amd.com>
2025-07-02 18:24:44 +01:00
Jason Molenda
dfcef35ff1
[lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (#146480)
While fixing bugs in the x86_64 LC_THREAD parser in ObjectFileMachO, I
noticed that the other LC_THREAD parsers are all less clear than they
should be.

To recap, a Mach-O LC_THREAD load command has a byte size for the entire
payload. Within the payload, there will be one or more register sets
provided. A register set starts with a UInt32 "flavor", the type of
register set defined in the system headers, and a UInt32 "count", the
number of UInt32 words of memory for this register set. After one
register set, there may be additional sets. A parser can skip an unknown
register set flavor by using the count field to get to the next register
set. When the total byte size of the LC_THREAD load command has been
parsed, it is completed.

This patch fixes the riscv/arm/arm64 LC_THREAD parsers to use the total
byte size as the exit condition, and to skip past unrecognized register
sets, instead of stopping parsing.

Instead of fixing the i386 corefile support, I removed it. The last
macOS that supported 32-bit Intel code was macOS 10.14 in 2018. I also
removed i386 KDP support, 32-bit intel kernel debugging hasn't been
supported for even longer than that.

It would be preferable to do these things separately, but I couldn't
bring myself to update the i386 LC_THREAD parser, and it required very
few changes to remove this support entirely.
2025-07-02 10:21:38 -07:00
Adam Glass
ed27f18e32
__sys builtin support for AArch64 (#146456)
Adds support for __sys Clang builtin for AArch64

__sys is a long existing MSVC intrinsic used to manage caches, tlbs, etc
by writing to system registers:
* It takes a macro-generated constant and uses it to form the AArch64 SYS instruction which is MSR with op0=1. The macro drops op0 and expects the implementation to hardcode it to 1 in the encoding.
* Volume use is in systems code (kernels, hypervisors, boot environments, firmware)
* Has an unused return value due to MSVC cut/paste error

Implementation:
* Clang builtin, sharing code with Read/WriteStatusReg
* Hardcodes the op0=1
* Explicitly returns 0
* Code-format change from clang-format
* Unittests included
* Not limited to MSVC-environment as its generally useful and neutral
2025-07-02 10:17:01 -07:00
Andrei Safronov
de4f283d14
[Xtensa] Fix XtensaELFObjectWriter. (#146731)
The "XtensaMCExpr.h" used by XtensaELFObjectWriter was removed by
previous commit. And functionality from this file is now implemented in
"XtensaMCAsmInfo.h". So, fix this situation.
2025-07-02 20:06:57 +03:00
Jun Wang
641ad52b6a
[AMDGPU][MC] Fix disassembly for v_permlane16_swap_b32 for GFX950 (#146600)
When targeting GFX950, disassembly of v_permlane16_swap_b32 and
v_permlane32_swap_b32 instructions produces errors when they use certain
vdst operand values, e.g., v_permlane16_swap_b32 v218, v219. This patch
fixes this problem.
2025-07-02 10:05:25 -07:00
Rahul Joshi
2fe0feb848
[LLVM][AsmWriter] Print a comment for unknown intrinsics (#146726)
Unknown intrinsics are functions that begin with `llvm.` but are not an
intrinsic that is recognized by LLVM. Add a comment before such
functions in LLVM IR assembly to indicate that they are unknown
intrinsics.
2025-07-02 10:02:26 -07:00
Craig Topper
b62826cc05
[InstrEmitter] Use AddOperand in EmitCopyToRegClassNode. (#146637)
This is alternative to #145965 that allows RegisterSDNode to be handled
without making a special case.
2025-07-02 09:44:54 -07:00
Kazu Hirata
191583c6a5
[mlir] Remove unused includes (NFC) (#146709) 2025-07-02 09:32:39 -07:00
Kazu Hirata
bbf4402635
[Analysis] Remove a redundant control flow statement (NFC) (#146708) 2025-07-02 09:32:30 -07:00
Kazu Hirata
0f1accd806
[clangd] Drop const from a return type (NFC) (#146707)
We don't need const on the return type.
2025-07-02 09:32:23 -07:00
Kazu Hirata
4461de2e51
[StaticAnalyzer] Remove unnecessary casts (NFC) (#146706)
N is already of ExplodedNode *.
2025-07-02 09:32:15 -07:00
Jay Foad
e717e503ca
[AMDGPU] Fix comment on DelayInfo::advance (#146718) 2025-07-02 17:18:57 +01:00
Callum Fare
3c0571a749
[Offload] Add missing license header to Common.td (#146737)
All other tablegen files in this directory have the license header, but
`Common.td` is missing it
2025-07-02 17:17:30 +01:00
Gábor Spaits
338fd8b12c
[SimplifyCFG] Transform switch to select when common bits uniquely identify one case (#145233)
Fix #141753 .

This patch introduces a new check, that tries to decide if the
conjunction of all the values uniquely identify the accepted values by
the switch.
2025-07-02 18:16:12 +02:00
Steven Perron
68173c8091
[HLSL][SPRIV] Handle signed RWBuffer correctly (#144774)
In Vulkan, the signedness of the accesses to images has to match the
signedness of the backing image.
    
See

https://docs.vulkan.org/spec/latest/chapters/textures.html#textures-input,
where it says the behaviour is undefined if
    
> the signedness of any read or sample operation does not match the
signedness of the image’s format.
    
Users who define say an `RWBuffer<int>` will create a Vulkan image with
a signed integer format. So the HLSL that is generated must match that
expecation.
    
The solution we use is to generate a `spirv.SignedImage` target type for
signed integer instead of `spirv.Image`. The two types are otherwise the
same.
    
The backend will add the `signExtend` image operand to access to the
image to ensure the image is access as a signed image.
    
Fixes #144580
2025-07-02 12:09:47 -04:00
Piotr Fusik
1c305f711f
[HashRecognize][NFC] Add a missing "phi" in a comment (#146702) 2025-07-02 17:57:26 +02:00
Mircea Trofin
7e1dc7e8d4
[nfc] Rename API with typo in BranchProbabilityInfo (#146447) 2025-07-02 08:54:03 -07:00
Tom Eccles
16b75c819d
[mlir][OpenMP] implement SIMD reduction (#146671)
This replicates clang's implementation. Basically:
- A private copy of the reduction variable is created, initialized to
the reduction neutral value (using regions from the reduction
declaration op).
- The body of the loop is lowered as usual, with accesses to the
reduction variable mapped to the private copy.
- After the loop, we inline the reduction region from the declaration op
to combine the privatized variable into the original variable.
- As usual with the SIMD construct, attributes are added to encourage
vectorization of the loop and to assert that memory accesses in the loop
don't alias across iterations.

I have verified that simple scalar examples do vectorize at -O3 and the
tests I could find in the Fujitsu test suite produce correct results. I
tested on top of #146097 and this seemed to work for composite
constructs as well.

Fixes #144290
2025-07-02 16:49:34 +01:00
Luke Lau
7931a8f102
[VectorCombine] Scalarize vector intrinsics with scalar arguments (#146530)
Some intrinsics like llvm.abs or llvm.powi have a scalar argument even
when the overloaded type is a vector.
This patch handles these in scalarizeOpOrCmp to allow scalarizing them.

In the test the leftover vector powi isn't folded away to poison, this
should be fixed in a separate patch.
2025-07-02 16:48:53 +01:00
Louis Dionne
05ebb363c9
[libc++] Re-add a script to trigger the libc++ Buildkite pipeline (#146730)
This was removed in 99cdc26c94 when the LLVM monorepo Buildkite setup
was removed. Libc++ previously relied on the LLVM monorepo pipeline to
trigger its own pipeline when needed. Since there is no LLVM monorepo
pipeline anymore, we must trigger the libc++ Buildkite pipeline on every
pull request and use this script to determine which jobs to actually
start based on the files that are touched by the PR.
2025-07-02 11:43:19 -04:00
Ross Brunton
7d52b0983e
[Offload] Add MAX_WORK_GROUP_SIZE device info query (#143718)
This adds a new device info query for the maximum workgroup/block size
for each dimension.
2025-07-02 16:33:54 +01:00
Akash Banerjee
ab42c4abe8 [NFC] Replace "omp.default.mapper" with llvm::omp::OmpDefaultMapperName. 2025-07-02 16:29:52 +01:00
Sirui Mu
1841b021c6
[CIR] Add OptInfo attribute (#146261)
This patch adds the `#cir.opt_info` attribute which holds module-level
optimization information.
2025-07-02 23:29:43 +08:00
Andres-Salamanca
ce99db9d1b
[CIR] Add mlir-translate to CMake (#146608)
This PR adds the `mlir-translate` dependency to CIR.

The following test was failing when running `ninja check-clang-cir`:

```
CIR/Lowering/stack-save-restore.cir  
line 2: mlir-translate: command not found
```

The failure occurred because `mlir-translate` was not being built as
part of the CIR test dependencies. This PR ensures that the target is
properly built so the test can run successfully.
2025-07-02 10:28:38 -05:00
Joseph Huber
d04d255725
[Clang] Properly use CommaJoined for --offload-arch (#146687)
Summary:
This didn't use the built-in 'CommaJoined' feature for arguments and
parsed out the strings manually. This patch simplifies this by just
using the present functionality.
2025-07-02 10:26:32 -05:00
Nikita Popov
d74d4ffa33 [Bitcode] Extract common BitCodeAbbrevOps (NFC)
We always use the same abbreviations for type and for value
references, so avoid repeating them.
2025-07-02 17:17:57 +02:00
Kareem Ergawy
b1774222c7
[flang] Emit fir.global in the global address space (#146653)
Instead of emitting globals in the program/default address space, emit
them in the global address space. This also requires changes how address
of code-gen is handled, we need to cast to the default address space to
prevent code-gen issues.
2025-07-02 17:15:22 +02:00
bd1976bris
3b4e79398d
[DTLTO][LLD][ELF] Add support for Integrated Distributed ThinLTO (#142757)
This patch introduces support for Integrated Distributed ThinLTO (DTLTO)
in ELF LLD.

DTLTO enables the distribution of ThinLTO backend compilations via
external distribution systems, such as Incredibuild, during the
traditional link step: https://llvm.org/docs/DTLTO.html.

It is expected that users will invoke DTLTO through the compiler driver
(e.g., Clang) rather than calling LLD directly. A Clang-side interface
for DTLTO will be added in a follow-up patch.

Note: Bitcode members of archives (thin or non-thin) are not currently
supported. This will be addressed in a future change. As a consequence
of this lack of support, this patch is not sufficient to allow for
self-hosting an LLVM build with DTLTO. Theoretically,
--start-lib/--end-lib could be used instead of archives in a self-host
build. However, it's unclear how --start-lib/--end-lib can be easily
used with the LLVM build system.

Testing:
- ELF LLD `lit` test coverage has been added, using a mock distributor
  to avoid requiring Clang.
- Cross-project `lit` tests cover integration with Clang.

For the design discussion of the DTLTO feature, see: #126654.
2025-07-02 16:12:27 +01:00
Michael Buch
e32439249d
[lldb][test] Consolidate generic and libcxx std::deque formatter tests (#146697)
The plan is to move all STL formatter API tests into a single directory.

The `std::deque` test is currently the only test that is duplicated
between the `libcxx` and `generic` directories. This patch moves the
libcxx deque tests into `generic` (moving over any functionality that
wasn't tested in the `generic` tests, mainly formatting
pointers/references to `std::deque`).
2025-07-02 16:05:09 +01:00