Commit Graph

500087 Commits

Author SHA1 Message Date
zjgarvey
42a0fb2333 [mlir][linalg] Add linalg.conv_2d_ngchw_gfchw_q to named ops (#92136)
Adds a named op: linalg.conv_2d_ngchw_gfchw_q. This op is similar to
linalg.conv_2d_ngchw_gfchw, but additionally incorporates zero point
offset corrections.
2024-05-29 12:55:05 +02:00
Vyacheslav Levytskyy
7c917e8268 [SPIR-V] Implement correct zeroinitializer for extension types in SPIR-V Backend (#93607)
This PR implements correct zeroinitializer for extension types in SPIR-V
Backend.

Previous version has just created 0 of 32/64 integer type (depending on
target machine word size), that caused re-use and type re-write of the
corresponding integer constant 0 with a potential crash on wrong usage
of the constant (i.e., 0 of integer type expected but extension type
found). E.g., the following code would crash without the PR:

```
  %r1 = icmp ne i64 %_arg_i, 0
  %e1 = tail call spir_func target("spirv.Event") @__spirv_GroupAsyncCopy(i32 2, ptr addrspace(3) %_arg_local, ptr addrspace(1) %_arg_ptr, i64 1, i64 1, target("spirv.Event") zeroinitializer)
```

because 0 in icmp would eventually be of `Event` type.
2024-05-29 12:53:37 +02:00
Vyacheslav Levytskyy
f63adf3b51 [SPIR-V] Introduce support of llvm.ptr.annotation to SPIR-V Backend and implement extensions which make use of spirv.Decorations (#93561)
This PR introduces support of llvm.ptr.annotation to SPIR-V Backend, and
implement several extensions which make use of spirv.Decorations and
llvm.ptr.annotation to annotate global variables and pointers:

- SPV_INTEL_cache_controls
- SPV_INTEL_global_variable_host_access
- SPV_INTEL_global_variable_fpga_decorations
2024-05-29 12:53:08 +02:00
Vyacheslav Levytskyy
7fa45afa93 [SPIR-V] Ensure that internal intrinsic functions are inserted at the correct positions (#93552)
The goal of the PR is to ensure that newly inserted internal intrinsic
functions are inserted at the correct positions, and don't break rules
of instruction domination and PHI nodes grouping at top of basic block.
This is a continuation of
https://github.com/llvm/llvm-project/pull/92316 and
https://github.com/llvm/llvm-project/pull/92536
2024-05-29 12:52:55 +02:00
Lukacma
1e44a96909 [AArch64][SME] Add intrinsics for vector groups ZERO (#93201)
According to the specification in
https://github.com/ARM-software/acle/pull/309 this adds the intrinsics:

  void svzero_za64_vg1x2(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg1x4(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg2x1(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg2x2(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg2x4(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg4x1(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg4x2(uint32_t slice)
    __arm_streaming __arm_inout("za");

  void svzero_za64_vg4x4(uint32_t slice)
    __arm_streaming __arm_inout("za");
2024-05-29 11:35:21 +01:00
Lukacma
e93799f260 [SME] Add intrinsics for FCVT(wid.) and FCVTL (#93202)
According to the specification in
https://github.com/ARM-software/acle/pull/309 this adds the intrinsics
```
svfloat32x2_t svcvt_f32[_f16_x2](svfloat16_t zn) __arm_streaming;
svfloat32x2_t svcvtl_f32[_f16_x2](svfloat16_t zn) __arm_streaming;

```
These are available only if __ARM_FEATURE_SME_F16F16 is enabled.

---------

Co-authored-by: Caroline Concatto <caroline.concatto@arm.com>
2024-05-29 11:34:24 +01:00
David Spickett
23a09b9931 [lldb][Test] Remove some xfails for AArch64 Linux
PR #92245 fixed these tests on Linux. They likely work on FreeBSD too
but leaving the xfail for that so it can be confirmed later.

Also updated a bugzilla link to one that redirects to Github issues.

Relates to issues #43398 and #48751.
2024-05-29 10:28:10 +00:00
Yingwei Zheng
9e8ecce88e [DAGCombine] Transform shl X, cttz(Y) to mul (Y & -Y), X if cttz is unsupported (#85066)
This patch fold `shl X, cttz(Y)` to `mul (Y & -Y), X` if cttz is
unsupported by the target.
Alive2: https://alive2.llvm.org/ce/z/AtLN5Y
Fixes https://github.com/llvm/llvm-project/issues/84763.
2024-05-29 18:26:54 +08:00
Matt Arsenault
aef0bdd36d DAG: Preserve flags when expanding fminimum/fmaximum (#93550)
The operation selection logic here doesn't really work when vector types
need to be split. This was also dropping the flags, and losing nnan made
the combine from select back to fmin/fmax unrecoverable. Preserve the
flags to assist a future commit.
2024-05-29 12:26:27 +02:00
Tuan Chuong Goh
6543453c36 [AArch64][NFC] Pre-commit test update for Select TBL/TBX instructions (#92914) 2024-05-29 10:12:24 +00:00
AtariDreams
718ba5a584 Reapply [InstCombine] lshr (mul (X, 2^N + 1)), N -> add (X, lshr(X, N)) (#92907)
Alive2 Proofs:
https://alive2.llvm.org/ce/z/eSinJY
https://alive2.llvm.org/ce/z/vyKvde
https://alive2.llvm.org/ce/z/dRFsfV

I mistakenly reverted this commit as part of a larger set of
reverts. Reapplied without changes.
2024-05-29 12:11:35 +02:00
Yingwei Zheng
3bcccb6af6 [Reassociate] Drop weight reduction to fix issue 91417 (#91469)
See the following case: https://alive2.llvm.org/ce/z/A-fBki
```
define i3 @src(i3 %0) {
  %2 = mul i3 %0, %0
  %3 = mul i3 %2, %0
  %4 = mul i3 %3, %0
  %5 = mul nsw i3 %4, %0
  ret i3 %5
}

define i3 @tgt(i3 %0) {
  %2 = mul i3 %0, %0
  %5 = mul nsw i3 %2, %0
  ret i3 %5
}
```


d7aeefebd6
introduced weight reduction during weights combination of the same
operand. As the weight of `%0` changes from 5 to 3, the nsw flag in `%5`
should be dropped.

However, the nsw flag isn't cleared by `RewriteExprTree` since `%5 = mul
nsw i3 %0, %4` is not included in the range of `[ExpressionChangedStart,
ExpressionChangedEnd)`.
```
Calculated Rank[] = 3
Combine negations for:   %2 = mul i3 %0, %0
Calculated Rank[] = 4
Combine negations for:   %3 = mul i3 %0, %2
Calculated Rank[] = 5
Combine negations for:   %4 = mul i3 %0, %3
Calculated Rank[] = 6
Combine negations for:   %5 = mul nsw i3 %0, %4
LINEARIZE:   %5 = mul nsw i3 %0, %4
OPERAND: i3 %0 (1)
ADD USES LEAF: i3 %0 (1)
OPERAND:   %4 = mul i3 %0, %3 (1)
DIRECT ADD:   %4 = mul i3 %0, %3 (1)
OPERAND: i3 %0 (1)
OPERAND:   %3 = mul i3 %0, %2 (1)
DIRECT ADD:   %3 = mul i3 %0, %2 (1)
OPERAND: i3 %0 (1)
OPERAND:   %2 = mul i3 %0, %0 (1)
DIRECT ADD:   %2 = mul i3 %0, %0 (1)
OPERAND: i3 %0 (1)
OPERAND: i3 %0 (1)
RAIn:   mul i3  [ %0, #3] [ %0, #3] [ %0, #3] 
RAOut:  mul i3  [ %0, #3] [ %0, #3] [ %0, #3] 
RAOut after CSE reorder:        mul i3  [ %0, #3] [ %0, #3] [ %0, #3] 
RA:   %5 = mul nsw i3 %0, %4
TO:   %5 = mul nsw i3 %4, %0
RA:   %4 = mul i3 %0, %3
TO:   %4 = mul i3 %0, %0
```

The best way to fix this is to inform `RewriteExprTree` to clear flags
of the whole expr tree when weight reduction happens.

But I find that weight reduction based on Carmichael number never
happens in practice.
See the coverage result
https://dtcxzyw.github.io/llvm-opt-benchmark/coverage/home/dtcxzyw/llvm-project/llvm/lib/Transforms/Scalar/Reassociate.cpp.html#L323

I think it would be better to drop `IncorporateWeight`.

Fixes #91417
2024-05-29 18:09:23 +08:00
David Spickett
971f1aaad3 [lldb][Test][Windows] Fix flaky address range API tests
The new tests added in #92014 have been flaky on Linaro's
Windows on Arm bot. They appear to be hitting a deadlock trying
to clean up the test process.

This only happens in async mode and I don't see why this test
case needs async mode, so the simple workaround is to stick to
sync mode.
2024-05-29 10:07:47 +00:00
Andreas Jonson
5c214eb0c6 [Inline] Clone return range attribute on the callsite into inlined call (#92666) 2024-05-29 12:05:05 +02:00
Kareem Ergawy
e1aa8ad6fa [flang][OpenMP] Fix bug in emitting dealloc logic (#93641)
Fixes a bug in emiting deacllocation logic when delayed privatization is
disabled. I introduced the bug when implementing delayed privatization
for allocatables: when delayed privatization is disabled the
deacllocation ops are emitted for only one allocatable variables.
2024-05-29 11:58:59 +02:00
Lukacma
78cc9cbba2 [AArch64][SME] Add intrinsics for multi-vector BFCLAMP (#93532)
According to the specification in
https://github.com/ARM-software/acle/pull/309 this adds the intrinsics

```
  svbfloat16x2_t svclamp[_single_bf16_x2](svbfloat16x2_t zd, svbfloat16_t zn,
                                        svbfloat16_t zm)  __arm_streaming;

  svbfloat16x4_t svclamp[_single_bf16_x4](svbfloat16x4_t zd, svbfloat16_t zn,
                                        svbfloat16_t zm)  __arm_streaming;
```
These are available only  if __ARM_FEATURE_SME_B16B16 is enabled.
2024-05-29 10:44:58 +01:00
Lu Weining
5553f27d5a [AMDGPU][test] Fix the wrong triples in lower-work-group-id-intrinsics-{hsa,pal}.ll. NFC (#93501)
- hsa -> amdhsa
- Use amdgcn-amd-amd{hsa,pal} for lower-work-group-id-intrinsics-{hsa,pal}.ll respectively
2024-05-29 17:42:41 +08:00
Simon Camphausen
1594cebedd [mlir][EmitC] Fix evaluation order of expressions (#93549)
Expressions with the same precedence were not parenthesized and
therefore were possibly evaluated in the wrong order depending on the
shape of the expression tree.

---------

Co-authored-by: Matthias Gehre <matthias.gehre@amd.com>
Co-authored-by: Corentin Ferry <corentin.ferry@amd.com>
2024-05-29 11:42:06 +02:00
Pankaj Dwivedi
dc8da7ddea [AMDGPU] Reserved private memory register during PEI (#93536)
- Reserved newly selected private memory registers in entry Function
Prologue generation.
- Added assertion patch in eliminateFrameIndex to ensure register is
reserved.

Co-authored-by: PankajDwivedi-25 <pankajkumar.divedi@amd.com>
2024-05-29 15:10:44 +05:30
Lu Weining
74014b5a34 Fix typo in AMDGPUUsage. NFC (#93652)
The vendor name is mesa but not mesa3d.
2024-05-29 17:39:38 +08:00
Simon Pilgrim
f42de69213 [X86] vector-shuffle-512-v16.ll - add fast shuffle test coverage 2024-05-29 10:38:03 +01:00
Simon Pilgrim
9c42ed1371 [X86] Add x86-atomic-double.c double test coverage 2024-05-29 10:38:03 +01:00
Simon Pilgrim
4bb6974a87 [X86] x86-atomic-long_double.c - cleanup check prefixes 2024-05-29 10:38:03 +01:00
Simon Pilgrim
f3fb7f5699 [X86] x86-atomic-float.c - cleanup unused check prefixes 2024-05-29 10:38:02 +01:00
Shengchen Kan
0f7b4b04a5 [X86][Driver] Enable feature ccmp,nf for -mapxf
This is follow-up for #78901 after validation.
2024-05-29 17:34:26 +08:00
Tulio Magno Quites Machado Filho
a72a90677d [Nomination] Add an extra Red Hat representative to the security group (#92174)
I'd like to nominate myself as another Red Hat representative. I work at
the LLVM team at Red Hat contributing to upstream and downstream.
2024-05-29 11:19:17 +02:00
Sander de Smalen
f6ace2bc15 [AArch64] Expand vector ops when NEON and SVE are unavailable. (#90833)
Unlike `+noneon` we must assume that vector types are available, i.e.
it is valid to pass/return vector arguments to and from functions.
However, the compiler must make sure to scalarize any vector
operations.
2024-05-29 09:51:05 +01:00
Daniel Grumberg
fa649df8e5 [clang][ExtractAPI] Flatten all enum cases from anonymous enums at top level (#93559)
rdar://128863241
2024-05-29 09:47:23 +01:00
David Green
93d8d74ae6 [VectorCombine] Remove requirement for Instructions in shuffleToIdentity (#93543)
This removes the check that both operands of the original shuffle are
instructions, which is a relic from a previous version that held more
variables as Instructions.
2024-05-29 09:36:53 +01:00
AnastasiyaChernikova
4ad2f415f6 [Exegesis] Changing non-standard CHECK in tests to more compliant way (#93222)
Fixed some FileChecks in tests. Firstly found in PR89047
(https://github.com/llvm/llvm-project/pull/89047#discussion_r1608909489)
2024-05-29 11:28:00 +03:00
Alastair Houghton
6957c00a8c [RuntimeDyld][ELF][AArch64] Fix resolveAArch64ShortBranch. (#92245)
We don't know the load addresses when this function is called, so it
shouldn't be trying to use them to determine whether or not the branch
is short. Notably, this will fail in the case where the code is being
loaded into a target in such a way that the section offsets differ
between the process generating the code and the target process.

rdar://127673408
2024-05-29 09:27:30 +01:00
jeanPerier
326f58d7d6 [flang][HLFIR] lower hlfir.declare of assumed-ranks (#93468)
hlfir.declare is in charge of ensuring that the lower bounds of its
"hlfir entity" output are the ones of the source program. For
non-allocatable/non-pointer assumed-ranks where the input descriptor
lower bounds may not be ones, the hlfir.declare needs to be lowered to
an hlfir.rebox_assumed_rank to set the lower bounds to ones.
2024-05-29 10:19:07 +02:00
jeanPerier
5aba0ded6c [flang] lower assumed-rank variables specification expressions (#93477)
Enable lowering of assumed-ranks in specification parts under a debug
flag. I am using a debug flag because many cryptic TODOs/issues may be
hit until more support is added. The development should not take too
long, so I want to stay away from the noise of adding an actual
experimental flag to flang-new.
2024-05-29 10:18:22 +02:00
David Green
850f30c3ba [ARM][MVE] Don't allow tail-predication with else predicates
The test case contains a vpt block with an else predicated instruction. This
might not be very unrealistic, but currently crashes due to not being able to
handle the else. The instruction would need to be removed. This patch adds some
extra checks that none of the instructions in vpt block is else predicated,
leaving it using vctp.
2024-05-29 09:08:32 +01:00
David Green
1c6746e2db [VectorCombine] Add support for zext/sext/trunc to shuffleToIdentity (#92696)
This is one of the simple additions to shuffleToIdentity that help it
look through intermediate zext/sext instructions.
2024-05-29 08:56:41 +01:00
Christian Sigg
76e1a535fd [llvm][bazel] Fix llvm-config after 3613b26831. 2024-05-29 09:45:51 +02:00
Shengchen Kan
a9e8a3a18e [X86][CodeGen] Extend X86CompressEVEX for NF transform 2024-05-29 15:41:31 +08:00
Noah Goldstein
5532ab1732 [InstCombine] Make the (icmp eq/ne (and X, Y), X) canonicalization work for non-const operands
We currently do:
    `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (and ~X, Y), 0)`
if `X` is constant. We can make this more general and do it if `X` is
freely invertable (i.e say `X = ~Z`).

As well, we can also do:
    `(icmp eq/ne (and X, Y), Y)` -> `(icmp eq/ne (or X, ~Y), -1)`
If `Y` is freely invertible.

Proofs: https://alive2.llvm.org/ce/z/yeWH3E

Differential Revision: https://reviews.llvm.org/D159059

Closes #84688
2024-05-29 02:38:23 -05:00
Noah Goldstein
9871486683 [InstCombine] Add multiuse tests for canonicalizing (icmp eq/ne (and x, y), {x,y}); NFC 2024-05-29 02:38:22 -05:00
Pavel Labath
2cfea14a57 [lldb-dap] Add timestamps to protocol logs (#93540)
I've found them very useful as a rudimentary form of benchmark.
2024-05-29 09:27:32 +02:00
Pavel Labath
53d79feec9 [lldb/DWARF] Bypass the compres^Wconstruction of DIERefs in debug_names (#93296)
DebugNamesDWARFIndex was jumping through hoops to construct a DIERef
from an index entry only to jump through them back a short while later
to construct a DWARFDIE.

This used to be necessary as the index lookup was a two stage process,
where we first enumerated all matches, and then examined them (so it was
important that the enumeration was cheap -- does not trigger unnecessary
parsing). However, now that the processing is callback based, we are
always immediately examining the DWARFDIE right after finding the entry,
and the DIERef just gets in the way.
2024-05-29 09:17:24 +02:00
Antonio Frighetto
70091dc943 [LICM] Invalidate cached SCEV results in hoistMulAddAssociation
While reassociating expressions, LICM is required to invalidate SCEV
results, as otherwise subsequent passes in the pipeline that leverage
LICM foldings (e.g. IndVars), may reason on invalid expressions; thus
miscompiling. This is achieved by rewriting the reassociable
instruction from scratch.

Fixes: https://github.com/llvm/llvm-project/issues/91957.
2024-05-29 08:44:45 +02:00
Antonio Frighetto
c2a9a974ca [LICM] Introduce test for PR92655 (NFC) 2024-05-29 08:44:45 +02:00
Guray Ozen
7f58ffd09b [mlir][python] Yield results of scf.for_ (#93610)
Using `for_` is very hand with python bindings. Currently, it doesn't
support results, we had to fallback to two lines scf.for.

This PR yields results of scf.for in `for_`

---------

Co-authored-by: Maksim Levental <maksim.levental@gmail.com>
2024-05-29 08:43:13 +02:00
MagentaTreehouse
476a6d81a3 [NFC] Construct Twines before concatenation (#90728)
Construct `Twine`s before concatenation.
2024-05-28 23:12:26 -07:00
Pengcheng Wang
4e0bd3fab4 [MachineLICM] Hoist copies of constant physical register (#93285)
Previously, we just check if the source is a virtual register and
this prevents some potential hoists.

We can see some improvements in AArch64/RISCV tests.
2024-05-29 14:10:01 +08:00
Craig Topper
5162027c9b [RISCV] Add test for #93578. NFC 2024-05-28 22:50:37 -07:00
Fangrui Song
70d6b8a358 MCAsmParser: Amend \+ expansion
Amend 7c956293d8 ("MCAsmParser: Support
\+") to increase Macro.Count per iteration to match the new gas feature
(milestone: 2.43).
2024-05-28 22:50:21 -07:00
Chuanqi Xu
b0f10a1dc3 [C++20] [Modules] Don't generate the defintition for non-const available external variables (#93530)
Close https://github.com/llvm/llvm-project/issues/93497

The root cause of the problem is, we mark the variable from other
modules as constnant in LLVM incorrectly. This patch fixes this problem
by not emitting the defintition for non-const available external
variables. Since the non const available externally variable is not
helpful to the optimization.
2024-05-29 13:39:57 +08:00
Matthew Devereau
3613b26831 Constant Fold logf128 calls (#90611)
This is a second attempt to land #84501 which failed on several targets.

This patch adds the HAS_IEE754_FLOAT128 define which makes the check for
typedef'ing float128 more precise by checking whether __uint128_t is
available and checking if the host does not use __ibm128 which is
prevalent on power pc targets and replaces IEEE754 float128s.
2024-05-29 06:13:02 +01:00