Commit Graph

543569 Commits

Author SHA1 Message Date
Kazu Hirata
e99da2b7a9 [mlir] Remove unused includes (NFC) (#146467) 2025-07-01 07:32:44 -07:00
Kazu Hirata
f4cdb89b47 [mlir] Remove unnecessary casts (NFC) (#146465)
Note that encodeStringLiteralInto returns void.
2025-07-01 07:32:36 -07:00
Kazu Hirata
7622bf9d12 [IR] Remove an unnecessary cast (NFC) (#146464)
The destructor does not return anything.
2025-07-01 07:32:29 -07:00
Kazu Hirata
bb080107e4 [CodeGen] Remove unnecessary casts (NFC) (#146463)
Both of these functions return void.
2025-07-01 07:32:21 -07:00
cmtice
11ecd4742b [LLDB] Update DIL to pass current 'frame var' tests. (#145055)
As a preliminary to making DIL the default implementation for
 'frame var', ran check-lldb forcing 'frame var' to always use DIL, 
and discovered a few failing tests. This fixes most of them. The only
remaining failing test is TestDAP_evaluate.py, which now passes
a test case that the test says should fail (still investigating this).

Changes in this PR:
- Sets correct VariableSP, as well as returning ValueObjectSP (needed
for several watchpoint tests).
- Updates error messages, when looking up members, to match what the
rest of LLDB expects. Also update appropriate DIL tests to expect the
updated error messages.
- Updates DIL parser to look for and accept "(anonymous namespace)::" at
the front of a variable name.
2025-07-01 07:30:47 -07:00
Ege Beysel
ace5108f37 feat(linalg): add a way to pass controlFn to foldIntoPackUnpackPatterns (#143685)
This PR adds a mechanism, so that downstream consumers can pass in
control functions for the application of these patterns. This change
shouldn't affect any consumers of this method that do not specify a
controlFn. The controlFn always gets the source operand of the consumer
in each of the patterns as a parameter.

In IREE, we (will) use it to control preventing folding patterns that
would inhibit fusion. See IREE issue
[#20896](https://github.com/iree-org/iree/issues/20896) for more
details.
2025-07-01 07:22:38 -07:00
Frederik Harwath
f9413e1754 [clang][test] Remove duplication from gcc toolchain test (NFC) (#146487)
Changes from Commit 40aab0412f "[test]
Migrate -gcc-toolchain with space separator to --gcc-toolchain=" made
two previously different RUN lines equal.

Remove one RUN line.
2025-07-01 16:17:26 +02:00
David Green
42e7796920 [ARM] Add a comment about fixupImmediateBr updaing ImmBranches. NFC
To prevent people from modernizing the loop, add a comment that
fixupImmediateBr can append to ImmBranches.
2025-07-01 15:01:25 +01:00
Shilei Tian
bab9d4c2d7 [NFC][AMDGPU] Pre-commit a test case that shows wrong reverse operation is used for V_CMPX_LE_U32 (#146527) 2025-07-01 09:57:04 -04:00
Nikita Popov
a6592ddf4e [AArch64] Mark neon.stN intrinsics as writeonly (#145289)
I found this peculiar comment in EarlyCSE:

1c78d8d9d7/llvm/lib/Transforms/Scalar/EarlyCSE.cpp (L1620-L1624)

Looking back over history, this seems to be referring to the
aarch64.neon.stN intrinsics, which are indeed not marked writeonly
(though the ldN intrinsics are readonly).

Possibly I'm missing something special about these intrinsics, but I
think it is safe to mark them as writeonly.
2025-07-01 15:56:02 +02:00
Timm Baeder
1fe993c251 [clang][bytecode] Allocate operator new data as array (#146471)
Even if we only allocate one element, we still need to allocate it as a
single-element array. This matches what the current interpreter does.
2025-07-01 15:45:50 +02:00
Zhuoran Yin
8cfd9b8821 [MLIR] Make generic skip packing init operand when not used in DataLayoutPropagation (#146139)
In both `bubbleUpPackOpThroughGenericOp()` or
`pushDownUnPackOpThroughGenericOp()`, we can simplify the lowered IR by
removing the pack of an empty when the init tensor isn't used in generic
op. Instead of packing an empty tensor, the empty tensor can be
forwarded to the generic output. This allows cleaner result after data
layout propagation.
2025-07-01 09:39:30 -04:00
Nicolas Vasilache
08cf6ae537 [mlir][memref] Add a new ReifyResultShapes pass (#145927)
This pass reifies the shapes of a subset of
`ReifyRankedShapedTypeOpInterface` ops with `tensor` results.

The pass currently only supports result shape type reification for:
   - tensor::PadOp
   - tensor::ConcatOp

It addresses a representation gap where implicit op semantics are needed
to infer static result types from dynamic
operands. But it does so by using `ReifyRankedShapedTypeOpInterface` as
the source of truth rather than the op itself.
As a consequence, this cannot generalize today.

TODO: in the future, we should consider coupling this information with
op "transfer functions" (e.g.
`IndexingMapOpInterface`) to provide a source of truth that can work
across result shape inference, canonicalization and
op verifiers.

The pass replaces the operations with their reified versions, when more
static information can be derived, and inserts
casts when results shapes are updated.

Example:
```mlir
  #map = affine_map<(d0) -> (-d0 + 256)>
  func.func @func(%arg0: f32, %arg1: index, %arg2: tensor<64x?x64xf32>) -> tensor<1x?x64xf32> {
    %0 = affine.apply #map(%arg1)
    %extracted_slice = tensor.extract_slice %arg2[0, 0, 0] [1, %arg1, 64] [1, 1, 1] : tensor<64x?x64xf32> to tensor<1x?x64xf32>
    %padded = tensor.pad %extracted_slice low[0, 0, 0] high[0, %0, 0] {
    ^bb0(%arg3: index, %arg4: index, %arg5: index):
      tensor.yield %arg0 : f32
    } : tensor<1x?x64xf32> to tensor<1x?x64xf32>
    return %padded : tensor<1x?x64xf32>
  }

  // mlir-opt --reify-result-shapes
  #map = affine_map<()[s0] -> (-s0 + 256)>
  func.func @func(%arg0: f32, %arg1: index, %arg2: tensor<64x?x64xf32>) -> tensor<1x?x64xf32> {
    %0 = affine.apply #map()[%arg1]
    %extracted_slice = tensor.extract_slice %arg2[0, 0, 0] [1, %arg1, 64] [1, 1, 1] : tensor<64x?x64xf32> to tensor<1x?x64xf32>
    %padded = tensor.pad %extracted_slice low[0, 0, 0] high[0, %0, 0] {
    ^bb0(%arg3: index, %arg4: index, %arg5: index):
      tensor.yield %arg0 : f32
    } : tensor<1x?x64xf32> to tensor<1x256x64xf32>
    %cast = tensor.cast %padded : tensor<1x256x64xf32> to tensor<1x?x64xf32>
    return %cast : tensor<1x?x64xf32>
  }
  ```

---------

Co-authored-by: Fabian Mora <fabian.mora-cordero@amd.com>
2025-07-01 15:39:21 +02:00
Shilei Tian
3355cca938 [NFC][AMDGPU] Auto generate check lines for some test cases (#146400) 2025-07-01 09:25:08 -04:00
Nikita Popov
bedd7ddb7f [InstCombine] Fix use after free
Load the nowrap flags before calling EmitGEPOffset(), as this may
free the instruction.
2025-07-01 15:18:49 +02:00
Callum Fare
1a253e213d [NFC][Offload] Fix possible edge cases in offload-tblgen (#146511)
Fix a couple of unhandled edge cases in offload-tblgen that were found
by static analysis
* `LineStart` may wrap around to 0 when processing multi-line strings.
The value is not actually being used in that case, but still better to
explicitly handle it
* Possible unchecked nullptr when processing parameter flags
2025-07-01 14:09:49 +01:00
Hemang Gadhavi
da0828b1e9 [lldb] Enable support for DWARF64 format handling (#145645)
This PR introduces support for the DWARF64 format, enabling handling of
64-bit DWARF sections as defined by the DWARF specification. The update
includes adjustments to header parsing and modification of form values
to accommodate 64-bit offsets and values.
Also Added the testcase to verify the DWARF64 format.
2025-07-01 18:35:40 +05:30
Erich Keane
857815f3fa [OpenACC][CIR] Implement 'rest' of update clause lowering (#146414)
This implements the async, wait, if, and if_present (as well as
    device_type, but that is a detail of async/wait) lowering. All of
these are implemented the same way they are for the compute constructs,
      so this is a pretty mild amount of changes.
2025-07-01 06:05:08 -07:00
Shivam Gupta
e44fbea0a1 [FunctionAttrs] Handle ConstantRange overflow in memset initializes inference (#145739)
Avoid constructing invalid ConstantRange when Offset + Length in memset
overflows signed 64-bit integer space. This prevents assertion failures
when inferring the initializes attribute.

Fixes #140345
2025-07-01 18:34:52 +05:30
Denzel-Brian Budii
3702d64801 [mlir] Reapply 141423 mlir-query combinators plus fix (#146156)
An uninitialized variable that caused a crash
(https://lab.llvm.org/buildbot/#/builders/164/builds/11004) was
identified using the memory analyzer, leading to the reversion of
https://github.com/llvm/llvm-project/pull/141423. This pull request
reapplies the previously reverted changes and includes the fix, which
has been tested locally following the steps at
https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild.

Note: the fix is included as part of the second commit
2025-07-01 15:03:17 +02:00
Benjamin Kramer
771ee8e387 [bazel] Add mising dependency for 698ec8c7ba 2025-07-01 15:02:41 +02:00
Simon Pilgrim
72f87d2d69 [DAG] canCreateUndefOrPoison - remove isGuaranteedNotToBeUndefOrPoison check for insert/extract vector element indices (#146514)
No longer necessary now that #146490 has landed
2025-07-01 14:01:54 +01:00
Rob Buis
524f090306 [alpha.webkit.UncountedCallArgsChecker] Treat CFEqual as a safe function (#146369)
CFEqual is a trivial function, so treat it as safe.
2025-07-01 13:57:53 +01:00
Timm Baeder
6731f151ea [clang][bytecode] Remove unused InRange function (#146509) 2025-07-01 14:42:00 +02:00
Mythreya
d9d9ab8698 [clang][CodeComplete] skip explicit obj param in code completion string (#146258)
Fixes clangd/clangd#2339
2025-07-01 08:33:56 -04:00
Nikita Popov
b8b7494551 [InstCombine] Rewrite multi-use GEPs when simplifying comparison (#146100)
We already do this when both sides are a GEP, but not if only one is.
This ensures that the offset arithmetic is not duplicated.
2025-07-01 14:26:47 +02:00
David Sherwood
9b13dfdfbc [LV] Use vscale for tuning to improve branch weight estimates (#144733)
In addBranchWeightToMiddleTerminator we attempt to add branch weights to
the middle block terminator. We pessimistically assume vscale=1, whereas
we can improve the estimate by using the value of vscale used for
tuning.
2025-07-01 13:23:38 +01:00
Sudharsan Veeravalli
15ab4bb5c8 [Hexagon] Implement shouldConvertConstantLoadToIntImm (#146452)
This will convert loads of constant strings to immediate values. Put
this behind a flag that is enabled by default so that we can toggle it
if need be.
2025-07-01 17:52:09 +05:30
Sudharsan Veeravalli
67b79468fb [RISCV] Factor out getKillRegState in copyPhysReg (NFC) (#146454)
This is used multiple times in the function.
2025-07-01 17:51:46 +05:30
Simon Pilgrim
89fe429262 [DAG] canCreateUndefOrPoison - remove isGuaranteedNotToBeUndefOrPoison check for shift nodes (#146502)
No longer necessary now that #146490 has landed - we still have the test coverage from #94145 that covers this.
2025-07-01 12:44:59 +01:00
Simon Pilgrim
56841565db [DAG] canCreateUndefOrPoison - add handling for CTTZ/CTLZ_ZERO_UNDEF nodes (#146501)
CTTZ/CTLZ_ZERO_UNDEF nodes can only create poison if the source value is zero - so check with isKnownNeverZero

Pulled out of #146361 and reapplied now that #146490 has landed.
2025-07-01 12:44:45 +01:00
Luke Lau
4a2fa0847f [VPlan] Support VPWidenIntOrFpInductionRecipes with EVL tail folding (#144666)
Following on from #118638, this handles widened induction variables with
EVL tail folding by setting the VF operand to be EVL, calculated in the
vector body.

We need to do this for correctness since with EVL tail folding the
number of elements processed in the penultimate iteration may not be VF,
but the runtime EVL, and we need take this into account when updating
the backedge value.

- Because the VF may now not be a live-in we need to move the insertion
point to just after the VFs definition
- We also need to avoid truncating it when it's the same size as the
step type, previously this wasn't a problem for live-ins.
- Also because the VF may be smaller than the IV type, since the EVL is
always i32, we may need to zext it.

On -march=rva23u64 -O3 we get 87.1% more loops vectorized on TSVC, and
42.8% more loops vectorized on SPEC CPU 2017
2025-07-01 12:29:24 +01:00
kd0608
a6339d0e58 [clang]Fix Handle structs exceeding 1EB size limit (#146032)
When declaring multiple arrays of 1 ExaByte in a struct, the offset can
exceed 2EB, causing incorrect struct size reporting (only 1EB). This fix
ensures an error is thrown, preventing the generation of incorrect
assembly. #60272
2025-07-01 16:48:41 +05:30
Yanzuo Liu
90e20d4f42 [Clang][Bytecode] Implement P1061 structured binding pack (#146474)
Other part of this feature was implemented by #121417.
2025-07-01 19:15:12 +08:00
Simon Pilgrim
fd46e409a9 [X86] detectZextAbsDiff - use m_SpecificVectorElementVT matcher. NFC. (#146498) 2025-07-01 11:59:37 +01:00
Henrich Lauko
37d30d9e21 [mlir][tblgen] Fix test definition names to reflect expected valid results (NFC) (#146243) 2025-07-01 12:37:06 +02:00
Kerry McLaughlin
6d6b36439f [Clang][AArch64] Move definitions of FP8 Neon loads & stores (#146352)
Moves the definitions of FP8 loads & stores so that they are guarded
by `ArchGuard = "defined(__aarch64__) || defined(__arm64ec__)"`
2025-07-01 11:33:15 +01:00
Hsiangkai Wang
f581ef5b66 [mlir][gpu] Add gpu.rotate operation (#142796)
Add gpu.rotate operation and a pattern to convert gpu.rotate to SPIR-V
OpGroupNonUniformRotateKHR.
2025-07-01 11:32:25 +01:00
Simon Pilgrim
a97826a13b [DAG] canCreateUndefOrPoison - explicitly state the AssertSext/Zext/Align/NoFPClass can create poison. NFC. (#146493)
This keeps getting forgotten (e.g. #66603) - so make a point of adding
it here to make it clear instead of relying on the implicit default of
returning true.
2025-07-01 11:31:47 +01:00
Henrich Lauko
43d2486e27 [mlir][tblgen] Fix region and successor references in custom directives (#146242)
Previously, references to regions and successors were incorrectly disallowed outside the top-level assembly form. This change enables the use of bound regions and successors as variables in custom directives.
2025-07-01 12:30:57 +02:00
Simon Pilgrim
4e30f8101e [DAG] visitFREEZE - remove isGuaranteedNotToBeUndefOrPoison assertion (#146490)
Although nice to have to prove the freeze can be moved, this can fail
immediately after freeze(op(...)) -> op(freeze(),freeze(),...) creation
if any of the new freeze nodes now prevents value tracking from seeing
through to the source values (e.g. shift amounts/element indices are in
bounds etc.).

This will allow us to remove the isGuaranteedNotToBeUndefOrPoison checks
inside canCreateUndefOrPoison that were discussed on #146361
2025-07-01 11:17:41 +01:00
Haojian Wu
2ee884a9db [clang-doc] Remove the unused clangd header.
This header seems to be included unintentionally.
2025-07-01 12:07:35 +02:00
Nikita Popov
8fe25f3071 [PowerPC] Remove chenzheng1030 from active maintainers (#145519)
chenzheng1030 has left IBM and no longer works on the PowerPC
backend. Move them from active to former maintainers.
2025-07-01 12:04:49 +02:00
David Spickett
cd60247a0f [llvm][docs] Document how to ask for things other than commit access (#146340)
This is the implicit process but useful to spell it out I think. To give
folks more confidence in asking.

Inspired by
https://discourse.llvm.org/t/request-github-issue-triage-permission-for-labeling-clang-issues/87126/1
2025-07-01 10:59:59 +01:00
Haojian Wu
5c08aeac85 [clang] Don't use raw source location in DeclarationName, NFC (#146412)
Converting back and forth for the source location raw encoding is
unnecessary.
2025-07-01 11:51:04 +02:00
Luke Hutton
698ec8c7ba [mlir][tosa] Require signless types in validation and add corresponding conversion pass (#144367)
Firstly, this commit requires that all types are signless in the strict
mode of the validation pass. This is because signless types on
operations are required by the TOSA specification. The "strict" mode in
the validation pass is the final check for TOSA conformance to the
specification, which can often be used for conversion to other formats.

In addition, a conversion pass `--tosa-convert-integer-type-to-signless`
is provided to allow a user to convert all integer types to signless.
The intention is that this pass can be run before the validation pass.
Following use of this pass, input/output information should be carried
independently by the user.
2025-07-01 10:29:53 +01:00
Sander de Smalen
cd10ded697 [Clang] Remove AArch64TargetInfo::setArchFeatures (#146107)
When compiling with `-march=armv9-a+nosve` we found that Clang still
defines the `__ARM_FEATURE_SVE2` macro, which is explicitly set in
`setArchFeatures` when compiling for armv9-a.

After some experimenting, I found out that the list of features passed
into `AArch64TargetInfo::handleTargetFeatures` has already been expanded
and takes into account `+no[feature]` and has already expanded features
like `armv9-a`.

From that I conclude that `setArchFeatures` is no longer required.
2025-07-01 10:20:40 +01:00
Jim Lin
a6bb895efe [RISCV] Fix typo in header of llvm/test/CodeGen/RISCV/rvv/select-fp.ll. NFC.
I believe that the second and third llc tests in the header tend to use
zvfhmin extension rather than zvfh; otherwise, they would be duplicates.
2025-07-01 17:09:37 +08:00
Ricardo Jesus
84c849e85b [InstCombine] Combine interleaved recurrences. (#143878)
Combine sequences such as:
```llvm
  %pn1 = phi [init1, %BB1], [%op1, %BB2]
  %pn2 = phi [init2, %BB1], [%op2, %BB2]
  %op1 = binop %pn1, constant1
  %op2 = binop %pn2, constant2
  %rdx = binop %op1, %op2
```
Into:
```llvm
  %phi_combined = phi [init_combined, %BB1], [%op_combined, %BB2]
  %rdx_combined = binop %phi_combined, constant_combined
```

This allows us to simplify interleaved reductions, for example as
introduced by the loop vectorizer.

The anecdotal example for this is the loop below:
```c
float foo() {
  float q = 1.f;
  for (int i = 0; i < 1000; ++i)
    q *= .99f;
  return q;
}
```
Which currently gets lowered explicitly such as (on AArch64,
interleaved by four):
```gas
.LBB0_1:
  fmul    v0.4s, v0.4s, v1.4s
  fmul    v2.4s, v2.4s, v1.4s
  fmul    v3.4s, v3.4s, v1.4s
  fmul    v4.4s, v4.4s, v1.4s
  subs    w8, w8, #32
  b.ne    .LBB0_1
```
But with this patch lowers trivially:
```gas
foo:
  mov     w8, #5028
  movk    w8, #14389, lsl #16
  fmov    s0, w8
  ret
```
2025-07-01 09:54:38 +01:00
Nikita Popov
102c22cb2c [FatLTO] Disable analysis verification in pipeline test (NFC)
To fix test failure with expensive checks reports at:
https://github.com/llvm/llvm-project/pull/146048#issuecomment-3022421122
2025-07-01 10:47:23 +02:00