Commit Graph

555595 Commits

Author SHA1 Message Date
James Y Knight
bd3ddcf7e1 Bazel: fix after [mlir][amdgpu] Add Inliner interface (#162873) 2025-10-10 15:24:57 -04:00
Erich Keane
6010df0402 [OpenACC] Sema changes for +*&|^ reduction combiner recipes (#162740)
As a followup to the previous AST changes, the next step is to generate
the proper expressions in Sema. This patch does so for +,*,&,|,^ by
modeling them as compound operators.

This also causes the legality of some expressions to change, as these
have to be legal operations, but were previously unchecked, so there are
some test changes.

This does not yet generate any CIR, that will happen in the next patch.
2025-10-10 19:22:55 +00:00
Prabhu Rajasekaran
6fb87b231f [llvm][AsmPrinter] Call graph section format. (#159866)
Make .callgraph section's layout efficient in space. Document the layout
of the section.
2025-10-10 12:20:11 -07:00
Andy Kaylor
b3f2d93766 [CIR] Add lowering support for dynamic cast (#162715)
This adds support for lowering cir.dyn_cast operations to a form that
can be lowered to LLVM IR.
2025-10-10 12:09:29 -07:00
Michael Buch
312f1fa8f2 [llvm][DebugInfo][test] DwarfTest: parameterize LanguageDescription tests (#162863)
Better test coverage.

The round-tripping test makes sure that if we ever change
`llvm::dwarf::toDW_Lang` or `llvm::dwarf::toDW_LName`, we don't break
the `LanguageDescription` API.

The round-tripping test found an incorrect version check in
`llvm::dwarf::toDW_Lang`, which I corrected as part of this PR (see the
table at the bottom of https://dwarfstd.org/languages-v6.html for
reference).
2025-10-10 20:07:21 +01:00
Michael Buch
24feeb2013 [llvm][test] Don't specify target for tests in Generic directory
Fixes buildbot failures where no arm64 target was available.
2025-10-10 19:53:02 +01:00
Erich Keane
41f5f3be30 [OpenACC] Fix uses of getBaseOriginalType when we really want elt type. (#162880)
Lately, I've been using 'getBaseOriginalType' in ArraySectionExpr
incorrectly: it gets the base-ist of element type, when in reality, I
want a single type of indirection. This patch corrects the handful of
uses that I had for it.
2025-10-10 18:41:41 +00:00
Ivan Butygin
6ad662d322 [mlir][amdgpu] Add Inliner interface (#162873)
All the `amdgpu` dialect ops can be inlined.

---------

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
2025-10-10 21:34:00 +03:00
Michael Buch
e3620fe068 [lldb][Expression] Emit a 'Note' diagnostic that indicates the language used for expression evaluation (#161688)
Depends on:
* https://github.com/llvm/llvm-project/pull/162050

Since it's a 'Note' diagnostic it would only show up when expression
evaluation actually failed. This helps with expression evaluation
failure reports in mixed language environments where it's not quite
clear what language the expression ran as. It may also reduce confusion
around why the expression evaluator ran an expression in a language it
wasn't asked to run (a softer alternative to what I attempted in
https://github.com/llvm/llvm-project/pull/156648).

Here are some example outputs:
```
# Without target
(lldb) expr blah
note: Falling back to default language. Ran expression as 'Objective C++'.

# Stopped in target
(lldb) expr blah
note: Ran expression as 'C++14'.

(lldb) expr -l objc -- blah
note: Expression evaluation in pure Objective-C not supported. Ran expression as 'Objective C++'.

(lldb) expr -l c -- blah
note: Expression evaluation in pure C not supported. Ran expression as 'ISO C++'.

(lldb) expr -l c++14 -- blah
note: Ran expression as 'C++14'

(lldb) expr -l c++20 -- blah
note: Ran expression as 'C++20'

(lldb) expr -l objective-c++ -- blah
note: Ran expression as 'Objective C++'

(lldb) expr -l D -- blah
note: Expression evaluation in D not supported. Falling back to default language. Ran expression as 'Objective C++'.
```

I didn't put the diagnostic on the same line as the inline diagnostic
for now because of implementation convenience, but if reviewers deem
that a blocker I can take a stab at that again.

Also, other language plugins (namely Swift), won't immediately benefit
from this and will have to emit their own diagnistc. I played around
with having a virtual API on `UserExpression` or `ExpressionParser` that
will be called consistently, but by the time we're about to parse the
expression we are already several frames deep into the plugin. Before
(and at the beginning of) the generic `UserExpression::Parse` call we
don't have enough information to notify which language we're going to
parse in (at least for the C++ plugin).

rdar://160297649
rdar://159669244
2025-10-10 19:23:02 +01:00
Michael Buch
4188e18a5b [lldb][test] Don't run libc++ API tests without a locally built libc++ (#162657)
API tests in the `libc++` category will try their best to build against
a locally built libc++. If none exists, the `Makefile.rules` currently
fall back to using the system libc++.

The issue with falling back to the system libc++ is that we are now
potentially not testing what we intended to. But we also can't rely on
certain libc++ features being available that the tests are trying to
use. On Apple platforms this is a configuration error (because libc++ is
the only stdlib supported), but we can't make it an error on Linux
because a user might want to run the API tests with libstdc++.

The Ubunutu 22.04 bots on the Apple fork are failing to run following
tests are failing:
* `TestLibcxxInternalsRecognizer.py`
* `TestDataFormatterStdRangesRefView.py` because the system stdlib
doesn't have `std::ranges` support yet. And the tests just fail to
build. Building libc++ on those bots is also not possible because the
system compiler is too old (and the Apple fork builds all the
subprojects standalone, so it requires the system compiler).

This patch marks tests in the `libc++` category as `UNSUPPORTED` if no
local libc++ is available.

The downside is that we will inevitably lose coverage on bots that were
running these tests without a local libc++. Arguably those weren't
really testing the right thing. But for vendors with LLDB forks it might
have been useful to at least know that the tests on the fork don't fail
against the system libc++.

Confirmed that the libc++ pre-merge CI still runs these tests (since it
uses the explicit `--category libc++` dotest flag). Also confirmed that
LLDB pre-merge CI runs the tests (because it builds `libcxx` locally).

**Workaround**

If you do need want to run libc++ tests against the system stdlib, you
can invoke `lldb-dotest` with the `--category libc++` flag:
```
./path/to/build/lldb-dotest --category libc++

OR

./path/to/build/bin/llvm-lit -sv --param dotest-args='--category libc++' "/path/to/monorepo/lldb/test/API
```

rdar://136231390
2025-10-10 19:13:08 +01:00
LU-JOHN
c17eca0410 [AMDGPU][NFC] Pre-commit test for redundant s_cmp_lg_* sX, 0 removal (#162351)
Pre-commit test for redundant s_cmp_lg_* sX, 0 removal.

---------

Signed-off-by: John Lu <John.Lu@amd.com>
2025-10-10 13:07:35 -05:00
Aaron Ballman
8e60adcaaf [C2y] Implement WG14 N3622 static used in an inline (#162877)
This paper removes the constraint that a static variable or function
cannot be used within an extern inline function. The diagnostic is still
being produced in earlier language modes for conformance reasons but has
always been accepted as an extension.
2025-10-10 14:02:17 -04:00
Michael Buch
7dbf115a92 [llvm][DebugInfo] Add support for emitting DW_AT_language_name (#162621)
Depends on:
* https://github.com/llvm/llvm-project/pull/162445
* https://github.com/llvm/llvm-project/pull/162449

Emit `DW_AT_language_name` (new in DWARFv6) if `DICompileUnit` has a
`sourceLanguageName` field. Emit a `DW_AT_language` otherwise.
2025-10-10 18:58:18 +01:00
Mircea Trofin
0f73e75bf7 [profcheck] exclude CodeGen/AMDGPU/amdgpu-attributor-min-agpr-alloc.ll (#162898) 2025-10-10 10:48:32 -07:00
Mircea Trofin
01e19e850f [InstCombine] Mark as unknown the branch weights of packed integer selecting shifts (#162726)
Follow up from PR #162147. We do not have existing !prof metadata to synthesize one for the new `select`​ .

Fixes https://lab.llvm.org/staging/#/builders/221/builds/3091

Issue #147390
2025-10-10 10:30:30 -07:00
James Newling
01c7ef6556 [MLIR][Vector] Fix test following vector.splat removal (#162892)
This is a fix for the failing integration test (see
https://lab.llvm.org/buildbot/#/builders/177/builds/22398) reported in
https://github.com/llvm/llvm-project/pull/162167.
2025-10-10 10:23:27 -07:00
Peter Klausler
05a3f76dca [flang] Process legacy DATA-style /initializers/ sooner (#162722)
The compiler can't defer the conversion of legacy DATA-style
/initializers/ in component declarations to their init() expressions to
the general DATA statement conversion pass, since default component
values must be present during structure constructor analysis. So move
their conversions into name resolution and handle them at the same times
as standard '=' initializers are processed. Avoid any potential problems
with type parameters being used as repetition counts or values by
disallowing legacy DATA-style initializers in PDTs.

Fixes https://github.com/llvm/llvm-project/issues/161989.
2025-10-10 10:09:56 -07:00
Peter Klausler
471ed9ad62 [flang] Rework component KIND= values in PDT instantiations (#162367)
When processing the KIND= values of type specifications in parameterized
derived type component declarations, it turns out to be necessary to
analyze their expressions' parse trees rather than to just fold their
typed expression representations. The types of the subexpressions may
depend on the values of KIND parameters.

Further, when checking the values of KIND= actual arguments to type
conversion intrinsic functions (e.g., INT(..., KIND=)) that appear in
KIND specifiers for PDT component declarations, don't emit an error for
the derived type definition, but instead emit them for derived type
instantiations.

Fixes https://github.com/llvm/llvm-project/issues/161961.
2025-10-10 10:09:33 -07:00
Peter Klausler
e2ee91ed34 [flang] Clean up some optional<bool> usage (#161925)
Audit the use of std::optional<bool> as a tri-state logical value in
flang, correct a couple cases that need ".value_or()", add some explicit
".has_value()" calls, and document the possible pitfalls.
2025-10-10 10:09:02 -07:00
Peter Klausler
8b930895c4 [flang] Don't misinterpret valid component value for ancestor type (#161910)
As a common language extension, this compiler accepts a structure
constructor whose first value has no keyword and whose type matches an
ancestral type as if the constructor had had a keyword whose name was
the ancestral type. For example, given
  TYPE PARENT; REAL X; END TYPE
  TYPE, EXTENDS(PARENT) :: CHILD; END TYPE
we accept the nonconforming constructor "child(parent(1.))" as if it had
been the conforming "child(1.)" or "child(parent=parent(1.))".

The detection of this case needs to be constrained a bit to avoid a
false positive misinterpretation of conforming code in the case where
the actual first component of the derived type is a POINTER or
ALLOCATABLE whose type and rank would allow it to correspond with the
keywordless first value in the component value list.

Fixes https://github.com/llvm/llvm-project/issues/161887.
2025-10-10 10:08:39 -07:00
James Newling
ea291d0e8c [MLIR][Vector] Remove vector.splat (#162167)
vector.splat has been deprecated (user: please use the very similar vector.broadcast instead) 
with the last PR landing about 6 weeks ago.

The discourse discussion is at
https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143/1
The last PR was #152230

This PR completely removes vector.splat. In addition to removing vector.splat from VectorOps.td, it

- Updates the few remaining places where vector::SplatOp is created (now vector::BroadcastOp is created)
- Removes temporary patterns where vector.splat is replaced by vector.broadcast

The only place 'vector.splat' appears is now the files

https://github.com/llvm/llvm-project/blob/main/mlir/utils/tree-sitter-mlir/test/corpus/op.txt
 and

https://github.com/llvm/llvm-project/blob/main/mlir/utils/tree-sitter-mlir/dialect/vector.js

---------

Signed-off-by: James Newling <james.newling@gmail.com>
2025-10-10 09:58:18 -07:00
Alexandre Perez
6ed18d8525 [lldb][mcp] Get the running MCP server connection information (#162752)
Currently AFAICT we don't have a way to get the MCP server socket after
it started. So this change introduces a new `protocol-server` subcommand
that allows us to query the location of a running server:

```
(lldb) protocol-server start MCP listen://localhost:0
MCP server started with connection listeners: connection://[::1]:36051, connection://[127.0.0.1]:36051
(lldb) protocol-server get MCP
MCP server connection listeners: connection://[::1]:36051, connection://[127.0.0.1]:36051
(lldb) protocol-server stop MCP
(lldb) protocol-server get MCP
error: MCP server is not running
```
2025-10-10 09:55:09 -07:00
小钟
10021c737a Fix typo in comment: 'unit64_t' to 'uint64_t' (#162869)
Corrects a typo in comments within XCOFFObjectFile.cpp, changing
'unit64_t' to the correct type 'uint64_t' for clarity.
2025-10-10 17:50:33 +01:00
Yingwei Zheng
f071cacc6b [ConstantFPRange] Add getWithout[NaN|Inf] (#162696)
This patch adds getWithoutNaN/getWithoutInf. We will apply nnan/ninf
flags to the range of operands/results for a more precise range.
2025-10-10 16:46:17 +00:00
Simon Pilgrim
30ccb60d8a [X86] Add test coverage for #162812 (#162878) 2025-10-10 16:43:55 +00:00
Mircea Trofin
8aa49974df [NFC][InstCombine] Make use of unknown profile info clear in the API name (#162766)
Making the choice more clear from the API name, otherwise it'd be very easy for one to just "not bother" with the `MDFrom`​, especially since it is optional and follows the optional `Name`​ - but this time we'd have a harder time detecting it's effectivelly dropped metadata.
2025-10-10 09:33:45 -07:00
Charitha Saumya
bd6da1feaa [mlir][xegpu] Add more tests in XeGPU subgroup distribution. (#162543)
This PR adds some tests for covering some useful corner cases.

1. more tests for `vector.shape_cast` distribution.
2. testing for `MoveFuncBodyToWarpOp` pattern that was not possible
before.
2025-10-10 09:27:36 -07:00
Louis Dionne
a47cb9b652 [libc++] Fix number of characters in skip reason on BuildKite 2025-10-10 12:26:07 -04:00
Victor Chernyakin
b0b3320821 [clang-tidy][NFC] Remove stale comment in test (#162857)
Commit cb18647 removed the `| count 0` in this file but left behind this
stale comment.
2025-10-10 09:22:13 -07:00
Sang Ik Lee
5d1636d89a [MLIR][XeVM] XeVM to LLVM: Add conversion patterns for id ops (#162536)
XeVM to LLVM pass: Add conversion patterns for XeVM id ops.

Target OpenCL functions described here:

https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/get_group_id.html
2025-10-10 09:20:44 -07:00
Craig Topper
c265d7aebf [SelectionDAG] Add SDTCisInt<1> to SDTVecReduce and SDTCisEltOfVec to SDTFPVecReduce. NFC (#162761) 2025-10-10 09:02:08 -07:00
Craig Topper
672672bed3 [SelectionDAG] Add SDTCisSameNumEltsAs to more operations. NFC (#162759) 2025-10-10 09:00:36 -07:00
Amr Hesham
c25a2c7284 [CIR] Upstream Exception with empty try block (#162737)
Upstream, the basic support for the C++ try catch statement with an
empty try block

Issue https://github.com/llvm/llvm-project/issues/154992
2025-10-10 17:57:47 +02:00
Akash Dutta
04d3965125 [AMDGPU]: Packed instructions unpacking to co-issue post-RA scheduling - fix flag handling (#160195)
This is a follow up to https://github.com/llvm/llvm-project/pull/157968.
This fixes flag handling in inserted instructions.
2025-10-10 08:56:38 -07:00
Shilei Tian
24a5d8a9ca Revert "[LifetimeSafety] Reorganize code into modular components (#162474)"
This reverts commit 2eb8c47b88 since it completely breaks dylib build.
2025-10-10 11:51:41 -04:00
Chinmay Deshpande
de67a78c30 [AMDGPU][GlobalISel] Add RegBankLegalize support for G_ASSERT_{S|Z}EXT ops (#162728) 2025-10-10 08:48:06 -07:00
Jordan Rupprecht
5391c6849f [AMDGPU][NFC] Fix clang frontend<->sema layering issue (#162865)
#140210 added `#include "clang/Frontend/FrontendDiagnostic.h"` to
clang/lib/Sema/SemaAMDGPU.cpp, but Frontend itself has a dependency on
Sema. This creates a layering issue as described in
https://llvm.org/docs/CodingStandards.html#library-layering.

Fortunately, d076608d58 made this easy to
fix, as clang/Frontend/FrontendDiagnostic.h just forwards to
clang/Basic/DiagnosticFrontend.h, so it's trivial to make this depend on
basic instead of frontend.
2025-10-10 15:44:51 +00:00
Jordan Rupprecht
85dd8f4bff [bazel][uArch][XeGPU] Port #153706: add uArch package (#162872) 2025-10-10 15:44:10 +00:00
Aaron Ballman
f6caec67fa Speculatively fix build bots
https://github.com/llvm/llvm-project/pull/162843 landed a test that is
broken on darwin:

https://lab.llvm.org/buildbot/#/builders/190/builds/28819

This is an attempted quick fix.
2025-10-10 11:42:16 -04:00
Yi-Chi Lee
a9c8e94b43 [DAGCombiner] Extend FP-to-Int cast without requiring nsz (#161093)
This patch updates the FP-to-Int conversion handling:
- For signed integers: use `ftrunc` followed by clamping to the target
integer range.
- For unsigned integers: apply `fabs` + `ftrunc`, then clamp.

This removes the previous dependence on `nsz` and ensures correct
lowering for both signed and unsigned cases.

I've tested the code generation of -mtriple=amdgcn. It seems that the
assembly code is expected, but I'm not sure how to write a general
testcase for every target.

Fixes #160623.
2025-10-11 00:34:33 +09:00
Martin Storsjö
93d3260389 [lldb] [cmake] Fix delayloading liblldb.dll in mingw builds (#162831)
ec28b95b74 made liblldb delayloaded, but
the supplied command line parameter is only valid for MSVC style builds.

For mingw builds using LLD, we can easily pass a similar option. For
mingw builds with ld.bfd, we can't quite as easily delayload it - for
these cases, just keep linking it like we usually do, and warn if the
user tried to set LLDB_PYTHON_DLL_RELATIVE_PATH in a build where it
won't have any effect.

Also change the setting for MSVC style builds, to use the simpler
`$<TARGET_FILE_NAME:liblldb>` instead of
`$<TARGET_FILE_BASE_NAME:liblldb>.dll`. The former pattern is what we
use for mingw targets, and it makes the code clearer to use that for
both, as that same expression should do the right thing for both.
2025-10-10 18:18:14 +03:00
Martin Storsjö
13784f7a4d [cmake] Unconditionally use -Wno-pass-failed with Clang (#162835)
Since 4feae05c6a, most of the handling of
warning options was rewritten to add such options based on hardcoded
knowledge about what compilers support which options, and since which
versions. This avoids a number of configure time checks, speeding up the
cmake configuration.

This avoids erroneously adding this option with GCC, which doesn't
really support it.

If testing for a warning option like -Wno-<foo> with GCC, GCC won't
print any diagnostic at all, leading to the options being accepted
incorrectly. However later, if compiling a file that actually prints
another warning, GCC will also print warnings about these -Wno-<foo>
options being unrecognized.

This avoids extra warning spam like this, for every source file that
does produce warnings with GCC:

    At global scope:
    cc1plus: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
2025-10-10 18:17:31 +03:00
Martin Storsjö
31d260211a [lldb] Add a missing <atomic> include. NFC. (#162809)
This fixes building LLDB for mingw with libstdc++, after
8ae30a3fac.

Previously, building errored out with errors like these:

    In file included from llvm-project/lldb/include/lldb/Protocol/MCP/Transport.h:12,
                     from llvm-project/lldb/include/lldb/Protocol/MCP/Server.h:16,
                     from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:15,
                     from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp:9:
    llvm-project/lldb/include/lldb/Host/JSONTransport.h:608:23: error: field ‘replied’ has incomplete type ‘std::atomic<bool>’
      608 |     std::atomic<bool> replied = {false};
          |                       ^~~~~~~
    In file included from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/shared_ptr_atomic.h:33,
                     from gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/memory:78,
                     from llvm-project/lldb/include/lldb/Host/Socket.h:12,
                     from llvm-project/lldb/include/lldb/Core/ProtocolServer.h:13,
                     from llvm-project/lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h:12:
    gcc-mingw/x86_64-w64-mingw32/include/c++/12.1.0/bits/atomic_base.h:162:12: note: declaration of ‘struct std::atomic<bool>’
      162 |     struct atomic;
          |            ^~~~~~
2025-10-10 18:12:57 +03:00
David Spickett
fca40b3b6f [lldb][docs] State that the extension packets doc should be alphabetised
I did this when I converted it but never stated so. Adding a comment
stating so. We'll probably forget at some point but might as well.

Also moved the x packet to the last place, after wasm which was
added to the end recently.
2025-10-10 15:03:54 +00:00
Connector Switch
21b2bdd91c [libcxx][NFC] Added libunwind to LLVM_ENABLE_RUNTIMES for Windows… (#162682)
… builds using MinGW.

I tried running the original command, but the error told me I had to
include libunwind.
2025-10-10 22:58:41 +08:00
Hongyu Chen
3340b245af [DFAJumpThreading] Precompute value => successor mapping (#162824)
Address some previous comments. Note that the value => successor mapping
is invalid during DFA transformation unless we update it correctly.
2025-10-10 22:57:42 +08:00
Matt Arsenault
424fa83335 CodeGen: Remove unused IntrinsicLowering includes (#162844) 2025-10-10 14:34:16 +00:00
Aaron Ballman
2992d3dfef [C2y] Claim support for WG14 N3623 (#162843)
This requires invalid signatures of main to be diagnosed while still
allowing for common extensions. Clang has always supported this.
2025-10-10 10:28:10 -04:00
Md Abdullah Shahneous Bari
83d3a2efe4 [uArch][XeGPU] Add XeGPU uArch definition. (#153706)
The uArch infrastructure provides:
- A set data structures to represent, uArch and it's necessary
components (e.g., instructions, register-files, caches).
- A set of utility interfaces that are common to a family of ops (e.g.,
mma ops, 2DBlockIO ops). The implementation of these interfaces are
provided by the specific instructions. Each family of ops provides these
5 common APIs. However, some family of ops may have more utility APIs.
The common 5 APIs are:
	- getSupportedShapes
	- getSupportedTypes
	- checkSupportedShapesAndTypes
	- checkSupportedTypes
	- validate

Add support for PVC and BMG architectures.
Add support for DPAS instruction.
2025-10-10 09:21:27 -05:00
Tom Tromey
311d1138e7 Do not emit right shift by 0 in DWARF expressions (#162738)
DW_OP_LLVM_extract_bits_zext and DW_OP_LLVM_extract_bits_sext can end up
emitting "DW_OP_constu 0; DW_OP_shr" when given certain arguments.
However, a shift by zero is not useful, and so it can be omitted.
2025-10-10 15:15:17 +01:00