Commit Graph

543569 Commits

Author SHA1 Message Date
Florian Hahn
bcbc440712 [VPlan] Add missing VPWidenSelectto VPRecipeWithIRFlags::classof (NFC).
Add missing entry to VPRecipeWithIRFlags. NFC currently as it is never
called on VPWidenSelectRecipes currently.
2025-07-01 22:26:57 +01:00
Han-Chung Wang
42578e8586 [mlir][linalg] Use hasPureTensorSemantics in TransposeMatmul methods. (#146438)
The issue is triggered by
ee070d0816
that checks `TensorLikeType` when downstream projects use the pattern
without registering bufferization::BufferizationDialect. The
registration is needed because the interface implementation for builtin
types locate at `BufferizationDialect::initialize()`. However, we do not
need to fix it by the registration. The proper fix is using the linalg
method, i.e., hasPureTensorSemantics.

No additional tests are added because the functionality is well tested
in
[transpose-matmul.mlir](https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/Linalg/transpose-matmul.mlir).
To reproduce the issue, it requires a different setup, e.g., writing a
new C++ pass, which seems not worth it.

Signed-off-by: hanhanW <hanhan0912@gmail.com>
2025-07-01 14:15:27 -07:00
Chao Chen
5d849d3a90 [mlir][xegpu] Fix seg-fault caused by setting a null attribute (#146002) 2025-07-01 15:42:52 -05:00
Florian Hahn
829f2f2448 [VectorCombine] Mark function as changed if shuffle is created.
777d6b5de9 exposed a code path where a function is modified but not
marked accordingly. Make sure we return true from foldShuffleFromReductions
if only a shuffle has been inserted/replaced.

Should fix    https://lab.llvm.org/buildbot/#/builders/187/builds/7578.
2025-07-01 21:38:29 +01:00
Haojian Wu
ac76e4d8a9 [Serialization] Use SourceLocation::UIntTy for the offset type, NFC 2025-07-01 22:33:23 +02:00
Richard Smith
c56c349d39 [clang-tidy] Switch misc-confusable-identifiers check to a faster algorithm. (#130369)
Optimizations:

- Only build the skeleton for each identifier once, rather than once for
each declaration of that identifier.
- Only compute the contexts in which identifiers are declared for
identifiers that have the same skeleton as another identifier in the
translation unit.
- Only compare pairs of declarations that are declared in related
contexts, rather than comparing all pairs of declarations with the same
skeleton.

Also simplify by removing the caching of enclosing `DeclContext` sets,
because with the above changes we don't even compute the enclosing
`DeclContext` sets in common cases. Instead, we terminate the traversal
to enclosing `DeclContext`s immediately if we've already found another
declaration in that context with the same identifier. (This optimization
is not currently applied to the `forallBases` traversal, but could be
applied there too if needed.)

This also fixes two bugs that together caused the check to fail to find
some of the issues it was looking for:

- The old check skipped comparisons of declarations from different
contexts unless both declarations were type template parameters. This
caused the checker to not warn on some instances of the CVE it is
intended to detect.
- The old check skipped comparisons of declarations in all base classes
other than the first one found by the traversal. This appears to be an
oversight, incorrectly returning `false` rather than `true` from the
`forallBases` callback, which terminates traversal.

This also fixes an issue where the check would have false positives for
template parameters and function parameters in some cases, because those
parameters sometimes have a parent `DeclContext` that is the parent of
the parameterized entity, or sometimes is the translation unit. In
either case, this would cause warnings about declarations that are never
visible together in any scope.

This decreases the runtime of this check, especially in the common case
where there are few or no skeletons with two or more different
identifiers. Running this check over LLVM, clang, and clang-tidy, the
wall time for the check as reported by clang-tidy's internal profiler is
reduced from 5202.86s to 3900.90s.
2025-07-01 13:31:46 -07:00
Kazu Hirata
a061171426 [AsmParser] Remove unnecessary casts (NFC) (#146549)
Linkage is already of GlobalValue::LinkageTypes.
2025-07-01 13:11:02 -07:00
Haojian Wu
650d0151c6 [clang] Improve getFileIDLocal binary search. (#146510)
Avoid reading the `LocalSLocEntryTable` twice per loop iteration. NFC.

https://llvm-compile-time-tracker.com/compare.php?from=0b6ddb02efdcbdac9426e8d857499ea0580303cd&to=1aa335ccfb07ba96177b89b1933aa6b980fa14f6&stat=instructions:u
2025-07-01 21:59:09 +02:00
Florian Hahn
777d6b5de9 [VectorCombine] Use InstSimplifyFolder to simplify instrs on creation. (#146350)
Update VectorCombine to use InstSimplifyFolder to simplify redundant
instructions on creation.

PR: https://github.com/llvm/llvm-project/pull/146350
2025-07-01 20:55:51 +01:00
Florian Hahn
6b3d2b629c [VPlan] Add VPExpressionRecipe, replacing extended reduction recipes. (#144281)
This patch adds a new recipe to combine multiple recipes into an
'expression' recipe, which should be considered as single entity for
cost-modeling and transforms. The recipe needs to be 'decomposed', i.e.
replaced by its individual recipes before execute.

This subsumes VPExtendedReductionRecipe and
VPMulAccumulateReductionRecipe and should make it easier to extend to
include more types of bundled patterns, like e.g. extends folded into
loads or various arithmetic instructions, if supported by the target.

It allows avoiding re-creating the original recipes when converting to
concrete recipes, together with removing the need to record various
information. The current version of the patch still retains the original
printing matching VPExtendedReductionRecipe and
VPMulAccumulateReductionRecipe, but this specialized print could be
replaced with printing the bundled recipes directly.

PR: https://github.com/llvm/llvm-project/pull/144281
2025-07-01 20:44:50 +01:00
Meredith Julian
7da8ed8d33 Fix missing/outdated pass options in PassRegistry.def (#146160)
There are a handful of passes in PassRegistry.def with outdated or
missing pass options. These strings describing pass options are used for
the printPassNames() function only, which is likely why they have gotten
out-of-date without being caught. This MR simply changes the few passes
where the option string is out-of-date, fixing the output of
-print-passes. This does not affect functionality of the pipeline
parser, and is hard to verify in a unit test, so no tests were added.
2025-07-01 12:41:26 -07:00
Matthias Springer
d480359420 [mlir][sparse] Do not access operation after it was replaced (#146546)
Accessing an erased operation will no longer work during a One-Shot
Dialect Conversion.
2025-07-01 21:39:54 +02:00
S. VenkataKeerthy
119292c40b [IR2Vec] Add out-of-place arithmetic operators to Embedding class (#145118)
This PR adds out-of-place arithmetic operators (`+`, `-`, `*`) to the `Embedding` class in IR2Vec, complementing the existing in-place operators (`+=`, `-=`, `*=`). 

Tests have been added to verify the functionality of these new operators.

(Tracking issue - #141817)
2025-07-01 12:09:54 -07:00
S. VenkataKeerthy
efe0deae3f [NFC][IR2Vec] Increasing tolerance in approximatelyEquals() of Embedding (#145117)
Increase the default tolerance for `approximatelyEquals` in IR2Vec's Embedding class from 1e-6 to 1e-4.

(Tracking issue - #141817)
2025-07-01 12:03:37 -07:00
Amr Hesham
6fafa46f8c [CIR] Upstream PackIndexingExpr for ScalarExpr (#146239)
Upstream PackIndexingExpr for ScalarExpr
2025-07-01 20:59:53 +02:00
Amr Hesham
e11d354d64 [CIR] Upstream GenericSelectionExpr (#146211)
Upstream GenericSelectionExpr for ScalarExpr
2025-07-01 20:56:39 +02:00
Amr Hesham
67f1eb5c17 [CIR] Comma Operator for ComplexType (#146204)
This change adds support for the comma operator for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-01 20:55:58 +02:00
Timm Baeder
b54e02a40b [clang][bytecode] Check pointer data type for bitcast eligibility (#146552)
So we get the proper type for a heap-allocated value.
2025-07-01 20:37:09 +02:00
Amr Hesham
8dbfe83681 [CIR] Fix mlir::ValueRange init from ArrayRef warning (#146577)
Fix initalizing ValueRange with ArrayRef
`ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}` warning
2025-07-01 20:32:04 +02:00
Amr Hesham
491c79f763 [CIR] Implement ArraySubscript for ComplexType (#146283)
Implement ArraySubscript for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-01 20:27:29 +02:00
Changpeng Fang
5035d20dcb AMDGPU: Implement ds_atomic_async_barrier_arrive_b64/ds_atomic_barrier_arrive_rtn_b64 (#146409)
These two instructions are supported by gfx1250. We define the
instructions and implement the corresponding intrinsic and builtin.

Co-authored-by: Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
2025-07-01 11:08:49 -07:00
Jonas Devlieghere
3edae0d5e5 [lldb] Use EL_REFRESH to refresh Editline
Letting Editline refresh itself is more robust and ensures that the
current text is redraw if it was accidentally cleared. In that scenario
MoveCursor would only fix up the cursor position.
2025-07-01 11:08:11 -07:00
S. VenkataKeerthy
35b80031f4 [NFC] Formatting PassRegistry.def (#144139) 2025-07-01 11:03:43 -07:00
Kazu Hirata
c17e88f07e [Analysis] Remove a workaround for ancient GCC (NFC) (#146550)
The version of GCC mentioned is older than currently required GCC 7.4.
The comment about the crash dates back to 2014.
2025-07-01 10:42:29 -07:00
Kazu Hirata
e79e22c9af [AMDGPU] Remove an unnecessary cast (NFC) (#146548)
Val is already of uint64_t.
2025-07-01 10:42:22 -07:00
Kazu Hirata
72a9c3cced [Analysis] Remove an unnecessary cast (NFC) (#146547)
ME is already of ObjCMessageExpr *.
2025-07-01 10:42:14 -07:00
Kazu Hirata
98e6d5cd47 [lldb] Fix warnings
This patch fixes:

  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:279:15:
  error: format specifies type 'unsigned long' but the argument has
  type 'file_t' (aka 'int') [-Werror,-Wformat]

  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:383:15:
  error: format specifies type 'unsigned long' but the argument has
  type 'file_t' (aka 'int') [-Werror,-Wformat]
2025-07-01 10:41:07 -07:00
Kazu Hirata
d79c284a2f [flang] Fix a warning
This patch fixes:

  flang/lib/Semantics/check-omp-structure.cpp:1747:41: error: lambda
  capture 'this' is not used [-Werror,-Wunused-lambda-capture]
2025-07-01 10:34:41 -07:00
John Harrison
a79404e50c [lldb] Correct an assertion name. 2025-07-01 10:26:32 -07:00
Changpeng Fang
c8450ea226 AMDGPU: Remove the unnecessary needAlias argument in DS_Real_gfx12 (#146439) 2025-07-01 10:20:25 -07:00
Joe Nash
21d5017a05 [AMDGPU] Refactor FLAT_Load_Pseudo class (#146539)
NFC. Refactor it to make it easier to inherit from.
2025-07-01 12:51:15 -04:00
Simon Pilgrim
b697b801b1 [X86] freeze-vector.ll - fix cut+pasta typo in frozen build vector tests
Ensure we load BOTH scalars, inserted into different positions into separate vectors with the freeze(poison) base

Noticed while triaging regressions in #145939
2025-07-01 17:36:43 +01:00
Sameer Sahasrabuddhe
a34a024812 [AMDGPU][SIInsertWaitCnts] skip meta instructions early (#145720)
When iterating over a block, meta instructions have no effect on wait counts,
but their presence drops the reference to earlier waitcnt instructions before
they are processed. This results in spurious wait counts, which do not affect
correctness, but are also not required in the resulting program. Skipping meta
instructions as soon as they are seen cleans this up.
2025-07-01 22:02:48 +05:30
Benjamin Kramer
13e6ea7b4c [bazel] Add missing dependency for 08cf6ae537 2025-07-01 18:21:45 +02:00
Guy David
01a6c08533 [PHIElimination] Verify reappropriated COPY is of similar register class, update livevars. (#146337)
Follow up to the second bug that
https://github.com/llvm/llvm-project/pull/131837 introduced, described
in
https://github.com/llvm/llvm-project/pull/131837#issuecomment-3018777795.
2025-07-01 19:18:31 +03:00
Krzysztof Parzyszek
ba116a8bed [flang][OpenMP] Split check-omp-structure.cpp into smaller files, NFC (#146359)
Create these new files in flang/lib/Semantics:
  openmp-utils.cpp/.h         - Common utilities
  check-omp-atomic.cpp        - Atomic-related checks
  check-omp-loop.cpp          - Loop constructs/clauses
  check-omp-metadirective.cpp - Metadirective-related checks

Update lists of included headers, std in particular.

---------

Co-authored-by: Jack Styles <jack.styles@arm.com>
2025-07-01 11:12:00 -05:00
John Harrison
1a7b7e24bc [lldb] Adding pipe support to lldb_private::MainLoopWindows. (#145621)
This updates MainLoopWindows to support events for reading from a pipe
(both anonymous and named pipes) as well as sockets.

This unifies both handle types using `WSAWaitForMultipleEvents` which
can listen to both sockets and handles for change events.

This should allow us to unify how we handle watching pipes/sockets on
Windows and Posix systems.

We can extend this in the future if we want to support watching other
types, like files or even other events like a process life time.

---------

Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-07-01 08:59:27 -07:00
sribee8
47e28d9cd1 [libc] wcscspn implementation (#146158)
Implemented wcscspn and tests.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-07-01 15:56:09 +00:00
Luke Lau
04c614327c [InstCombine] Pull vector reverse through intrinsics (#146384)
This is the intrinsic version of #146349, and handles fabs as well as
other intrinsics.

It's largely a copy of InstCombinerImpl::foldShuffledIntrinsicOperands
but a bit simpler since we don't need to find a common mask.

Creating a separate function seems to be cleaner than trying to shoehorn
it into the existing one.
2025-07-01 16:49:10 +01:00
Shilei Tian
4dab0b2300 [AMDGPU] Fix wrong reverse operations for v_cmpx_le_u32 (#146398)
Fixes: SWDEV-538616
2025-07-01 11:48:08 -04:00
Matthias Springer
569ca0f698 [mlir][async] Erase op later to preserve insertion point (#146516)
Delay the erasure of an op, so that the insertion point of the rewriter
remains valid.

This commit is in preparation of the One-Shot Dialect Conversion
refactoring. (The current implementation works with the current dialect
conversion driver because op erasure is delayed.)
2025-07-01 17:25:21 +02:00
Charles Zablit
0c124be33f [lldb][NFC] Inline ResolveSDKPathFromDebugInfo in one of its call site (#146062)
This patch is part of an effort to remove the
`ResolveSDKPathFromDebugInfo` method, and more specifically the variant
which takes a Module as argument.

See the following PR for a follow up on what to do:
- https://github.com/llvm/llvm-project/pull/144913.

---------

Co-authored-by: Michael Buch <michaelbuch12@gmail.com>
2025-07-01 16:23:23 +01:00
Kajetan Puchalski
69b69cbcb4 [flang][tco] Add -emit-final-mlir flag (#146533)
Add a flag to tco for emitting the final MLIR, prior to lowering to LLVM
IR. This is intended to produce output that can be passed directly to
mlir-translate.

---------

Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
2025-07-01 16:22:36 +01:00
Joseph Huber
3cff3d882b [Offload] Add skeleton for offload conformance tests (#146391)
Summary:
This adds a basic outline for adding 'conformance' tests. These are
tests that are intended to check device code against a standard. In this
case, we will expect this to be filled with math conformance tests to
make sure their results are within the ULP requirements we demand.

Right now this just *assumes* the GPU libc is there, meaning you'll
likely need to do a manual `ninja` before doing `ninja -C
runtimes/runtimes-bins offload.conformance`.
2025-07-01 10:20:40 -05:00
Simon Pilgrim
6b1c92cbcb [X86] legalize-sub-zero.ll - regenerate test checks 2025-07-01 16:07:32 +01:00
Krzysztof Parzyszek
86077c41a7 [flang][OpenMP] Rewrite min/max with more than 2 arguments (#146423)
Given an atomic operation `w = max(w, x1, x2, ...)` rewrite it as `w =
max(w, max(x1, x2, ...))`. This will avoid unnecessary non-atomic
comparisons inside of the atomic operation (min/max are expanded
inline).

In particular, if some of the x_i's are optional dummy parameters in the
containing function, this will avoid any presence tests within the
atomic operation.

Fixes https://github.com/llvm/llvm-project/issues/144838
2025-07-01 09:54:58 -05:00
David Green
6e3465cd0f [AArch64] Fix ldp rename through a bundle (#146415)
std::prev(Paired) will get the previous instruction, that might skip
over the instructions in a bundle to the BUNDLE itself. Change it to
Paired->getPrevNode() to make sure we update the registers in each
instruction in the bundle.
2025-07-01 15:44:59 +01:00
David Green
5332534b9c [ARM] Add neon vector support for ceil
As per #142559, this marks fceil as legal for Neon and upgrades the existing
arm.neon.vrintp intrinsics.
2025-07-01 15:41:10 +01:00
Ilya Biryukov
cf9374933d [Modularize] Make Location::operator bool explicit
This unbreaks C++20 buildbot that was broken since
402baea0a9.

With implicit conversion in C++20 compilation mode the spaceship
will unintentionally be based on `operator bool`:

```cpp
auto foo(Location L, Location R) {
  return L <=> R;
  // Equivalent to the following line due to implicit conversions.
  // return L.operator bool() <=> R.operator bool();
}
```

The spaceship operator is rarely used explicitly, but its implicit uses
in the STL may cause surprising results, as exposed by the use of  `std::tie`
in 402baea0a9, which ended up changing the
comparisons results unintentionally.
2025-07-01 16:38:07 +02:00
Rahul Joshi
d7b8b65e23 [LLVM][TableGen][DecoderEmitter] Add wrapper struct for bit_value_t (#146248)
Add a convenience wrapper struct for the `bit_value_t` enum type to host
various constructors, query, and printing support. Also refactor related
code in several places. In `getBitsField`, use `llvm::append_range` and
`SmallVector::append()` and eliminate manual loops. Eliminate
`emitNameWithID` and instead use the `operator <<` that does the same
thing as this function. Have `BitValue::getValue()` (replacement for
`Value`) return std::optional<> instead of -1 for unset bits. Terminate
with a fatal error when a decoding conflict is encountered.
2025-07-01 07:36:17 -07:00