Commit Graph

541885 Commits

Author SHA1 Message Date
Benjamin Kramer
680bce0072 [bazel] Add missing dependency for c7165587e4 2025-06-23 13:28:57 +02:00
Hans Wennborg
1e95349dbe Revert "ELF: Add branch-to-branch optimization."
This caused assertion failures in applyBranchToBranchOpt():

  llvm/include/llvm/Support/Casting.h:578:
  decltype(auto) llvm::cast(From*)
  [with To = lld::elf::InputSection; From = lld::elf::InputSectionBase]:
  Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

See comment on the PR (https://github.com/llvm/llvm-project/pull/138366)

This reverts commit 491b82a5ec.

This also reverts the follow-up "[lld] Use llvm::partition_point (NFC) (#145209)"

This reverts commit 2ac293f5ac.
2025-06-23 13:26:02 +02:00
Dmitry Vasilyev
6d8d4cf9a4 [lldb] Disable flaky TestDetachResumes.py on Windows x86_64 (#145301)
See #144891 for details.
2025-06-23 15:25:08 +04:00
Simon Pilgrim
1d907c28b6 [VectorCombine][X86] fmaddsub.ll - add test variants without any undef elements 2025-06-23 12:18:32 +01:00
Nikita Popov
cfcb7888c7 [EarlyCSE] Fix dead store elimination for unwinding readnone calls (#145287)
EarlyCSE already resets LastStore when it hits an potentially unwinding
instruction, as the memory state may be observed by the caller after the
unwind.

There also was a test specifically making sure that this works even for
unwinding readnone calls -- however, the call in that test did not
participate in EarlyCSE in the first place, because it returns void
(relaxing that is how I got here), so it was not actually testing the
right thing.

Move the check for unwinding instructions earlier, so it also handles
the readnone case.
2025-06-23 12:44:14 +02:00
Nikita Popov
e56384ff54 [IRTranslator] Remove unnecessary isIntrinsic() check (NFC)
Directly call getIntrinsicID(), there is no need to check for
isIntrinsic() first.
2025-06-23 12:43:19 +02:00
Nicolas Vasilache
7360ed0159 [mlir][transform] Drop redundant padding_dimensions spec from pad_tiling_interface (#145257)
This revision aligns padding specification in pad_tiling_interface to
that of tiling specification.
Dimensions that should be skipped are specified by "padding by 0".
Trailing dimensions that are ignored are automatically completed to "pad
to 0".
2025-06-23 12:29:22 +02:00
Nicolas Vasilache
d9a99afbfc [mlir][transform] Plumb a simplified form of AffineMin folding into t… (#145170)
…ransform.pad-tiling-interface

This revision introduces a simple variant of AffineMin folding in
makeComposedFoldedAffineApply and makes use of it in
transform.pad-tiling-interface. Since this version explicitly call
ValueBoundsInterface, it may be too expensive and is only activate
behind a flag.
It results in better foldings when mixing tiling and padding, including
with dynamic shapes.
2025-06-23 12:23:24 +02:00
Ross Brunton
02d2a1646a [Offload] Fix entry_points.td test (#145292)
This was broken as part of #144494 , and just needs an update to the
check lines.
2025-06-23 11:09:08 +01:00
Pavel Labath
18f667d804 Revert "[lldb/cmake] Plugin layering enforcement mechanism (#144543)"
Causes failures on several bots.

This reverts commits 714b2fdf3a and
e7c1da7c8e.
2025-06-23 12:07:10 +02:00
Matthias Springer
b1b8f67eab [mlir][Transforms] Add 1:N support to replaceUsesOfBlockArgument (#145171)
This commit adds 1:N support to
`ConversionPatternRewriter::replaceUsesOfBlockArgument`. This was one of
the few remaining dialect conversion APIs that does not support 1:N
conversions yet.

This commit also reuses `replaceUsesOfBlockArgument` in the
implementation of `applySignatureConversion`. This is in preparation of
the One-Shot Dialect Conversion refactoring. The goal is to bring the
`applySignatureConversion` implementation into a state where it works
both with and without rollbacks. To that end, `applySignatureConversion`
should not directly access the `mapping`.
2025-06-23 12:07:00 +02:00
David Green
2545d6f723 [ARM] Add MVE test coverage for LD2/ST2 shuffle costs. NFC 2025-06-23 11:06:25 +01:00
Marco Elver
0662045bdf [TLI] Add support for pvalloc() (#144949)
While pvalloc() is a legacy POSIX function, it remains widely available
in common C libraries like glibc.

Model pvalloc() in TargetLibraryInfo, allowing LLVM to correctly infer
its attributes.
2025-06-23 12:03:35 +02:00
Pavel Labath
714b2fdf3a [lldb] Add BRIEF_DOCS for cmake properties defined in #144543
It seems some cmake versions require it.
2025-06-23 11:39:20 +02:00
Ebuka Ezike
5c22793ead [lldb-dap][test] Refactor runInTerminal Tests. (#144954)
Replace `isTestSupported` function with `skipIfBuildType` annotation.

Test that uses the `IsTestSupported` function are no longer run, as the
size of lldb-dap binary is now more than `1mb`.

Update the broken test. 

Fixes #108621  

We could probably check if the test now passes on `linux arm` since it
was disabled because it timed out. I experienced the timeout after
replacing the `IsTestSupported` with `skipIfBuildType`.
2025-06-23 10:32:46 +01:00
Pavel Labath
e7c1da7c8e [lldb/cmake] Plugin layering enforcement mechanism (#144543)
Some inter-plugin dependencies are okay, others are not. Yet others not,
but we're sort of stuck with them. The idea is to be able to prevent
backsliding while making sure that acceptable dependencies are..
accepted. For context, see
https://github.com/llvm/llvm-project/pull/139170 and the attached
changes to the documentation.
2025-06-23 11:31:26 +02:00
Ross Brunton
613c38a992 [Offload] Fix type mismatch warning in test (#143700) 2025-06-23 10:14:12 +01:00
Matthias Springer
b9c979d369 [mlir][Transforms] Dialect conversion: Simplify replaceOp implementation (#145155)
Since #145030, `ConversionPatternRewriter::eraseBlock` no longer calls
`ConversionPatternRewriter::eraseOp`. This now happens in the rewriter
impl (during the cleanup phase). Therefore, a safety check in
`replaceOp` can now be simplified.
2025-06-23 11:06:14 +02:00
Matt Arsenault
092ef1da45 AMDGPU: Use reportFatalUsageError for unsupported disassembly error (#145264) 2025-06-23 17:52:27 +09:00
Pavel Labath
c5629f2b60 [lldb] Add Socket::CreatePair (#145015)
It creates a pair of connected sockets using the simplest mechanism for
the given platform (TCP on windows, socketpair(2) elsewhere).

Main motivation is to remove the ugly platform-specific code in
ProcessGDBRemote::LaunchAndConnectToDebugserver, but it can also be used
in other places where we need to create a pair of connected sockets.
2025-06-23 10:51:26 +02:00
Dipesh Sharma
bc6faf9a02 [X86] X86LegalizerInfo - use LegalFor instead if LegalIf for simple ISA/test pairs (#144675)
We have lots of `legalIf to` evaluate the legality of instructions based
on predicate's truthfulness, which should be simplified to use the
`legalFor({Types})` or `legalFor(Pred, {Types})` helpers:

closes #138259 

for eg: 

```
  getActionDefinitionsBuilder({G_ADD, G_SUB})
      .legalIf([=](const LegalityQuery &Query) -> bool {
        if (typeInSet(0, {s8, s16, s32})(Query))
          return true;
        if (Is64Bit && typeInSet(0, {s64})(Query))
          return true;
        if (HasSSE2 && typeInSet(0, {v16s8, v8s16, v4s32, v2s64})(Query))
          return true;
        if (HasAVX2 && typeInSet(0, {v32s8, v16s16, v8s32, v4s64})(Query))
          return true;
        if (HasAVX512 && typeInSet(0, {v16s32, v8s64})(Query))
          return true;
        if (HasBWI && typeInSet(0, {v64s8, v32s16})(Query))
          return true;
        return false;
      })
```
gets transformed to:

```
  getActionDefinitionsBuilder({G_ADD, G_SUB})
      .legalFor({s8, s16, s32})
      .legalFor(Is64Bit, {s64})
      .legalFor(HasSSE2, {v16s8, v8s16, v4s32, v2s64})
 --- etc ---
```

---------

Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-06-23 09:50:28 +01:00
Nikolas Klauser
be00098632 [libc++] Remove a bunch of now unnecessary indirections in __tree (#142397)
Most notably, this removes the notion of a distinct `value_type` and
`__container_value_type` from `__tree`, since these are now always the
same type. There are a few places we need to keep `__value_type` around,
since they are ABI visibile. In these cases `_Tp` is used directly. The
second simplification here is that we use `const value_type&` instead of
`const key_type&` in a few places and make use of the fact that the
comparator is capable of comparing any combination of `key_type` and
`value_type`.

This is a follow-up to #134819.
2025-06-23 10:47:47 +02:00
Nikolas Klauser
43260b01dd [libc++] Add test to ensure that the mangling of types stays the same (#143556) 2025-06-23 10:43:47 +02:00
Luke Hutton
98a6fed096 [mlir][tosa] Allow zero-points to be unranked (#143770)
This commit allows zero-points used by a number of tosa operations to be
unranked. This allows the shape inference pass to propagate shape
information.
2025-06-23 09:38:39 +01:00
Momchil Velikov
b31413a966 [MLIR][AArch64] Simplify LowerContractionToSVEI8MMPattern.cpp:getExtOperand (NFC) (#144909)
Just recently learned about `isSignlessInteger`, use that instead of
comparing to types obtained via `rewriter.getI<N>Type()`.
It also makes it closer to a similar function in 
`LowerContractionToNeonI8MMPattern.cpp` (formerly `LowerContractionToSMMLAPattern.cpp`)
which would help a potential effort to unify these patterns.
2025-06-23 09:38:01 +01:00
Momchil Velikov
4af96a9d83 [MLIR] Determine contiguousness of memrefs with dynamic dimensions (#142421)
This patch enhances `MemRefType::areTrailingDimsContiguous` to also
handle memrefs with dynamic dimensions.

The implementation itself is based on a new member function
`MemRefType::getMaxCollapsableTrailingDims` that return the maximum
number of trailing dimensions that can be collapsed - trivially all
dimensions for memrefs with identity layout, or by examining the memref
strides stopping at discontiguous or statically unknown strides.
2025-06-23 09:28:33 +01:00
Timm Baeder
1c78d8d9d7 [clang][bytecode] Fix shifts with an allocated RHS (#145280)
This was broken before because we ended up using a constructor that was
disabled via assert(false). Use ShiftAP() if either LHS or RHS is
allocated.
2025-06-23 10:14:33 +02:00
Andrei Golubev
529662a6b5 [mlir] Allow accessing DialectResourceBlobManager::blobMap (#142352)
Add a new API to access all blobs that are stored in the blob manager.
The main purpose (as of now) is to allow users of dialect resources to
iterate over all blobs, especially when the blobs are no longer used in
IR (e.g. the operation that uses the blob is deleted) and thus cannot be
easily accessed without manual tracking of keys.
2025-06-23 09:50:28 +02:00
Matt Arsenault
2dcf436340 AMDGPU: Remove legacy pass manager version of AMDGPUAttributor (#145262) 2025-06-23 16:49:46 +09:00
Matt Arsenault
48155f93dd CodeGen: Emit error if getRegisterByName fails (#145194)
This avoids using report_fatal_error and standardizes the error
message in a subset of the error conditions.
2025-06-23 16:33:35 +09:00
Matt Arsenault
6b129d6bbf AsmPrinter: Do not use report_fatal_error for unhandled ConstantExpr (#145275) 2025-06-23 16:29:58 +09:00
Matt Arsenault
db051e8800 AsmPrinter: Do not use report_fatal_error for unknown appending linkage (#145269) 2025-06-23 16:26:27 +09:00
Matt Arsenault
16607f6437 AMDGPU: Fix typo in argument allocation error message (#145265) 2025-06-23 16:26:10 +09:00
Matt Arsenault
338ee673bd AsmPrinter: Do not use report_fatal_error for AIX XXStructor error (#145273) 2025-06-23 16:25:53 +09:00
Kunqiu Chen
74aab3045d [TSan, NFC] Eliminate useless calculations in TSan (#145283)
Previously, TSan repeatedly calculated some values in some cases, and
this change eliminates these duplicate calculations.
2025-06-23 15:24:03 +08:00
Camsyn
20c04a646b [NFC][Sanitizer] Fix incorrect desc of [beg, end] to [beg, end)
Correct the interval desc of ReleaseMemoryPagesToOS from [beg, end] to
[beg, end), as it actually does.

The previous incorrect description of [beg, end] might cause an
incorrect invoke as follows: `ReleaseMemoryPagesToOS(0, kPageSize - 1);`
2025-06-23 15:21:34 +08:00
Jim Lin
4795b2b5a3 [RISCV] Fix comment typo and indentation for class SchedNary. NFC. 2025-06-23 15:17:25 +08:00
Luke Hutton
ddfc7cb61f [mlir][tosa] Check negative output size in resize shape inference (#143382)
This commit adds a check to ensure that the calculated output height and
width, during shape inference, should be non-negative. An error is
output if this is the case.

Fixes: #142402
2025-06-23 15:17:17 +08:00
Nikita Popov
86beba9301 [PredicateInfo] Cache ssa.copy declarations (NFC) (#145020)
This pass creates a lot of ssa.copy intrinsics, typically for a small
set of types. Determining the function type, performing intrinsic name
mangling and looking up the declaration has noticeable overhead in this
case.

Improve this by caching the declarations by type. I've made this a
separate map from CreatedDeclarations, which only tracks the
declarations that were newly inserted (but not pre-existing ones).
2025-06-23 09:16:45 +02:00
Nikita Popov
ae8c85c9ce [Passes] Remove LoopInterchange from O1 pipeline (#145071)
This is a fairly exotic pass, I don't think it makes a lot of sense to
run it at O1, esp. as vectorization wouldn't run at O1 anyway.
2025-06-23 09:11:03 +02:00
Nikita Popov
1e58e9c4b2 [PredicateInfo] Don't store Def in ValueDFS (NFC) (#145022)
Def is only actually used during renaming, and having it in ValueDFS
causes unnecessary confusion. Remove it from ValueDFS and instead use a
separate StackEntry structure for renaming, which holds the ValueDFS and
the Def.
2025-06-23 09:10:33 +02:00
Nikita Popov
c6be4ff0c8 [PredicateInfo] Don't use depth first walk (NFCI) (#145016)
The order in which we collect the predicates does not matter, as they
will be sorted anyway. As such, avoid the expensive depth first walk
over the dominator tree and instead use plain iteration over the
function.

(To be a bit more precise, the predicates and uses for a specific value
are sorted, so this change has no impact on that. It can change the
order in which values are processed in the first place, but that order
is not semantically relevant.)
2025-06-23 09:09:19 +02:00
Chuanqi Xu
fccc6ee702 [C++20] [Modules] Don't make enum constant members always visible
Close https://github.com/llvm/llvm-project/issues/131058

See the comments in
ASTWriter.cpp:ASTDeclContextNameLookupTrait::getLookupVisibility and
SemaLookup.cpp:Sema::makeMergedDefinitionVisible for details.
2025-06-23 14:39:08 +08:00
Matt Arsenault
4be4b82e74 AMDGPU: Use reportFatalUsageError for unhandled calling conventions (#145261)
Should switch this to DiagnosticInfo and use the default calling
convention, but that would require passing in the context.
2025-06-23 15:30:13 +09:00
Matt Arsenault
38920964ba ARM: Move ABI enum from TargetMachine to TargetParser (#144725)
Consolidate ABI parsing logic in TargetParser where
computeDefaultTargetABI is defined, instead of splitting it into the
backend. We need the full ABI information computable in
RuntimeLibcallsInfo
2025-06-23 15:22:59 +09:00
Artemiy Bulavin
26f3f24a4f [MLIR][NFC] Declare RuntimeVerifiableOpInterface for memref ops that have an implementation (#145230)
Previously running `-generate-runtime-verification` on an IR containing
`memref.reinterpret_cast` would crash because its implementation of the
`RuntimeVerifiableOpInterface` was removed in
https://github.com/llvm/llvm-project/pull/132547 but its associated
entry in `declarePromisedInterface` was never removed.

This causes an error when you try and run
`-generate-runtime-verification` on an IR containing
`memref.reinterpret_cast` that looks like

```
LLVM ERROR: checking for an interface (`mlir::RuntimeVerifiableOpInterface`) that was promised by dialect 'memref' but never implemented. This is generally an indication that the dialect extension implementing the interface was never registered.
```
as reported in https://github.com/llvm/llvm-project/issues/144028.

In this PR I also added all the ops that do have implementations of this
interface in
`mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp` to the
`declarePromisedInterface` for consistency.

Fixes https://github.com/llvm/llvm-project/issues/144028
2025-06-23 14:02:49 +08:00
Aaditya
6a0593b0a3 [AMDGPU] Extend wave reduce intrinsics for i32 type (#126469)
Currently, wave reduction intrinsics are supported for `umin` and `umax`
operations for `i32` type only.
This patch extends support for the following operations: 
`add`, `sub`, `min`, `max`, `and`, `or`, `xor` for `i32` type.

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-06-23 10:31:22 +05:30
Adam Straw
da0c21bd4b [mlir][gpu] Fix bug with GPU hardware intrinsic global location (#144923)
Bug description: Hardware intrinsic functions created during GPU
conversion to NVVM may contain debug info metadata from the original
function which cannot be used out of that function.
2025-06-22 22:09:44 -06:00
Matt Arsenault
ed155ff9f2 AMDGPU: Avoid report_fatal_error on ds ordered intrinsics (#145202) 2025-06-23 13:09:09 +09:00
Fabian Mora
c7165587e4 [mlir][affine|ValueBounds] Add transform to simplify affine min max ops with ValueBoundsOpInterface (#145068)
This commit makes the following changes:

- Expose `map` and `mapOperands` in
`ValueBoundsConstraintSet::Variable`, so that the class can be used by
subclasses of `ValueBoundsConstraintSet`. Otherwise subclasses cannot
access those members.

- Add `ValueBoundsConstraintSet::strongCompare`. This method is similar
to `ValueBoundsConstraintSet::compare` except that it returns false when
the inverse comparison holds, and `llvm::failure()` if neither the
relation nor its inverse relation could be proven.

- Add `simplifyAffineMinOp`, `simplifyAffineMaxOp`, and
`simplifyAffineMinMaxOps` to simplify those operations using
`ValueBoundsConstraintSet`.

- Adds the `SimplifyMinMaxAffineOpsOp` transform op that uses
`simplifyAffineMinMaxOps`.

- Add the `test.value_with_bounds` op to test unknown values with a min
max range using `ValueBoundsOpInterface`.

- Adds tests verifying the transform.

Example:

```mlir
func.func @overlapping_constraints() -> (index, index) {
  %0 = test.value_with_bounds {min = 0 : index, max = 192 : index}
  %1 = test.value_with_bounds {min = 128 : index, max = 384 : index}
  %2 = test.value_with_bounds {min = 256 : index, max = 512 : index}
  %r0 = affine.min affine_map<()[s0, s1, s2] -> (s0, s1, s2)>()[%0, %1, %2]
  %r1 = affine.max affine_map<()[s0, s1, s2] -> (s0, s1, s2)>()[%0, %1, %2]
  return %r0, %r1 : index, index
}
// Result of applying `simplifyAffineMinMaxOps` to `func.func`
#map1 = affine_map<()[s0, s1] -> (s1, s0)>
func.func @overlapping_constraints() -> (index, index) {
  %0 = test.value_with_bounds {max = 192 : index, min = 0 : index}
  %1 = test.value_with_bounds {max = 384 : index, min = 128 : index}
  %2 = test.value_with_bounds {max = 512 : index, min = 256 : index}
  %3 = affine.min #map1()[%0, %1]
  %4 = affine.max #map1()[%1, %2]
  return %3, %4 : index, index
}
```

---------

Co-authored-by: Nicolas Vasilache <Nico.Vasilache@amd.com>
2025-06-23 06:05:20 +02:00