549159 Commits

Author SHA1 Message Date
skc7
f53da4fa4f Add missing workdistribute directives 2025-08-20 12:26:11 +05:30
skc7
d534a638f1 [OpenMP] Add workdistribute construct in openMP dialect and in llvm frontend. 2025-08-19 21:32:39 +05:30
Michael Klemm
a5f1ddd115
[Flang][OpenMP] Fix issue with named constants in SHARED and FIRSTPRIVATE clauses (#154335)
The seemingly was a regression that prevented the usage of named
constant (w/ PARAMETER attribute) in SHARED and FIRSTPRIVATE clauses.
This PR corrects that.
2025-08-19 17:52:27 +02:00
John Harrison
538bd83b37
[lldb] Refactoring JSONTransport into an abstract RPC Message Handler and transport layer. (#153121)
This abstracts the base Transport handler to have a MessageHandler
component and allows us to generalize both JSON-RPC 2.0 for MCP (or an
LSP) and DAP format.

This should allow us to create clearly defined clients and servers for
protocols, both for testing and for RPC between the lldb instances and
an lldb-mcp multiplexer.

This basic model is inspiried by the clangd/Transport.h file and the
mlir/lsp-server-support/Transport.h that are both used for LSP servers
within the llvm project.

Additionally, this helps with testing by subclassing `Transport` to
allow us to simplify sending/receiving messages without needing to use a
toJSON/fromJSON and a pair of pipes, see `TestTransport` in
DAP/TestBase.h.
2025-08-19 08:46:25 -07:00
Michael Liao
1d1b60c6d5 [CIR] Fix codegen test after b44e47a68f9b49a6283b1beaab3af55fa39e8907 2025-08-19 11:38:47 -04:00
Slava Zakharin
6f489fb5e5
Reapply "[flang] Lower EOSHIFT into hlfir.eoshift." (#153907) (#154241)
This reverts commit 5178aeff7b96e86b066f8407b9d9732ec660dd2e.

In addition:
  * Scalar constant UNSIGNED BOUNDARY is explicitly casted
    to the result type so that the generated hlfir.eoshift
    operation is valid. The lowering produces signless constants
    by default. It might be a bigger issue in lowering, so I just
    want to "fix" it for EOSHIFT in this patch.
  * Since we have to create unsigned integer constant during
    HLFIR inlining, I added code in createIntegerConstant
    to make it possible.
2025-08-19 08:36:14 -07:00
Slava Zakharin
c79a88ee0a
[flang] Convert hlfir.designate with comp and contiguous result. (#154232)
Array sections like this have not been using the knowledge that
the result is contiguous:
```
type t
  integer :: f
end type
type(t) :: a(:)
a%f = 0
```

Peter Klausler is working on a change that will result in the
corresponding
hlfir.designate having a component and a non-box result.
This patch fixes the issues found in HLFIR-to-FIR conversion.
2025-08-19 08:35:40 -07:00
Shubham Sandeep Rastogi
5abad32538 Revert "[lldb] Fix error : unknown error while starting lldb's C/C++ repl (#153560)"
This reverts commit 00ffd8b8aa4e8cd3a2fee654d55995918886e874.

The change breaks lldb greendragon tests

Namely, TestClangREPL.py
2025-08-19 08:34:29 -07:00
Sirui Mu
10d193bf5e
[CIR][NFC] Fix regression by #153819 (#154346)
This patch fixes a regression introduced by #153819. The evaluation
order of the arguments to `emitVAStart` is unspecified, but the test
requires the arguments to be evaluated in left-to-right order.

It's a bit strange that the pre-merge checks did not catch this. The
tests failed on my local machine, which runs Fedora 42 with gcc 15.2.1 .
2025-08-19 23:32:02 +08:00
Dave Lee
6e3c7b8244
[lldb] Make step/s alias for new _regexp-step (#153984)
Introduces `_regexp-step`, a step command which additionally allows for
stepping into a target function. This change updates `step` and `s` to
be aliases for `_regexp-step`.

The existing `sif` alias ("Step Into Function") is not well known
amongst users. This change updates `step` and `s` to also work like
`sif`, taking an optional function name.

This is implemented to not break uses of `step` or `s` with a flag, for
example running `step -r func_to_avoid` works as expected.
2025-08-19 08:29:25 -07:00
Peter Klausler
0037c2083f
[flang][runtime] Fix CUDA build (#154357)
Address problems with CUDA build of flang-new runtime after a recent
patch to an external open file API.
2025-08-19 08:24:06 -07:00
Steven Wu
30c5c48d87
[CAS][Tests] Fix unit tests that hangs on two cores (#154151) 2025-08-19 08:21:34 -07:00
Krzysztof Parzyszek
8255d240a9
[flang][OpenMP] Avoid crash with MAP w/o modifiers, version >= 6.0 (#154352)
The current code will crash on the MAP clause with OpenMP version >= 6.0
when the clause does not explicitly list any modifiers. The proper fix
is to update the handling of assumed-size arrays for OpenMP 6.0+, but in
the short term keep the behavior from 5.2, just avoid the crash.
2025-08-19 10:18:51 -05:00
Craig Topper
9240061800
[RegAllocFast] Don't align stack slots if the stack can't be realigned (#153682)
This is the fast regalloc equivalent of
773771ba382b1fbcf6acccc0046bfe731541a599.
2025-08-19 08:17:26 -07:00
jyli0116
586858015e
[GlobalISel][AArch64] Add saturated truncate tests. NFC (#154329)
Added GlobalISel tests for saturated truncate.
2025-08-19 16:11:11 +01:00
erichkeane
d0dc3799b7 [OpenACC][NFCI] Add AST Infrastructure for reduction recipes
This patch does the bare minimum to start setting up the reduction
recipe support, including adding a type to the AST to store it. No real
additional work is done, and a bunch of static_asserts are left around
to allow us to do this properly.
2025-08-19 07:58:11 -07:00
Frederik Harwath
50a3368f22
[Clang] Take libstdc++ into account during GCC detection (#145056)
The Generic_GCC::GCCInstallationDetector class picks the GCC
installation directory with the largest version number. Since the
location of the libstdc++ include directories is tied to the GCC
version, this can break C++ compilation if the libstdc++ headers for
this particular GCC version are not available. Linux distributions tend
to package the libstdc++ headers separately from GCC. This frequently
leads to situations in which a newer version of GCC gets installed as a
dependency of another package without installing the corresponding
libstdc++ package. Clang then fails to compile C++ code because it
cannot find the libstdc++ headers. Since libstdc++ headers are in fact
installed on the system, the GCC installation continues to work, the
user may not be aware of the details of the GCC detection, and the
compiler does not recognize the situation and emit a warning, this
behavior can be hard to understand - as witnessed by many related bug
reports over the years.

The goal of this work is to change the GCC detection to prefer GCC
installations that contain libstdc++ include directories over those
which do not. This should happen regardless of the input language since
picking different GCC installations for a build that mixes C and C++
might lead to incompatibilities.
Any change to the GCC installation detection will probably have a
negative impact on some users. For instance, for a C user who relies on
using the GCC installation with the largest version number, it might
become necessary to use the --gcc-install-dir option to ensure that this
GCC version is selected.
This seems like an acceptable trade-off given that the situation for
users who do not have any special demands on the particular GCC
installation directory would be improved significantly.
 
This patch does not yet change the automatic GCC installation directory
choice. Instead, it does introduce a warning that informs the user about
the future change if the chosen GCC installation directory differs from
the one that would be chosen if the libstdc++ headers are taken into
account.

See also this related Discourse discussion:
https://discourse.llvm.org/t/rfc-take-libstdc-into-account-during-gcc-detection/86992.
2025-08-19 16:55:45 +02:00
Simon Pilgrim
355b747acd
[Headers][X86] Enable constexpr handling for pmulhw/pmulhuw avx512 mask/maskz intrinsics (#154341)
Followup to #152524 / #152540 - allow the predicated variants to be used in constexpr as well
2025-08-19 15:55:16 +01:00
Ross Brunton
2c11a83691
[Offload] Add olCalculateOptimalOccupancy (#142950)
This is equivalent to `cuOccupancyMaxPotentialBlockSize`. It is
currently
only implemented on Cuda; AMDGPU and Host return unsupported.

---------

Co-authored-by: Callum Fare <callum@codeplay.com>
2025-08-19 15:16:47 +01:00
Kazu Hirata
2c4f0e7ac6
[mlir] Replace SmallSet with SmallPtrSet (NFC) (#154265)
This patch replaces SmallSet<T *, N> with SmallPtrSet<T *, N>.  Note
that SmallSet.h "redirects" SmallSet to SmallPtrSet for pointer
element types:

  template <typename PointeeType, unsigned N>
class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N>
{};

We only have 30 instances that rely on this "redirection".  Since the
redirection doesn't improve readability, this patch replaces SmallSet
with SmallPtrSet for pointer element types.

I'm planning to remove the redirection eventually.
2025-08-19 07:11:47 -07:00
Kazu Hirata
136b541304
[clang] Replace SmallSet with SmallPtrSet (NFC) (#154262)
This patch replaces SmallSet<T *, N> with SmallPtrSet<T *, N>.  Note
that SmallSet.h "redirects" SmallSet to SmallPtrSet for pointer
element types:

  template <typename PointeeType, unsigned N>
class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N>
{};

We only have 30 instances that rely on this "redirection", with about
half of them under clang/.  Since the redirection doesn't improve
readability, this patch replaces SmallSet with SmallPtrSet for pointer
element types.

I'm planning to remove the redirection eventually.
2025-08-19 07:11:39 -07:00
Timm Baeder
965b7c2bfc
[clang][bytecode] Implement ia32_pmul* builtins (#154315) 2025-08-19 16:05:20 +02:00
Matt Arsenault
ed0e531044
AMDGPU: Use Register type for isStackAccess (#154320) 2025-08-19 23:00:45 +09:00
Younan Zhang
2b32ad1316
[Clang] Only remove lambda scope after computing evaluation context (#154106)
The immediate evaluation context needs the lambda scope info to
propagate some flags, however that LSI was removed in
ActOnFinishFunctionBody which happened before rebuilding a lambda
expression.

This also converts the wrapper function to default arguments as a
drive-by fix.

Fixes https://github.com/llvm/llvm-project/issues/145776
2025-08-19 21:59:23 +08:00
Charles Zablit
f55dc0824e
[lldb][windows] use Windows APIs to print to the console (#149493)
This patch uses the Windows APIs to print to the Windows Console,
through `llvm::raw_fd_ostream`.

This fixes a rendering issue where the characters defined in
`DiagnosticsRendering.cpp` (`"╰"` for instance) are not rendered
properly on Windows out of the box, because the default codepage is not
`utf-8`.

This solution is based on [this patch
downstream](https://github.com/swiftlang/swift/pull/40632/files#diff-e948e4bd7a601e3ca82d596058ccb39326459a4751470eec4d393adeaf516977R37-R38).

rdar://156064500
2025-08-19 14:52:29 +01:00
Simon Pilgrim
1359f72a03
[X86] canCreateUndefOrPoisonForTargetNode - add X86ISD::MOVMSK (#154321)
MOVMSK nodes don't create undef/poison when extracting the signbits from the source operand
2025-08-19 14:40:42 +01:00
Krzysztof Parzyszek
42350f428d
[flang][OpenMP] Parse GROUPPRIVATE directive (#153807)
No semantic checks or lowering yet.
2025-08-19 08:32:43 -05:00
Krzysztof Parzyszek
292faf6133
[Frontend][OpenMP] Add definition of groupprivate directive (#153799)
This is the common point for clang and flang implementations.
2025-08-19 08:27:29 -05:00
Alexandre Ganea
13391ce183
On Windows, in the release build script, fix detecting if clang-cl is in PATH (#149597)
The checks for detecting if `clang-cl` and `lld-link` are in `%PATH`
were wrong.

This fixes the comment in
https://github.com/llvm/llvm-project/pull/135446#discussion_r2215511129
2025-08-19 13:13:51 +00:00
Erich Keane
dab8c88f15
[OpenACC] Implement 'firstprivate' clause copy lowering (#154150)
This patch is the last of the 'firstprivate' clause lowering patches. It
takes the already generated 'copy' init from Sema and uses it to
generate the IR for the copy section of the recipe.

However, one thing that this patch had to do, was come up with a way to
hijack the decl registration in CIRGenFunction. Because these decls are
being created in a 'different' place, we need to remove the things we've
added. We could alternatively generate these 'differently', but it seems
worth a little extra effort here to avoid having to re-implement
variable initialization.
2025-08-19 06:02:10 -07:00
Aiden Grossman
01f2d70222
[X86] Remove unused variable from Atom Scheduling Model (#154191)
Related to #154180.
2025-08-19 06:00:18 -07:00
Orlando Cazalet-Hyams
da45b6c71d
[RemoveDIs][NFC] Remove dbg intrinsic version of calculateFragmentIntersect (#153378) 2025-08-19 13:44:25 +01:00
Yang Bai
b4c31dc98d
[mlir][Vector] add vector.insert canonicalization pattern to convert a chain of insertions to vector.from_elements (#142944)
## Description

This change introduces a new canonicalization pattern for the MLIR
Vector dialect that optimizes chains of insertions. The optimization
identifies when a vector is **completely** initialized through a series
of vector.insert operations and replaces the entire chain with a
single `vector.from_elements` operation.

Please be aware that the new pattern **doesn't** work for poison vectors
where only **some** elements are set, as MLIR doesn't support partial
poison vectors for now.

**New Pattern: InsertChainFullyInitialized**

* Detects chains of vector.insert operations.
* Validates that all insertions are at static positions, and all
intermediate insertions have only one use.
* Ensures the entire vector is **completely** initialized.
* Replaces the entire chain with a
single vector.from_elementts operation.

**Refactored Helper Function**

* Extracted `calculateInsertPosition` from
`foldDenseElementsAttrDestInsertOp` to avoid code duplication.

## Example

```
// Before:
%v1 = vector.insert %c10, %v0[0] : i64 into vector<2xi64>
%v2 = vector.insert %c20, %v1[1] : i64 into vector<2xi64>

// After:
%v2 = vector.from_elements %c10, %c20 : vector<2xi64>
```

It also works for multidimensional vectors.

```
// Before:
%v1 = vector.insert %cv0, %v0[0] : vector<3xi64> into vector<2x3xi64>
%v2 = vector.insert %cv1, %v1[1] : vector<3xi64> into vector<2x3xi64>

// After:
%0:3 = vector.to_elements %arg1 : vector<3xi64>
%1:3 = vector.to_elements %arg2 : vector<3xi64>
%v2 = vector.from_elements %0#0, %0#1, %0#2, %1#0, %1#1, %1#2 : vector<2x3xi64>
```

---------

Co-authored-by: Yang Bai <yangb@nvidia.com>
Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
2025-08-19 13:43:31 +01:00
Krzysztof Parzyszek
c65c0e87fc
[flang][OpenMP] Break up CheckThreadprivateOrDeclareTargetVar, NFC (#153809)
Extract the visitors into separate functions to make the code more
readable. Join each message string into a single line.
2025-08-19 07:36:25 -05:00
Jie Fu
81f1b46cc6 [AArch64] Silent an unused-variable warning (NFC)
/llvm-project/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp:1042:11:
 error: unused variable 'TRI' [-Werror,-Wunused-variable]
    auto *TRI = MBB.getParent()->getSubtarget().getRegisterInfo();
          ^
1 error generated.
2025-08-19 20:32:33 +08:00
Simon Pilgrim
62d6c10b24 [X86] Add test showing the failure to fold FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X)) 2025-08-19 13:25:36 +01:00
Leandro Lupori
ddb36a8102
[flang] Preserve dynamic length of characters in ALLOCATE (#152564)
Fixes #151895
2025-08-19 09:25:08 -03:00
Florian Hahn
1217c8226b
[LoopIdiom] Add test for simplifying SCEV during expansion with flags. 2025-08-19 13:22:45 +01:00
Utkarsh Saxena
92a91f71ee
[LifetimeSafety] Improve Origin information in debug output (#153951)
The previous debug output only showed numeric IDs for origins, making it
difficult to understand what each origin represented. This change makes
the debug output more informative by showing what kind of entity each
origin refers to (declaration or expression) and additional details like
declaration names or expression class names. This improved output makes
it easier to debug and understand the lifetime safety analysis.
2025-08-19 12:06:10 +00:00
Mehdi Amini
dc82b2cc70
Revert "[MLIR][WASM] Extending the Wasm binary to WasmSSA dialect importer" (#154314)
Reverts llvm/llvm-project#154053

Seems like an endianness sensitivity failing a big-endian bot.
2025-08-19 14:05:09 +02:00
Rafal Bielski
9c9d9e4cb6
[Offload] Define additional device info properties (#152533)
Add the following properties in Offload device info:
* VENDOR_ID
* NUM_COMPUTE_UNITS
* [SINGLE|DOUBLE|HALF]_FP_CONFIG
* NATIVE_VECTOR_WIDTH_[CHAR|SHORT|INT|LONG|FLOAT|DOUBLE|HALF]
* MAX_CLOCK_FREQUENCY
* MEMORY_CLOCK_RATE
* ADDRESS_BITS
* MAX_MEM_ALLOC_SIZE
* GLOBAL_MEM_SIZE

Add a bitfield option to enumerators, allowing the values to be
bit-shifted instead of incremented. Generate the per-type enums using
`foreach` to reduce code duplication.

Use macros in unit test definitions to reduce code duplication.
2025-08-19 13:02:01 +01:00
Simon Pilgrim
fcb36ca8cc
[DAG] visitTRUNCATE - merge the trunc(abd) and trunc(avg) handling which are almost identical (#154301)
CC @houngkoungting
2025-08-19 12:59:39 +01:00
Luc Forget
df57bb8c49
[MLIR][WASM] Extending the Wasm binary to WasmSSA dialect importer (#154053)
This is the continuation of  #152131 

This PR adds support for parsing the global initializer and function
body, and support for decoding scalar numerical instructions and
variable related instructions.

---------

Co-authored-by: Ferdinand Lemaire <ferdinand.lemaire@woven-planet.global>
Co-authored-by: Jessica Paquette <jessica.paquette@woven-planet.global>
Co-authored-by: Luc Forget <luc.forget@woven.toyota>
2025-08-19 13:42:47 +02:00
Timm Baeder
2f011ea37a
[clang][bytecode][NFC] Remove unused Program::relocs (#154308) 2025-08-19 13:29:56 +02:00
Dan Blackwell
2e9494ff96
[ASan] Re-enable duplicate_os_log_reports test and include cstdlib for malloc (#153195)
rdar://62141527
2025-08-19 12:12:48 +01:00
David Green
22b4021f01 [AArch64][GlobalISel] Add additional vecreduce.fadd and fadd 0.0 tests. NFC 2025-08-19 11:52:50 +01:00
Stephen Tozer
5cedb01487 [Debugify] Fix compile error in tracking coverage build
Forward-fixes a compile error in bc216b057d (#150212) in specific build
configurations, due to a missing const_cast.
2025-08-19 11:18:42 +01:00
Nuno Lopes
d0029b87d8
remove UB from test [NFC] 2025-08-19 11:18:27 +01:00
yronglin
57bf5dd7a0
[libc++][tuple.apply] Implement P2255R2 make_from_tuple part. (#152867)
Implement  P2255R2 tuple.apply part wording for `std::make_from_tuple`.
```
Mandates: If tuple_size_v<remove_reference_t<Tuple>> is 1, then reference_constructs_from_temporary_v<T, decltype(get<0>(declval<Tuple>()))> is false.
```

Fixes #154274

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2025-08-19 18:14:13 +08:00
Kareem Ergawy
0e93dbc6b1
[flang] do concurrent: Enable delayed localization by default (#154303)
Enables delayed localization by default for `do concurrent`. Tested both
gfortran and Fujitsu test suites.

All tests pass for gfortran tests. For Fujitsu, enabled delayed
localization passes more tests:

Delayed localization disabled:
Testing Time: 7251.76s
  Passed            : 88520
  Failed            :   162
  Executable Missing:   408

Delayed localization enabled:
Testing Time: 7216.73s
  Passed            : 88522
  Failed            :   160
  Executable Missing:   408
2025-08-19 12:07:17 +02:00