532890 Commits

Author SHA1 Message Date
Tom Eccles
9b2fd1a6ec
[flang][OpenMP] Bump default OpenMP version to 3.1 (#133745)
Precise OpenMP standards support information is being documented in
#132707

Flang now has good support for OpenMP Version 3.1 and earlier.
2025-04-02 10:43:48 +01:00
Kareem Ergawy
3f8bfc9f7f
[flang][OpenMP] Map simple do concurrent loops to OpenMP host constructs (#127633)
Upstreams one more part of the ROCm `do concurrent` to OpenMP mapping
pass. This PR add support for converting simple loops to the equivalent
OpenMP constructs on the host: `omp parallel do`. Towards that end, we
have to collect more information about loop nests for which we add new
utils in the `looputils` name space.

PR stack:
- https://github.com/llvm/llvm-project/pull/126026
- https://github.com/llvm/llvm-project/pull/127595
- https://github.com/llvm/llvm-project/pull/127633 (this PR)
- https://github.com/llvm/llvm-project/pull/127634
- https://github.com/llvm/llvm-project/pull/127635
2025-04-02 11:26:58 +02:00
Luke Lau
8107b430ed
[VPlan] Simplify select c, x, x -> x (#133731)
As noted in 1a9358c090d0507be21c5e9b2d97a23ef1de8ab0, some
simplifications can produce a redundant select where the true and false
operands are the same, which this patch removes.

The is_fpclass test was changed so the condition wasn't made dead.
2025-04-02 10:26:48 +01:00
Fraser Cormack
dd19e7eaaa
[libclc] Move cbrt to the CLC library; vectorize (#133940) 2025-04-02 10:18:24 +01:00
Nikita Popov
9356091a98
[GlobalMerge][PPC] Don't merge globals in llvm.metadata section (#131801)
The llvm.metadata section is not emitted and has special semantics. We
should not merge globals in it, similarly to how we already skip merging
of `llvm.xyz` globals.

Fixes https://github.com/llvm/llvm-project/issues/131394.
2025-04-02 10:40:53 +02:00
Sirraide
10c6ebc427
Reapply "[Clang] [NFC] Introduce a helper for emitting compatibility diagnostics (#132348)" (#134043)
This reapplies #132348 with a fix to the python bindings tests, reverting
076397ff32.
2025-04-02 10:40:05 +02:00
Kareem Ergawy
41d718b1cf
[flang][OpenMP] Upstream do concurrent loop-nest detection. (#127595)
Upstreams the next part of do concurrent to OpenMP mapping pass (from
AMD's ROCm implementation). See
https://github.com/llvm/llvm-project/pull/126026 for more context.

This PR add loop nest detection logic. This enables us to discover
muli-range do concurrent loops and then map them as "collapsed" loop
nests to OpenMP.

This is a follow up for
https://github.com/llvm/llvm-project/pull/126026, only the latest commit
is relevant.

This is a replacement for
https://github.com/llvm/llvm-project/pull/127478 using a
`/user/<username>/<branchname>` branch.

PR stack:
- https://github.com/llvm/llvm-project/pull/126026
- https://github.com/llvm/llvm-project/pull/127595 (this PR)
- https://github.com/llvm/llvm-project/pull/127633
- https://github.com/llvm/llvm-project/pull/127634
- https://github.com/llvm/llvm-project/pull/127635
2025-04-02 10:12:52 +02:00
Matt Arsenault
cde2ea377d
llvm-reduce: Defer a shouldKeep call in operand reduction (#133387)
Ideally shouldKeep is only called in contexts that will successfully
do something.
2025-04-02 15:00:41 +07:00
Harmen Stoppels
bd788dbf51
[AMDGPU] Remove detection of hip runtime for Spack (#133263)
There is special logic to detect the hip runtime when llvm is installed
with Spack. It works by matching the install prefix of llvm against
`llvm-amdgpu-*` followed by effectively globbing for

```
<llvm dir>/../hip-x.y.z-*/
```

and checking there is exactly one such directory.

I would suggest to remove autodetection for the following reasons:

1. In the Spack ecosystem it's by design that every package lives in
   its own prefix, and can only know where its dependencies are
   installed, it has no clue what its dependents are and where they are
installed. This heuristic detection breaks that invariant, since `hip`
   is a dependent of `llvm`, and can be surprising to Spack users.
2. The detection can lead to false positives, since users can be using
   an llvm installed "upstream" with their own build of hip locally, and
   they may not realize that clang is picking up upstream hip instead of
   their local copy.
3. It only works if the directory name is `llvm-amdgpu-*` which happens
   to be the name of AMD's fork of `llvm`, so it makes no sense that
   this code lives in the main LLVM repo for which the Spack package
   name is `llvm`. Feels wrong that LLVM knows about Spack package
   names, which can change over time.
4. Users can change the install directory structure, meaning that this
   detection is not robust under config changes in Spack.
2025-04-02 14:52:27 +07:00
Mariya Podchishchaeva
8a691cc615
[MS][clang] Make sure vector deleting dtor calls correct operator delete (#133950)
During additional testing I spotted that vector deleting dtor calls
operator delete, not operator delete[] when performing array deletion.
This patch fixes that.
2025-04-02 09:25:43 +02:00
Kareem Ergawy
5d364481e3
[flang][OpenMP] Upstream first part of do concurrent mapping (#126026)
This PR starts the effort to upstream AMD's internal implementation of
`do concurrent` to OpenMP mapping. This replaces #77285 since we
extended this WIP quite a bit on our fork over the past year.

An important part of this PR is a document that describes the current
status downstream, the upstreaming status, and next steps to make this
pass much more useful.

In addition to this document, this PR also contains the skeleton of the
pass (no useful transformations are done yet) and some testing for the
added command line options.

This looks like a huge PR but a lot of the added stuff is documentation.

It is also worth noting that the downstream pass has been validated on
https://github.com/BerkeleyLab/fiats. For the CPU mapping, this achived
performance speed-ups that match pure OpenMP, for GPU mapping we are
still working on extending our support for implicit memory mapping and
locality specifiers.

PR stack:
- https://github.com/llvm/llvm-project/pull/126026 (this PR)
- https://github.com/llvm/llvm-project/pull/127595
- https://github.com/llvm/llvm-project/pull/127633
- https://github.com/llvm/llvm-project/pull/127634
- https://github.com/llvm/llvm-project/pull/127635
2025-04-02 09:24:38 +02:00
nawrinsu
730e8a4a59
[OpenMP] Add memory allocation using hwloc (#132843)
This patch adds support for memory allocation using hwloc. To enable
memory allocation using hwloc, env KMP_TOPOLOGY_METHOD=hwloc needs to be
used. If hwloc is not supported/available, allocation will fallback to
default path.
2025-04-02 00:17:50 -07:00
Sudharsan Veeravalli
536fe74aaa
[RISCV] Modify register type of extd* Xqcibm instructions (#134027)
The v0.8 spec specifies that rs1 cannot be x31 (t6) since these
instructions operate on a pair of registers (rs1 and rs1 + 1) with no wrap
around.

The latest spec can be found here:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.8.0
2025-04-02 12:14:50 +05:30
Matt Arsenault
09e19cfacf
llvm-reduce: Do not reduce alloca array sizes to 0 (#132864)
Fixes #64340
2025-04-02 13:44:45 +07:00
Ryotaro Kasuga
528e408b94
[LoopInterchange] Add an option to control the cost heuristics applied (#133664)
LoopInterchange has several heuristic functions to determine if
exchanging two loops is profitable or not. Whether or not to use each
heuristic and the order in which to use them were fixed, but #125830
allows them to be changed internally at will. This patch adds a new
option to control them via the compiler option.

The previous patch also added an option to prioritize the vectorization
heuristic. This patch also removes it to avoid conflicts between it and
the newly introduced one, e.g., both
`-loop-interchange-prioritize-vectorization=1` and
`-loop-interchange-profitabilities='cache,vectorization'` are specified.
2025-04-02 15:41:40 +09:00
Ryotaro Kasuga
c47023dceb
[clang][CodeGen] Make pragma-loop test more rboust (NFC) (#133707)
pragma-loop.cpp contains tests for loop metadata generated by pragma
directives. These tests didn't work as (perhaps) expected. This is
because the regex `.*` consumes multiple elements in the metadata. For
example, there was a check directive like this.

```
// CHECK: ![[LOOP_9]] = distinct !{![[LOOP_9]], ![[WIDTH_8:.*]], ![[FIXED_VEC]], ...}
```

In the above case, `[[WIDTH_8]]` would have been expected to match a
node like `[[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}`.
However, since there is no check directive to verify the contents of
`[[WIDTH_8]]`, the regex `.*` consumed more than one element. There were
other similar cases.

This patch fixes the problem by not using regex matcher in the metadata
content (except for follow-up metadata). Instead, it uses string
variables whose contents are validated elsewhere.

Related:
https://github.com/llvm/llvm-project/pull/131985#discussion_r2014369699
2025-04-02 15:40:37 +09:00
Matt Arsenault
964650b69e
llvm-reduce: Add reduceOperandsToPoison reduction (#132862)
For now use it only for TargetExtTypes, which do not always support
zero initializers.
2025-04-02 13:38:46 +07:00
Sirraide
076397ff32
Revert "[Clang] [NFC] Introduce a helper for emitting compatibility diagnostics" (#134036)
Reverts llvm/llvm-project#132348

Some tests are failing and I still need to figure out what is going on
here.
2025-04-02 08:29:05 +02:00
Michael Liao
a2ca2f3f10 [CIR] Fix cir-canonicalize pass upstreaming issues. NFC
- Fix typos in 'RemoveEmptyScope' pattern rewriting and combine 'match'
  and 'rewrite' into 'matchAndRewrite' as they are deprecated.
2025-04-02 02:14:17 -04:00
Sirraide
9d06e0879b
[Clang] [NFC] Introduce a helper for emitting compatibility diagnostics (#132348)
This is a follow-up to #132129.

Currently, only `Parser` and `SemaBase` get a `DiagCompat()` helper; I’m
planning to keep refactoring compatibility warnings and add more helpers
to other classes as needed. I also refactored a single parser compat
warning just to make sure everything works properly when diagnostics
across multiple components (i.e. Sema and Parser in this case) are
involved.
2025-04-02 08:06:29 +02:00
Craig Topper
e020fc1895
[TableGen] Directly use SDNode functions to implement HasOneUse and HasNoUse. NFC (#133976)
The SDValue functions we were calling wrap SDNode functions we can call
directly.
2025-04-01 22:14:17 -07:00
Jonas Devlieghere
28b300d546
[lldb] Update ScriptInterpreterLua::LoadScriptingModule
Update the ScriptInterpreterLua::LoadScriptingModule signature after the
TargetSP argument was added in #133290.
2025-04-01 22:13:26 -07:00
Kazu Hirata
f1025c0e87
[mlir] Construct SmallVector with ArrayRef (NFC) (#134023) 2025-04-01 22:00:01 -07:00
Kazu Hirata
d760dbe6eb
[mlir] Remove extraneous calls to make_range (NFC) (#134020) 2025-04-01 21:59:51 -07:00
Kazu Hirata
86c382514e
[Target] Construct SmallVector with ArrayRef (NFC) (#134019) 2025-04-01 21:59:19 -07:00
Kazu Hirata
cc10896fa2
[SandboxVectorizer] Use llvm::erase (NFC) (#134018) 2025-04-01 21:58:57 -07:00
Kazu Hirata
e060acbd3b
[Sema] Use llvm::erase_if (NFC) (#134017) 2025-04-01 21:58:32 -07:00
Kazu Hirata
68fb7a5a1d Revert "[RISCV] Add Xqci Insn Formats (#132986)"
This reverts commit 0cfabd37df9940346f3bf8a4d74c19e1f48a00e9.

Multiple builtbot failures have been reported:
https://github.com/llvm/llvm-project/pull/132986
2025-04-01 21:51:54 -07:00
Matt Arsenault
23d894e0a3 llvm-reduce: Fix comment typo 2025-04-02 11:43:09 +07:00
Matt Arsenault
adbe9e20bf
llvm-reduce: Skip setting br conditions on already constant branches (#133841)
If we are trying to simplify branch conditions to true, ignore branches
already set to a constant true. If we are simplifying to constant false,
ignore the already constant false cases. This saves steps in this edge
case, and avoids the side effect of running simplifycfg on blocks we
did not intend to modify.
2025-04-02 11:41:47 +07:00
Sam Elliott
0cfabd37df
[RISCV] Add Xqci Insn Formats (#132986) 2025-04-01 21:41:30 -07:00
donald chen
d40bab359c
[mlir][liveness] fix bugs in liveness analysis (#133416)
This patch fixes the following bugs:
- In SparseBackwardAnalysis, the setToExitState function should
propagate changes if it modifies the lattice. Previously, this issue was
masked because multi-block scenarios were not tested, and the traversal
order of backward data flow analysis starts from the end of the program.
- The method in liveness analysis for determining whether the
non-forwarded operand in branch/region branch operations is live is
incorrect, which may cause originally live variables to be marked as not
live.
2025-04-02 11:56:13 +08:00
dpalermo
03a791f703
Revert "[cmake] Refactor clang unittest cmake" (#134022)
Reverts llvm/llvm-project#133545

This change is breaking several buildbots as well as developer's builds.
Reverting to allow people to make progress.
2025-04-01 22:19:27 -05:00
Owen Pan
97dcbdef60 Revert "[clang-format] Handle C++ keywords in other languages better (#132941)"
This reverts commit ab7cee8a0ecf29fdb47c64c8d431a694d63390d2 which had
formatting errors.
2025-04-01 18:59:12 -07:00
Matt Arsenault
55ac652745
llvm-reduce: Do not delete convergencectrl in operand-bundles (#133858)
The IR verifier will fail if there are any convergent calls without
a convergencectrl bundle, if there are any convergencectrl bundles.

With the current verifier rules, we would need to drop all the instances
of convergencectrl in the function as a set, and strip all the
convergence
token intrinsics. As such, I think it would be more appropriate to have
a
separate convergence reduction pass.
2025-04-02 08:48:02 +07:00
Longsheng Mou
222297b020
[mlir] Use Region::hasOneBlock (NFC) (#133879) 2025-04-02 09:40:22 +08:00
ZhaoQi
46968310cb
[LoongArch] Move fix-tle-le-sym-type test to test/MC. NFC (#133839) 2025-04-02 09:11:20 +08:00
Valentin Clement (バレンタイン クレメン)
ae8dd63681
[flang][cuda] Add interface and lowering for all_sync (#134001) 2025-04-01 17:59:11 -07:00
YunQiang Su
e25187bc3e
LLVM/Test: Add vectorizing testcases for fminimumnum and fminimumnum (#133843)
Vectorizing of fminimumnum and fminimumnum have not support yet. Let's
add the testcase for it now, and we will update the testcase when we
support it.
2025-04-02 08:46:02 +08:00
Matheus Izvekov
ad1ca5f4a2
[clang] Concepts: support pack expansions for type constraints (#132626)
This reverts an earlier attempt
(adb0d8ddceb143749c519d14b8b31b481071da77 and
50e5411e4247421fd606f0a206682fcdf0303ae3) to support these expansions,
which was limited to type arguments and which subverted the purpose
of SubstTemplateTypeParmType.

This propagates the ArgumentPackSubstitutionIndex along with the
AssociatedConstraint, so that the pack expansion works, without
needing any new transforms or otherwise any changes to the template
instantiation process.

This keeps the tests from the reverted commits, and adds a few more
showing the new solution also works for NTTPs.

Fixes https://github.com/llvm/llvm-project/issues/131798
2025-04-01 21:11:56 -03:00
Matheus Izvekov
2f25345670
[clang] fix missing initialization msan failure
fixes msan failure reported here: https://lab.llvm.org/buildbot/#/builders/94/builds/5821/steps/17/logs/stdio

This was a regression introduced here: https://github.com/llvm/llvm-project/pull/133610
2025-04-01 21:06:38 -03:00
Petr Sumbera
1a4dc189ad
[OpenMP] allow openmp build for sparc (#133239) 2025-04-01 19:57:14 -04:00
Aiden Grossman
d72be15782 Revert "[CI] Fix Monolithic Linux Build in Ubuntu 24.04 (#133628)"
This reverts commit 23fb048ce35f672d8db3f466a2522354bbce66e5.

This broke the new premerge system as it appears the pip installations within
the CI image do not support this option. Buildkite was unaffected.
2025-04-01 23:43:35 +00:00
Mats Jun Larsen
d53555499f
[lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (#133869)
Part of #123569
2025-04-01 23:27:29 +00:00
Alexey Samsonov
07504afc42
[libc] Stop depending on .cpp files in libcxx_shared_headers library. (#133999)
Fix two instances of libcxx_shared_headers depending on .cpp files (in
Bazel build):

* Don't depend on exit syscall in LIBC_ASSERT implementation. This
dependency is not used, since LIBC_ASSERT always uses system <assert.h>
in the overlay mode, which is the only mode supported by Bazel.
* Don't depend on libc_errno in str-to-float and str-to-integer
conversions. We only need the ERANGE value, which can be obtained from
the proxy header instead.
2025-04-01 16:23:19 -07:00
Craig Topper
749535ba28
[RISCV] Use tablegen HasOneUse. NFC (#133974) 2025-04-01 15:51:39 -07:00
Julian Lettner
c8764f0c65
Fix handling of auto_continue for stop hooks (#129622)
Follow-up fix discussed here:
https://github.com/llvm/llvm-project/pull/129578#issuecomment-2695838042

---------

Co-authored-by: Jim Ingham <jingham@apple.com>
2025-04-01 15:36:35 -07:00
Nico Weber
7b2b3faeb1 [gn build] Port 676755561d5a (ParseTests) 2025-04-01 15:34:00 -07:00
Matthias Springer
69f59d59cb
[mlir][IR] Delete match and rewrite functions (#130259)
The `match` and `rewrite` functions have been deprecated in #130031.
This commit deletes them entirely.

Note for LLVM integration: Update your patterns to use `matchAndRewrite`
instead of separate `match` / `rewrite`.
2025-04-01 15:30:13 -07:00
Florian Mayer
e0c8fc793c
Reapply "[sanitizer] intercept getservent_r, getservbyname_r, getservbyport_r" (#133358) (#133528)
This reverts commit 52d7f14a895eb8669d72cd02754e5586de3e61d8.
2025-04-01 15:25:01 -07:00