546956 Commits

Author SHA1 Message Date
Kseniya Tikhomirova
4cec4938c6
[SYCL] Add libsycl, a SYCL RT library implementation project (#144372)
This patch introduces libsycl, a SYCL runtime library implementation, as
a top-level LLVM runtime project.
SYCL spec:
https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html

Commit contains the basic folder layout and CMake infrastructure to
build a dummy SYCL library.

This is part of the SYCL support upstreaming effort. The relevant RFCs
can be found here:


https://discourse.llvm.org/t/rfc-add-full-support-for-the-sycl-programming-model/74080
https://discourse.llvm.org/t/rfc-sycl-runtime-upstreaming/74479

Upcoming PRs:
- UR offloading library fetch & build 
- partial implementation of sycl::platform: requires offloading layer,
requires classes for backend loading & enumeration.

---------

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
2025-07-31 11:28:39 -07:00
Kazu Hirata
3a18fe33f0 [Utils] Fix a warning
This patch fixes:

  llvm/lib/Transforms/Utils/LoopUtils.cpp:818:28: error: unused
  function 'operator<<' [-Werror,-Wunused-function]
2025-07-31 11:24:33 -07:00
Florian Hahn
078d214672
[TailDup] Delay aggressive computed-goto taildup to after RegAlloc. (#150911)
https://github.com/llvm/llvm-project/pull/114990 allowed more aggressive
tail duplication for computed-gotos in both pre- and post-regalloc tail
duplication.

In some cases, performing tail-duplication too early can lead to worse
results, especially if we duplicate blocks with a number of phi nodes.

This is causing a ~3% performance regression in some workloads using
Python 3.12.

This patch updates TailDup to delay aggressive tail-duplication for
computed gotos to after register allocation.

This means we can keep the non-duplicated version for a bit longer
throughout the backend, which should reduce compile-time as well as
allowing a number of optimizations and simplifications to trigger before
drastically expanding the CFG.

For the case in https://github.com/llvm/llvm-project/issues/106846, I
get the same performance with and without this patch on Skylake.

PR: https://github.com/llvm/llvm-project/pull/150911
2025-07-31 19:20:05 +01:00
Nico Weber
5482ef76f5 [gn] port 3f066f5fcfba 2025-07-31 13:54:24 -04:00
Xiaolei Feng
1bc5885186
[MLIR][SPIRV] Add spirv.IsFinite and lower math.{isfinite,isinf,isnan} to spirv. (#151552)
This patch adds support for lowering several float classification ops
from the Math dialect to the SPIR-V dialect.

### Highlights:
- Introduced a new `spirv.IsFinite` operation corresponding to the
SPIR-V `OpIsFinite` instruction.
- Lowered `math.isfinite`, `math.isinf`, and `math.isnan` to SPIR-V
using `CheckedElementwiseOpPattern`.
- Added corresponding tests for op definition and conversion lowering.

This addresses the discussion in:
https://github.com/llvm/llvm-project/issues/150778

---

Let me know if any additional adjustments are needed!

---------

Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
2025-07-31 13:54:14 -04:00
Stanislav Mekhanoshin
7f93487862
[AMDGPU] Add v_cvt_pk_f16_f32 instruction for gfx1250 (#151469) 2025-07-31 10:45:06 -07:00
jeremyd2019
e5402c977f
[llvm] Enable building Analysis plugins on Cygwin (#151397)
In #112303 they were enabled for Windows dylib builds, but the condition
excluded Cygwin in that case. Their dynamic libraries work the same way,
so adjust the condition accordingly.

This fixes the plugin tests on Cygwin.
2025-07-31 10:41:02 -07:00
Steven Wu
441f5b0e36
[clang] Infer compilation directory in driver
When building with -fdebug-compilation-dir/-fcoverige-compilation-dir,
infer the compilation directory in clang driver, rather than try to
fallback to VFS current working directory lookup during CodeGen. This
allows compilation directory to be used as it is passed via cc1 flag and
the value can be empty to remove dependency on CWD if needed.

Reviewers: adrian-prantl, dwblaikie

Reviewed By: adrian-prantl, dwblaikie

Pull Request: https://github.com/llvm/llvm-project/pull/150112
2025-07-31 10:39:06 -07:00
Max191
91e0055c7c
[mlir] Implement inferResultRanges for vector.step op (#151536)
Implements the `inferResultRanges` method from the
`InferIntRangeInterface` interface for `vector.step`. The implementation
is similar to that of arith.constant, since the exact result values are
statically known.

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
2025-07-31 10:35:26 -07:00
Dave Lee
f23c10f9e6
[lldb] Fallback to expression eval when Dump of variable fails in dwim-print (#151374)
Previously, when dwim-print finds a frame variables, it returns immediately after
calling `Dump`, even if `Dump` returns an error. This is most likely to happen when
evaluating an object description, ie `po`.

This changes dwim-print to continue on to expression evaluation when `Dump`ing a
variable returns an error . This is to allow for diagnostics that match `expression`.
2025-07-31 10:28:12 -07:00
Aiden Grossman
5d489b82a1
[clang-tools-extra] Remove %T from lit tests (#151538)
%T has been deprecated for about seven years since it is not unique to
each test and can thus lead to races. This patch removes uses of %T from
clang-tools-extra with the eventual goal of removing support for %T from
lit.
2025-07-31 10:27:15 -07:00
William Huynh
38fa11f5b4
[libc] Remove constexpr from asin_eval() (#151528)
fputil::multiply_add is conditionally constexpr, on some architectures,
it selects the non-constexpr version, resulting in a compile error.
2025-07-31 13:20:37 -04:00
sujianIBM
fc12fc635b
[SystemZ] Fix code in widening vector multiplication (#150836)
Commit cdc7864 has an error which would wrongly fold widening
multiplications into an even/odd widening operation.
This PR fixes it and adds tests to check scenarios which should not be
folded into an even/odd widening operation are actually not.
2025-07-31 13:18:23 -04:00
Amr Hesham
03e54a148f
[CIR] Upstream MulOp for ComplexType (#150834)
This change adds support for mul op for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-31 19:16:42 +02:00
Jungwook Park
90e710b513
[mlir][scf] Add no_inline attribute to scf.execute_region (#151352)
Enabling users to explicitly specify which regions should be preserved,
uncovers additional opportunities to utilize `scf.execute_region` op.
2025-07-31 18:04:17 +01:00
Peter Collingbourne
7cdc9781d4
MachineInstrBuilder: Introduce copyMIMetadata() function.
This reduces the amount of boilerplate required when adding a new
field to MIMetadata and reduces the chance of bugs like the
one I fixed in TargetInstrInfo::reassociateOps.

Reviewers: arsenm, nikic

Reviewed By: nikic

Pull Request: https://github.com/llvm/llvm-project/pull/133535
2025-07-31 09:53:01 -07:00
Florian Hahn
69f3ea0852
[MachineBB] Make sure there are successors in terminatorIsComputedGoto. (#151342)
Currently terminatorIsComputedGoto will return for blocks with a
indirect branch terminator and no successor. If there are no successor,
the terminator is likely not a computed goto, return false in that case.

Note that this is currently NFC, as the only use checks it only if there
are successors, but it will be needed in
https://github.com/llvm/llvm-project/pull/150911.

PR: https://github.com/llvm/llvm-project/pull/151342
2025-07-31 17:52:45 +01:00
Andy Kaylor
3ca2050aa6
[CIR] Fix fallthrough warning (#151418)
This fixes a warning about an unannotated fallthrough.
2025-07-31 09:46:25 -07:00
Farzon Lotfi
b59cb281c1
[HLSL] fix D3DCOLORtoUBYTE4 return type to be int (#151353)
fixes #150673
fixes #150678

The issue was we were using the wrong return type.
2025-07-31 12:34:02 -04:00
Max191
69751196a9
[mlir] Implement inferResultRanges for vector.transpose (#151537)
Implements the `inferResultRanges` method from the
`InferIntRangeInterface` interface for `vector.transpose`. The result
ranges simply match the source ranges.

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
2025-07-31 09:32:50 -07:00
Daniel Paoliello
4adce336f4
[win][arm64ec] Fixes to unblock building LLVM and Clang as Arm64EC (#150068)
These changes allow LLVM and Clang to be built with Clang targeting
Arm64EC using the MSVC linker.

Built with these options:
```
-DLLVM_ENABLE_PROJECTS="clang"
-DLLVM_HOST_TRIPLE=arm64ec-pc-windows-msvc
-DCMAKE_C_COMPILER=clang-cl.exe
-DCMAKE_C_COMPILER_TARGET=arm64ec-pc-windows-msvc
-DCMAKE_CXX_COMPILER=clang-cl.exe
-DCMAKE_CXX_COMPILER_TARGET=arm64ec-pc-windows-msvc
-DCMAKE_LINKER_TYPE=MSVC
```
2025-07-31 09:30:05 -07:00
Joel E. Denny
f7b65011de
[PGO] Add llvm.loop.estimated_trip_count metadata (#148758)
This patch implements the `llvm.loop.estimated_trip_count` metadata
discussed in [[RFC] Fix Loop Transformations to Preserve Block
Frequencies](https://discourse.llvm.org/t/rfc-fix-loop-transformations-to-preserve-block-frequencies/85785).
As [suggested in the RFC
comments](https://discourse.llvm.org/t/rfc-fix-loop-transformations-to-preserve-block-frequencies/85785/4),
it adds the new metadata to all loops at the time of profile ingestion
and estimates each trip count from the loop's `branch_weights` metadata.
As [suggested in the PR #128785
review](https://github.com/llvm/llvm-project/pull/128785#discussion_r2151091036),
it does so via a new `PGOEstimateTripCountsPass` pass, which creates the
new metadata for each loop but omits the value if it cannot estimate a
trip count due to the loop's form.

An important observation not previously discussed is that
`PGOEstimateTripCountsPass` *often* cannot estimate a loop's trip count,
but later passes can sometimes transform the loop in a way that makes it
possible. Currently, such passes do not necessarily update the metadata,
but eventually that should be fixed. Until then, if the new metadata has
no value, `llvm::getLoopEstimatedTripCount` disregards it and tries
again to estimate the trip count from the loop's current
`branch_weights` metadata.
2025-07-31 12:28:25 -04:00
Luke Lau
3e579d93ab [VPlan] Fix unit test without LLVM_ENABLE_DUMP. NFC
Without dumping the faulty recipe isn't printed, so account for that
like in the other tests. Fixes the buildbot failure at
https://lab.llvm.org/buildbot/#/builders/2/builds/30229
2025-08-01 00:17:47 +08:00
Aadesh Premkumar
0c3092b5b3
[SPIRV] Test for spirv-target-types.ll and unused-sret-opaque-ptr.ll (#142281)
Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
2025-07-31 09:11:16 -07:00
Akash Banerjee
0aa5502d68 Fix build error from #151511. 2025-07-31 17:08:03 +01:00
Jordan Rupprecht
c05611f191
[bazel] Port #150633 HLSLBinding.h (#151546) 2025-07-31 11:04:14 -05:00
Venkata Ramanaiah Nalamothu
523b4b0312
[Docs] Fix typo in shadow call stack option name (#151474)
Fix typo in shadow call stack option name mentioned in
'ShadowCallStack.rst'.
2025-07-31 21:31:23 +05:30
Snehasish Kumar
b92979aae7
[MemProf] Fix FileCheck prefix in the histogram test. (#150506)
The test is fine though it seems the checks weren't being enforced
because of the typo.
2025-07-31 08:59:16 -07:00
David Green
8f968fe3ec
[AggressiveInstCombine] Make cttz fold more resiliant to non-array geps (#150896)
Similar to #150639 this fixes the AggressiveInstCombine fold for convert
tables to cttz instructions if the gep types are not array types. i.e
`gep i16 @glob, i64 %idx` instead of `gep [64 x i16] @glob, i64 0, i64 %idx`.
2025-07-31 16:53:55 +01:00
Jordan Rupprecht
d520daeb82
[bazel] Port #145358: LIBC_THREAD_MODE (#151539)
I'm not sure how libc should be configuring this in bazel, but for now
it seems like `LIBC_THREAD_MODE_PLATFORM` restores the default behavior.

Defining this param is required:
```
ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/c9d34ded3a9d94cc250207948aceadfc/external/llvm-project/libc/BUILD.bazel:5788:14: Compiling libc/src/stdio/generic/vprintf.cpp failed: (Exit 1): clang failed: error executing CppCompile command (from target @@llvm-project//libc:vprintf) /usr/lib/llvm-18/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer ... (remaining 31 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/llvm-project/libc/src/stdio/generic/vprintf.cpp:11:
In file included from external/llvm-project/libc/src/__support/File/file.h:19:
external/llvm-project/libc/src/__support/threads/mutex.h:25:2: error: LIBC_THREAD_MODE is undefined
   25 | #error LIBC_THREAD_MODE is undefined
      |  ^
```

As an alternative to this PR, we could make the libc header default to
`LIBC_THREAD_MODE_PLATFORM` if not provided, instead of an `#error`
2025-07-31 10:39:34 -05:00
Justin Bogner
3f066f5fcf
[HLSL][DirectX] Extract HLSLBinding out of DXILResource. NFC (#150633)
We extract the binding logic out of the DXILResource analysis passes into the
FrontendHLSL library. This will allow us to use this logic for resource and
root signature bindings in both the DirectX backend and the HLSL frontend.
2025-07-31 08:35:47 -07:00
Morris Hafner
8a5d363123
[CIR] Upstream support for function-level variable decompositions (#151073)
This implements support for structured bindings on a function scope
level. It does not add support for global structured bindings.
2025-07-31 17:34:41 +02:00
Florian Hahn
99d70e09a9
[SCEV] Allow adds of constants in tryToReuseLCSSAPhi. (#150693)
Update the logic added in
https://github.com/llvm/llvm-project/pull/147824 to also allow adds of
constants. There are a number of cases where this can help remove
redundant phis and replace some computation with a ptrtoint (which
likely is free in the backend).

PR: https://github.com/llvm/llvm-project/pull/150693
2025-07-31 16:33:25 +01:00
Krzysztof Drewniak
bd04138935
[mlir] Add non-attribute property predicates to adaptor verifiers (#150881)
When adding a predicated field to non-attribute properties /
implemneting PropConstraint, a call to genPropertyVerifiers() wasn't
added to the generation sequence for [Op]GenericAdaptor::verify. This
commit fixes the issue.
2025-07-31 10:30:24 -05:00
Jonas Devlieghere
7abb519e9e
[lldb] Add release note for Wasm debugging (#151445)
Add a release note for Wasm debugging.
2025-07-31 08:15:23 -07:00
Andres-Salamanca
4005edd5c4
[CIR] Add ComputeVolatileBitfields Implementation (#151252)
This PR adds the implementation of the `ComputeVolatileBitfields`
function for the AAPCS ABI, following the rules described in [AAPCS64
§8.1.8.5 Volatile
Bit-fields](f52e1ad3f8/aapcs64/aapcs64.rst (8185volatile-bit-fields----preserving-number-and-width-of-container-accesses)).
When accessing a volatile bit-field either reading or writing the
compiler must perform a load or store using the access size that matches
the width of the declared type (i.e., the type of the container), rather
than the packed bit-field size.
For example, if a field is declared as `int`, it must read or write 32
bits, even if the bit-field is only 3 bits wide.
The `ComputeVolatileBitfields` function calculates the correct values
and offsets necessary for proper lowering of volatile bitfields.
Support for emitting calls to `get_bitfield` and `set_bitfield` with the
correct access size for volatile bitfields will be implemented in a
future PR.
2025-07-31 10:12:56 -05:00
Luke Lau
08c5944222
[VPlan] Fix header phi VPInstruction verification. NFC (#151472)
Noticed this when checking the invariant that all phis in the header
block must be header phis. I think there's a missing set of parentheses
here, since otherwise it only cast<VPInstruction> when RecipeI isn't a
VPInstruction.
2025-07-31 23:09:20 +08:00
Nikita Popov
e2bd92e56b [AMDGPU] Regenerate test checks (NFC) 2025-07-31 17:02:48 +02:00
Akash Banerjee
9fdd1d3d46
[Flang] Add parser support for AUTOMAP modifier (#151511)
Add parser support for the new AUTOMAP modifier for OpenMP Declare
Target Enter clause introduced in OpenMP 6.0 section 7.9.7.
2025-07-31 15:56:16 +01:00
Prabhu Rajasekaran
9e0dc4f737
[MachineFunction] Move CallSiteInfo constructor out of header (#151520) 2025-07-31 07:34:46 -07:00
Morris Hafner
77f8a9115e
[CIR] Support more declarations without any codegen (#151076)
This patch adds or completes support for a couple of top level
declaration types that don't emit any code: Most notably these include
Concepts, static_assert and type aliases.
2025-07-31 16:33:20 +02:00
Kazu Hirata
c923d968b3
[Basic] Remove deprecated methods in CustomizableOptional (#151444)
This patch removes deprecated methods in CustomizableOptional.

These methods come from llvm::Optional, which later got renamed to
CustomizableOptional.  Since CustomizableOptional is used only in
OptionalDirectoryEntryRef and OptionalFileEntryRef, we do not need to
have full std::optional-like support in CustomizableOptional.
2025-07-31 07:31:30 -07:00
Kazu Hirata
5bb59e4716
[llvm] Proofread LangRef.rst (#151443) 2025-07-31 07:31:23 -07:00
Kazu Hirata
a74948471a
[ExecutionEngine] Remove unnecessary casts (NFC) (#151442)
WA, WA1, and WA2 are already of char *.
2025-07-31 07:31:15 -07:00
Kazu Hirata
e4d47832a1
[Bitstream] Remove unnecessary casts (NFC) (#151441)
getNumOperandInfos() already returns unsigned.
2025-07-31 07:31:07 -07:00
Kazu Hirata
3aa7235ece
[AMDGPU] Remove an unnecessary cast (NFC) (#151440)
getZExtValue() already returns uint64_t.
2025-07-31 07:30:59 -07:00
Dmitry Vasilyev
c00df536e3
[BOLT] Fixed cmdline-args.test to work on Windows (#151209)
Added regex to ignore `.exe` in the executable name. 
Ignored OS-dependent message "No such file or directory".
2025-07-31 18:25:39 +04:00
Dmitry Vasilyev
c39b1aedd1
[BOLT] Fixed calling clang++ in tests on Windows (#151193)
`RUN: %clang++ ` tried to execute `clang.exe++` on Windows. Use `%clangxx` instead.
2025-07-31 18:25:09 +04:00
Nikita Popov
a71909156e
[InstCombine] Set flags when canonicalizing GEP indices (#151516)
When truncating set nsw/nuw based on nusw/nuw. When extending, use zext
nneg if nusw+nuw.

Proof: https://alive2.llvm.org/ce/z/JA2Yzr
2025-07-31 15:58:04 +02:00
James Y Knight
9ddbb478ce
NFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for llvm::vfs::FileSystem. (#151407)
This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new
object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>`
instead of `FileSystem*` or `FileSystem&`, when dealing with existing
objects.

Part of cleanup #151026.
2025-07-31 09:57:13 -04:00