549322 Commits

Author SHA1 Message Date
codefaber
fd7f69bfe7
[libc] Fix copy/paste error in file.cpp (#150802)
Fix using wrong variable due to copy/paste error.

---------

Co-authored-by: codefaber <codefaber>
2025-08-19 10:05:38 -07:00
Younan Zhang
0732693d81
Revert "[Clang] Only remove lambda scope after computing evaluation context" (#154382)
Revert due to breakage as reported in
https://github.com/llvm/llvm-project/pull/154106#discussion_r2285824084

Reverts llvm/llvm-project#154106
2025-08-20 00:56:56 +08:00
Aaron Ballman
ae434cdd0b
[C] Fix issue with -Wimplicit-void-ptr-cast (#154351)
The changes from https://github.com/llvm/llvm-project/pull/136855 missed
a change with atomic assignment constraints. This fixes a bug where we'd
accidentally drop a non-atomic-to-atomic conversion step.

Fixes #154157

co-authored-by: @ahatanak
2025-08-19 12:55:03 -04:00
Renato Golin
5cc8c92268
[NFC][MLIR] Document better linalg morphism (#154313) 2025-08-19 17:51:03 +01:00
Krishna Pandey
550dbec03a
[libc][math][c++23] Add {,u}fromfp{,x}bf16 math functions (#153992)
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- fromfpbf16
- fromfpxbf16
- ufromfpbf16
- ufromfpxbf16

---------

Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
2025-08-19 22:19:03 +05:30
Sam Clegg
28f2fb24e1
Revert "[lld][WebAssembly] Do not relocate ABSOLUTE symbols" (#154371)
Reverts llvm/llvm-project#153763

This caused a bunch of failures on the emscripten waterfall,
specifically most of the lsan tests started failing.
2025-08-19 09:46:10 -07:00
Min-Yih Hsu
f82054eaa2
[RISCV] Handle more cases when combining (vfmv.s.f (extract_subvector X, 0)) (#154175)
Previously, we fold `(vfmv.s.f (extract_subvector X, 0))` into X when
X's type is the same as `vfmv.s.f`'s result type. This patch generalizes
it by folding it into insert_subvector when X is narrower and
extract_subvector when X is wider.

Co-authored-by: Craig Topper <craig.topper@sifive.com>
2025-08-19 09:43:55 -07:00
Frederik Harwath
f1e56ac032
Revert "[Clang] Take libstdc++ into account during GCC detection" (#154368)
Reverts llvm/llvm-project#145056
2025-08-19 16:35:58 +00:00
Helena Kotas
e04fedadba
[HLSL] Tests for local resource arrays (#153257)
Add tests for local arrays of resources.

Closes #145425
2025-08-19 09:22:27 -07:00
Joseph Huber
e2777af84b [LLVM] Add missing dependency for offload-wrapper tool 2025-08-19 11:19:35 -05:00
Drew Kersnar
069ad2353c
[NVPTXLowerArgs] Add align attribute to return value of addrspace.wrap intrinsic (#153889)
If alignment inference happens after NVPTXLowerArgs these addrspace wrap
intrinsics can prevent computeKnownBits from deriving alignment of
loads/stores from parameters. To solve this, we can insert an alignment
annotation on the generated intrinsic so that computeKnownBits does not
need to traverse through it to find the alignment.
2025-08-19 11:13:57 -05:00
Kazu Hirata
67ca5dad16
[polly] Replace SmallSet with SmallPtrSet (NFC) (#154367)
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 10 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 09:09:11 -07:00
Kazu Hirata
ccd5ddab9b
[clang-tools-extra] Replace SmallSet with SmallPtrSet (NFC) (#154365)
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 10 instances that rely on this "redirection", with more
than half of them under clang-tools-extra/.  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 09:09:03 -07:00
Joseph Huber
4c9b7ff04c
[LLVM] Introduce 'llvm-offload-wrapper' tool (#153504)
Summary:
This is a standalone tool that does the wrapper stage of the
`clang-linker-wrapper`. We want this to be an external tool because
currently there's no easy way to split apart what the
clang-linker-wrapper is doing under the hood. With this tool, users can
manually extract files with `clang-offload-packager`, feed them through
`clang --target=<triple>` and then use this tool to generate a `.bc`
file they can give to the linker. The goal here is to make reproducing
the linker wrapper steps easier.
2025-08-19 11:05:48 -05:00
Connector Switch
a0eb9958eb
[flang] optimize asind precision (#154350)
Part of https://github.com/llvm/llvm-project/issues/150452.
2025-08-19 23:54:09 +08:00
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