544283 Commits

Author SHA1 Message Date
Jorge Gorbe Moya
00dd6660c2
Add back fallthrough annotations removed by 7f3afab (#148032)
The original commit removed them to avoid the dependency on llvm Support
because of LLVM_FALLTHROUGH, but this triggers `-Wimplicit-fallthrough`
warnings.

LLVM requires a C++17 compiler now, so we should be able to use the
standard [[fallthrough]] attribute.
2025-07-10 12:02:34 -07:00
Nikolas Klauser
03f6f48b73
[libc++] Move a few tests into more correct places (#147557) 2025-07-10 20:55:07 +02:00
Jessica Clarke
9320d1d484
[compiler-rt] Don't handle Linux-specific shmctl commands in sanitizer (#143116)
Despite being defined in the system headers, these commands are not in
fact part of the FreeBSD system call interface. They exist solely for
the Linuxulator, i.e. running Linux binaries on FreeBSD, and any attempt
to use them from a FreeBSD binary will return EINVAL. The fact we needed
to define _KERNEL (which, as the name implies, means we are compiling
the kernel) to even get the definition of shminfo should have been a
strong indicator that IPC_INFO at least was not a userspace interface.
2025-07-10 19:33:24 +01:00
Artem Chikin
a7091951f0
[APINotes] Add support for capturing all possible versioned APINotes without applying them
Swift-versioned API notes get applied at PCM constrution time relying on
'-fapinotes-swift-version=X' argument to pick the appropriate version.
This change adds a new APINotes application mode with
'-fswift-version-independent-apinotes' which causes *all* versioned API
notes to get recorded into the PCM wrapped in 'SwiftVersionedAttr'
instances. The expectation in this mode is that the Swift client will
perform the required transformations as per the API notes on the client
side, when loading the PCM, instead of them getting applied on the
producer side. This will allow the same PCM to be usable by Swift
clients building with different language versions.

In addition to versioned-wrapping the various existing API notes
annotations which are carried in declaration attributes, this change
adds a new attribute for two annotations which were previously applied
directly to the declaration at the PCM producer side: 1) Type and 2)
Nullability annotations with 'SwiftTypeAttr' and 'SwiftNullabilityAttr',
respectively. The logic to apply these two annotations to a declaration
is refactored into API.
2025-07-10 19:19:18 +01:00
Matheus Izvekov
8a7c973f64
[ci] premerge: upload artifacts even on failure (#147999)
This makes sure we upload the artifacts even if the previous step
failed.

This is helpful because we wish to upload crash reproducers, which the
scritps are already prepared to do.

Example:
https://github.com/llvm/llvm-project/actions/runs/16180778101/job/45676677544?pr=147835
2025-07-10 15:10:12 -03:00
Vigneshwar Jayakumar
25c3f64105
Revert "[StructurizeCFG] Hoist and simplify zero-cost incoming else phi values" (#148016)
reverting to fix Buildbot failures.
2025-07-10 13:06:38 -05:00
James Y Knight
ce571c90a0 Revert "[bazel] Update after 24475409e4eac6fd60e2111424a4bef3452c8f21"
This reverts commit f71b188fbb256ab84aebfba9f7870c04b3a3d44d.

The corresponding commit was reverted by fa74df38ade4053534731ea1e00ffe900e9e9492.
2025-07-10 13:58:17 -04:00
Finn Plummer
d60da27400
[HLSL][RootSignature] Implement diagnostic for missed comma (#147350)
This pr fixes a bug that allows parameters to be specified without an
intermediate comma.

After this pr, we will correctly produce a diagnostic for (eg):
```
RootFlags(0) CBV(b0)
```

This pr updates the problematic code pattern containing a chain of 'if'
statements to a chain of 'else if' statements, to prevent parsing of an
element before checking for a comma.

This pr also does 2 small updates, while in the region:
1. Simplify the `do` loop that these `if` statements are contained in.
This helps code readability and makes it easier to improve the
diagnostics further
2. Moves the `consumeExpectedToken` function calls to be right after the
`parse.*Params` invocation. This will ensure that the comma or invalid
token error is presented before a "missed mandatory param" diagnostic.

- Updates all occurrences of the if chains with an else-if chain
- Simplifies the surrounding `do` loop to be an easier to understand
`while` loop
- Moves the `consumeExpectedToken` diagnostic right after the loop so
that the missing comma diagnostic is produce before checking for any
missed mandatory arguments
- Adds unit tests for this scenario
- Small fix to the diagnostic of `RootDescriptors` to use their
respective `Token` instead of `RootConstants`

Resolves: https://github.com/llvm/llvm-project/issues/147337
2025-07-10 10:52:20 -07:00
Elijah Kin
49b87cd779
DenseMapInfo: support std::optional<T> (#147851) 2025-07-10 10:46:12 -07:00
Daniel Paoliello
c92d5dad67
[clang] Use a specific target when testing that -fomit-frame-pointer and -pg are mutually exclusive (#148000)
Some targets, such as `aarch64-pc-windows-msvc`, always require that
Frame Pointer be reserved even when `-fomit-frame-pointer` is provided,
thus it is always valid to use `-pg` on those targets.

This test didn't take these targets into account; thus it was failing on
Arm64 Windows host machines.

The fix is to explicitly set a target that doesn't require Frame
Pointers reservation.
2025-07-10 10:43:14 -07:00
Amr Hesham
dd1105bcea
[CIR] Implement AddOp for ComplexType (#147578)
This change adds support for AddOp for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-10 19:40:17 +02:00
Adam Siemieniuk
8ad384ba7f
[mlir][xevm] Fix dialect descriptions formatting (#147729)
Fixes markdown formatting of xevm dialect docs.
2025-07-10 19:36:58 +02:00
cmtice
582cfb142c
[libc++] Switch over to the LLVM-wide premerge test runners. (#147794)
Update the premerge testing system to use the LLVM-wide premerge
infrastructure. Also remove libcxx-restart-preempted-jobs.yaml, as this
should no longer be needed.
2025-07-10 10:34:01 -07:00
joaosaffran
ca888f085c
[DirectX][NFC] Refactor DXILRootSignature to follow the same pattern as other analysis (#146783)
When implementing #146785, notice `DXILRootSignature` had some design
changes that made it harder to integrate with other analysis. This
change refactors `DXILRootSignature` to solve this issue.
---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-07-10 10:31:40 -07:00
Corentin Jabot
ab0d11c815
[Clang] Fix a crash when diagnosing wrong conversion to explicit object parameter (#147996)
When an overload is invalid, we try to initialize each conversion
sequence for the purpose of diagmostics, but we failed to initialize
explicit objects, leading to a crash

Fixes #147121
2025-07-10 19:28:47 +02:00
Uzair Nawaz
d93cc7aabf
[libc] WCS to integer internal function (#147857)
Duplicated str_to_integer.h and modified it to work with widechars.
A future patch will implement the public functions (wcstol, wcstoll,
etc) by calling this internal function.
2025-07-10 10:22:39 -07:00
Grigory Pastukhov
ef24b4b326
[Coroutines] Fix debug info scoping for nested structs in coroutine frames (#147622)
When generating debug info for coroutine frames, nested struct types
were incorrectly inheriting the top-level function scope instead of
having their parent struct as scope. This caused assertion failures in
DebugInfoMetadata.h during member list replacement for complex nested
struct hierarchies.

Fix by passing the parent DIStruct as scope when recursively calling
solveDIType for nested struct fields, ensuring proper debug info scoping
hierarchy.

Add regression test that validates proper nested struct scoping
hierarchy and
prevents future regressions.
2025-07-10 10:13:26 -07:00
John Harrison
4b6e54a8cf
[lldb-dap] Migrate variables request protocol types. (#147611)
This adds new protocol types for the 'variables' request.

While implementing this, I removed the '$__lldb_extension' field we
returned on the 'variables' request, since I think all the data can be
retrieved from other DAP requests.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-07-10 10:10:00 -07:00
Vigneshwar Jayakumar
8d3f497eb8
[StructurizeCFG] Hoist and simplify zero-cost incoming else phi values (#139605)
The order of if and else blocks can introduce unnecessary VGPR copies.  
Consider the case of an if-else block where the incoming phi from the
'Else block' only contains zero-cost instructions, and the 'Then' block
modifies some value. There would be no interference when coalescing
because only one value is live at any point before structurization.
However, in the structurized CFG, the Then value is live at 'Else' block
due to the path if→flow→else, leading to additional VGPR copies.

This patch addresses the issue by:
- Identifying PHI nodes with zero-cost incoming values from the Else
block and hoisting those values to the nearest common dominator of the
Then and Else blocks.
- Updating Flow PHI nodes by replacing poison entries (on the if→flow
edge) with the correct hoisted values.
2025-07-10 12:03:04 -05:00
LLVM GN Syncbot
eaac713591 [gn build] Port 76b1dcfac5da 2025-07-10 16:53:26 +00:00
Hervé Poussineau
34f49aa2e9
[compiler-rt][sanitizer] Add Windows MIPS32 support (#145110)
As LLVM supports mipsel-windows-gnu and mipsel-windows-msvc triples,
also support this configuration in compiler-rt
2025-07-10 17:52:19 +01:00
Justin Cai
ccd9e1e6be
[SPIRV] Add lit config for InferAddressSpaces/SPIRV (#147977)
Fixes failures for #146596
2025-07-10 18:51:39 +02:00
Valentin Clement (バレンタイン クレメン)
9a0e03f430
[flang][cuda] Update implicit data transfer for device component (#147882)
Update the detection of implicit data transfer when a device resident
allocatable derived-type component is involved and remove the TODOs.
2025-07-10 09:50:31 -07:00
Craig Topper
0f3bdc3e43
[TableGen] Remove the name from the union in OpData in PseudoLoweringEmitter and CompressInstEmitter (#147896)
We can use an anonymous union here, the name doesn't provide any
additional information.
2025-07-10 09:45:16 -07:00
sribee8
425ed22b2e
[libc] asin fuzz testing (#147786)
Added fuzz test for asin

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-07-10 16:28:57 +00:00
sribee8
a9d8843d71
[libc] Fuzz tests for acos and atan (#147843)
created fuzz tests for acos and atan

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-07-10 16:28:29 +00:00
Ivan Butygin
f60cc63e8c
[mlir][rocdl] Add s.sleep intrinsic (#147936) 2025-07-10 19:27:02 +03:00
sribee8
81614e5b90
[libc] sincos fuzz test (#147855)
Created fuzz test for sincos

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-07-10 16:26:26 +00:00
Drew Kersnar
8e7461e29a
[LoadStoreVectorizer] Batch alias analysis results to improve compile time (#147555)
This should be generally good for a lot of LSV cases, but the attached
test demonstrates a specific compile time issue that appears in the
event where the `CaptureTracking` default max uses is raised.

Without using batching alias analysis, this test takes 6 seconds to
compile in a release build. With, less than a second. This is because
the mechanism that proves `NoAlias` in this case is very expensive
(`CaptureTracking.cpp`), and caching the result leads to 2 calls to that
mechanism instead of ~300,000 (run with -stats to see the difference)

This test only demonstrates the compile time issue if
`capture-tracking-max-uses-to-explore` is set to at least 1024, because
with the default value of 100, the `CaptureTracking` analysis is not
run, `NoAlias` is not proven, and the vectorizer gives up early.
2025-07-10 11:23:33 -05:00
Amr Hesham
54ec5217a0
[CIR] Upstream __builtin_cimag for ComplexType (#147808)
Upstream __builtin_cimag support for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-10 18:19:24 +02:00
Rahul Joshi
0354867cde
[NFC][TableGen] Remove small heap allocations in SearchableTableEmitter (#147845)
Change `GenericEnum` to not heap allocate its entries. Instead stash
them directly in the `Entries` vector. Change `EntryMap` to hold an
index as opposed to a pointer to the entry (the original reason why they
were unique_ptr).
2025-07-10 09:04:24 -07:00
Peiming Liu
77d04ffd6d
[mlir][OpenMP] fix compilation warning (#147987) 2025-07-10 08:50:19 -07:00
Ilia Kuklin
09fb20ec7d
[LLDB] Check comp_unit before accessing it in DIL (#147955)
Check `symbol_context.comp_unit` before accessing it to avoid `nullptr`
dereferencing.
2025-07-10 20:34:23 +05:00
Nikita Popov
8a63133417 [MetaRenamer] Use isIntrinsic() helper (NFC) 2025-07-10 17:34:06 +02:00
beef
9bd4ab7f51
[clang] fix --unwindlib option doc (#143497)
the values it takes should be `libunwind` and not `unwindlib`.
2025-07-10 08:28:06 -07:00
Nikita Popov
2f39a34673 [ObjCARC] Check for declared intrinsics using ID instead of name (NFC) 2025-07-10 17:24:40 +02:00
Andrew Rogers
fa74df38ad
Revert [llvm] annotate ABIBreakingChecks symbols for DLL export (#147965)
This patch reverts commit 24475409e4eac6fd60e2111424a4bef3452c8f21. The
change introduced a cyclic dependency:
```
fatal error: cyclic dependency in module 'LLVM_Utils': LLVM_Utils -> LLVM_Config_ABI_Breaking -> LLVM_Utils
```

See failure log at
https://green.lab.llvm.org/job/llvm.org/job/clang-stage2-Rthinlto/976/console.
2025-07-10 08:21:02 -07:00
Andrew Rogers
4e2efa55c6
[llvm] export private symbols needed by unittests (#145767)
## Purpose
Export a small number of private LLVM symbols so that unit tests can
still build/run when LLVM is built as a Windows DLL or a shared library
with default hidden symbol visibility.

## Background
The effort to build LLVM as a WIndows DLL is tracked in #109483.
Additional context is provided in [this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307).

Some LLVM unit tests use internal/private symbols that are not part of
LLVM's public interface. When building LLVM as a DLL or shared library
with default hidden symbol visibility, the symbols are not available
when the unit test links against the DLL or shared library.

This problem can be solved in one of two ways:
1. Export the private symbols from the DLL.
2. Link the unit tests against the intermediate static libraries instead
of the final LLVM DLL.

This PR applies option 1. Based on the discussion of option 2 in
#145448, this option is preferable.

## Overview
* Adds a new `LLVM_ABI_FOR_TEST` export macro, which is currently just
an alias for `LLVM_ABI`.
* Annotates the sub-set of symbols under `llvm/lib` that are required to
get unit tests building using the new macro.
2025-07-10 08:20:09 -07:00
Oleksandr T.
9ef0a886e6
[Clang] fixed false positive redeclaration error for using enum in nested scopes (#147711)
Fixes #147495 

--- 

This patch addresses the issue of false-positive redeclaration errors
that occur for `using enum` declarations in nested class scopes

```cpp
struct S {
  enum class E { A };
  using enum E;

  struct S1 {
    using enum E; // no error
  };
};
```
2025-07-10 18:13:44 +03:00
Nico Weber
4453792e8d [gn] port 7daa1defd2426 (CGPluginTest)
The test isn't passing for me locally yet, so it's not yet part
of the build.
2025-07-10 11:12:59 -04:00
Kunwar Grover
f96492221d
[mlir][AMDGPU] Add better load/store lowering for full mask (#146748)
This patch adds a better maskedload/maskedstore lowering on amdgpu
backend for loads which are either fully masked or fully unmasked. For
these cases, we can either generate a oob buffer load with no if
condition, or we can generate a normal load with a if condition (if no
fat_raw_buffer space).
2025-07-10 16:11:19 +01:00
Kazu Hirata
86320e0a8f [mlir] Fix warnings
This patch fixes:

  mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp:3047:16: error: unused
  variable 'ctx' [-Werror,-Wunused-variable]

  mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp:3171:16: error: unused
  variable 'ctx' [-Werror,-Wunused-variable]
2025-07-10 07:58:52 -07:00
Krzysztof Parzyszek
9b0ae6ccd6
[flang][OpenMP] Issue a warning when parsing future directive spelling (#147765)
OpenMP 6.0 introduced alternative spelling for some directives, with the
previous spellings still allowed.

Warn the user when a new spelling is encountered with OpenMP version set
to an older value.
2025-07-10 09:57:03 -05:00
Asher Dobrescu
c8c0e90233
[BOLT] Ensure remember and restore CFIs are in the same list (#144348)
In `addCFIInstruction`, we split the CFI information
between `CFIInstrMapType CIEFrameInstructions` and `CFIInstrMapType
FrameInstructions`. In some cases we can end up with the remember CFI in
`CIEFrameInstructions` and the restore CFI in `FrameInstructions`. This
patch adds a check to make sure we do not split remember and restore
states and fixes https://github.com/llvm/llvm-project/issues/133501.
2025-07-10 15:48:57 +01:00
Kunwar Grover
0227aef688
[mlir][Vector] Add canonicalization for extract_strided_slice(create_mask) (#146745)
extract_strided_slice(create_mask) can be folded into create_mask by
simply subtracting the offsets from the bounds.
2025-07-10 15:43:20 +01:00
Nikita Popov
a2c0ac06ff
[llvm-exegesis] Fix musl build (#147954)
We should not include both linux/prctl.h and sys/prctl.h. This works
with glibc because the latter includes the former, but breaks with musl
because the latter redeclares the contents of the former, resulting in:

```
/usr/local/aarch64-linux-musl/include/sys/prctl.h:88:8: error:
redefinition of 'struct prctl_mm_map'
       88 | struct prctl_mm_map {
          |        ^~~~~~~~~~~~
In file included from
/checkout/src/llvm-project/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp:13:
/usr/local/aarch64-linux-musl/include/linux/prctl.h:134:8: note:
previous definition of 'struct prctl_mm_map'
      134 | struct prctl_mm_map {
          |        ^~~~~~~~~~~~
```

Fixes https://github.com/llvm/llvm-project/issues/139443.
2025-07-10 16:31:01 +02:00
Sander de Smalen
362d5ffa8d
[CodeGen] commuteInstruction should update implicit-def (#131361)
When the RegisterCoalescer adds an implicit-def when coalescing
a SUBREG_TO_REG (#123632), this causes issues when removing other
COPY nodes by commuting the instruction because it doesn't take
the implicit-def into consideration. This PR fixes that.
2025-07-10 15:30:02 +01:00
Joseph Huber
f56b6ecf08 [LLVM] Fix GPU build of libcxx/compiler-rt libraries
Summary:
Recent changes altered the name without updating this, add it in and
also tell the builtins build that C++ compilers work because it seems to
require that now.
2025-07-10 09:28:18 -05:00
Daniel Paoliello
154de3e1bd
[flang] Don't check the '-mframe-pointer' flag (#147837)
The `-mframe-pointer` flag is not explicitly set in the original `flang`
invocation and so the value passed to `flang -fc1` can vary depending on
the host machine, so don't verify it in the output.

`-mframe-pointer` forwarding is already verified by
`flang/test/Driver/frame-pointer-forwarding.f90`.
2025-07-10 07:27:33 -07:00
Justin Cai
1409e1a5e5
[SPIRV] Add logic for OpGenericCastToPtrExplicit rewriting (#146596)
This PR adds overrides in `SPIRVTTIImpl` for
`collectFlatAddressOperands` and `rewriteIntrinsicWithAddressSpace` to
enable `InferAddressSpacesPass` to rewrite the
`llvm.spv.generic.cast.to.ptr.explicit` intrinsic (corresponding to
`OpGenericCastToPtrExplicit`) when the address space of the argument can
be inferred. When the destination address space of the cast matches the
inferred address space of the argument, the call is replaced with that
argument. When they do not match, the cast is replaced with a constant
null pointer.
2025-07-10 15:21:39 +01:00