449592 Commits

Author SHA1 Message Date
Matthias Springer
7b3c662da9 [mlir][linalg] Convert tensor.pad to destination style
This can be a pre-processing for bufferization and allows for more efficient lowerings without an alloc.

Differential Revision: https://reviews.llvm.org/D142207
2023-01-24 09:30:06 +01:00
Jay Foad
2630093496 [cmake] Stop using add_definitions
Since CMake 3.12 this has been superseded by add_compile_definitions and
other commands.

Differential Revision: https://reviews.llvm.org/D142363
2023-01-24 08:27:04 +00:00
Jay Foad
cdb226433f [cmake] Remove AddLLVMDefinitions
This has been unused since D31125.

Differential Revision: https://reviews.llvm.org/D142362
2023-01-24 08:27:04 +00:00
Matthias Springer
45ccff175b [mlir][linalg] Convert tensor.generate to destination style
This can be a pre-processing for bufferization and allows for more efficient lowerings without an alloc.

Differential Revision: https://reviews.llvm.org/D142205
2023-01-24 09:13:08 +01:00
eopXD
6f0d0be567 [5/15][Clang][RISCV][NFC] Remove extra attribute Policy::IntrinsicWithoutMU by reusing HasTailPolicy and HasMaskPolicy
Righteously there shouldn't be any special cases here because
`HasTailPolicy` and `HasMaskPolicy` is able to express necessary cases.
This commit is a part of the step-by-step effort to remove
`Policy::Scheme::Omit`, which completely does not make sense in RVV 1.0
because an RVV instruction always executes with `vta` and `vma` set
to a certain value.

This is the 5th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper, kito-cheng

Differential Revision: https://reviews.llvm.org/D141754
2023-01-24 00:10:48 -08:00
eopXD
f8ec44b2a0 [4/15][Clang][RISCV][NFC] Remove unnecessary logic under RVVIntrinsic::computeBuiltinTypes
`PolicyAttrs::IsUnspecified` is modified in
`RVV::Intrinsic::computeBuiltInTypes` and used under
`RVVIntrinsic::updateNamesAndPolicy`. Suprisingly the modification
in `RVV::Intrinsic::computeBuiltInTypes` is completely unnecessary.
This commit removes the redundant logic.

This is the 4th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D141577
2023-01-24 00:09:14 -08:00
eopXD
063802843c [3/15][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolicies for clarity
This is the 3rd commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D141575
2023-01-24 00:07:33 -08:00
eopXD
74252fb115 [2/15][Clang][RISCV][NFC] Rename Policy::IsPolicyNone to IsUnspecifed
The original naming is inaccurate. An RVV intrinsic always comes with
a corresponding policy behavior. When the policy is unspecified for an
intrinsic, its policy behavior should be it's default assumption.

This is the 2nd commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D141574
2023-01-24 00:05:31 -08:00
eopXD
6244982347 [1/15][Clang][RISCV][NFC] Extract common utility to RISCVVIntrinsicUtils
This is the 1st commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

The patch-set work towards the simplification proposal [0] of Nick
Knight. After this patch-set, all intrinsics operates under a general
assumption that the policy behavior is agnostic.

You may find that most of the patches are NFC patches. They subtly remove
implicit assumptions that entangles the codebase, making the singular patch
that contains functional change clear and obvious.

In [2/15], The attribute `Policy::IsPolicyNone` may give the mis-perception
that an RVV intrinsic may operate without any policy. However this is not the
case because the policy CSR-s (`vta` and `vma`) always affect an RVV
instruction's behavior, except that some instructions have policy always set
as agnostic (e.g. instructions with a mask destination register is always
tail agnostic).

Next, to perform the change from TAMU to TAMA, we need to first remove
`Policy::PolicyType::Omit`. [4/15] ~ [12/15] removes it with NFC patches step
by step. Without the patches, directly applying [14/15] to the existing codebase
will not work because there will be complicated logics that are scattered in
places that is hard to maintain.

[1/15], [3/15] are not related to the main goal of this patch-set, they were
clean-up along the way as I was going through the codebase. [13/15] is a
clean-up that was an oversight in D141198.

Finally, [14/15] performs the functional change this patch-set aims for. The
default policy is changed from TAMU to TAMA. This affects the masked version of
the intrinsics without a policy suffix. The masked-off operand is removed. Due
to the removal, masked version of `vid` and `viota` intrinsics are no longer
available for overloading.

[15/15] is a final commit to set data members of `Policy` as constants. Through
the refactoring the class `Policy` is now correct-by-construction.

The next patch-set will be to remove redundant intrinsics with a policy suffix
`_ta` and `_tama` intrinsics are redundant and will be removed. Other policy
suffix will be renamed to adapt to the general assumption that policy is
generally agnostic.

[0] https://gist.github.com/nick-knight/6cb0b74b351a25323dfb1821d3a269b9

Pull Request: riscv-non-isa/rvv-intrinsic-doc#186

Reviewed By: craig.topper, kito-cheng

Differential Revision: https://reviews.llvm.org/D141573
2023-01-24 00:01:23 -08:00
eopXD
6b28229412 [7/7][Clang][RISCV][NFC] Remove attribute IsPrototypeDefaultTU
This is the 7th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

This is the final commit of the patch-set. Now that no intrinsics is
using the attribute, we are safe to remove it.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140954
2023-01-23 23:57:04 -08:00
eopXD
14261c1991 [6/7][Clang][RISCV] Remove default tail-undisturbed for vmv_s_x and vfmv_s_f intrinsics
The destination parameter is removed for non-policy unmasked intrinsics.

The default policy for non-policy (implicit) vmv_s_x and vfmv_s_f
intrinsics will be tail agnostic and mask undisturbed.

Upon change of prototype, vmv_s_x and vfmv_s_f is no longer able to
have an overloading version for its non-policy and tail agnostic
intrinsics.

This is the 6th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140947
2023-01-23 23:53:27 -08:00
eopXD
380129657f [5/7][Clang][RISCV] Remove default tail-undisturbed for vcompress intrinsics
The destination parameter is removed for non-policy unmasked intrinsics.

The default policy for non-policy (implicit) vcompress intrinsics will
be tail agnostic and mask undisturbed.

This is the 5th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140942
2023-01-23 23:50:43 -08:00
eopXD
b106cb4a00 [4/7][Clang][RISCV] Remove default tail-undisturbed for multiply-add intrinsics
The destination parameter is still needed as the computation requires
so.

The default policy for non-policy (implicit) vslideup intrinsics
will be tail agnostic and mask undisturbed.

This is the 4th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140941
2023-01-23 23:46:50 -08:00
eopXD
42eae9ad5f [3/7][Clang][RISCV] Remove default tail-undisturbed for vslidedown intrinsics
The destination parameter is removed for non-policy unmasked vslidedown
intrinsics.

The default policy for non-policy (implicit) vslidedown intrinsics will
be tail agnostic and mask undisturbed.

This is the 3rd commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140937
2023-01-23 23:39:18 -08:00
eopXD
92717c2ca8 [2/7][Clang][RISCV] Remove default tail-undisturbed for vslideup intrinsics
The destination parameter is still needed as elements of
0 <  i < max(vstart, OFFSET) in vd remains unchanged.

The default policy for non-policy (implicit) vslideup intrinsics
will be tail agnostic and mask undisturbed.

This is the 2nd commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an overview.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140936
2023-01-23 23:34:57 -08:00
eopXD
224d29e6f5 [1/7][Clang][RISCV] Remove default tail-undisturbed for vector reduction intrinsics
The destination parameter is removed for non-policy unmasked intrinsics,
they are now tail agnostic. The non-policy masked intrinsics are tail
agnostic and masked undisturbed, just like normal instructions like
vadd.

This is the 1st commit of a patch-set that aims to remove the
`IsPrototypeDefaultTU` special case for the rvv-intrinsics.

The patch-set work towards the simplification proposal [0] of Nick
Knight, the plan is that after this patch-set, all non-policy
intrinsics will be aligned with default policy behavior of tail
agnostic and mask undisturbed. Then the next patch-set will aim
towards changing non-policy intrinsics to tail agnostic and mask
agnostic.

[0] https://gist.github.com/nick-knight/6cb0b74b351a25323dfb1821d3a269b9

Pull Request: riscv-non-isa/rvv-intrinsic-doc#186

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D140895
2023-01-23 23:31:50 -08:00
Kazu Hirata
b3af04f880 [llvm] Use llvm::countr_zero instead of findFirstSet (NFC)
At each call to findFirstSet in this patch, the argument is known to
be nonzero, so we can safely switch to llvm::countr_zero, which will
become std::countr_zero once C++20 is available.
2023-01-23 23:07:41 -08:00
Kazu Hirata
be2ecee046 [SystemZ] Use isShiftedMask_64 instead of isStringOfOnes (NFC)
isStringOfOnes does the same thing as isShiftedMask_64, provided that
the parameter is nonzero, which is the case for both calls in this
patch.
2023-01-23 22:48:42 -08:00
Johannes Doerfert
5238df7ed5 [Attributor] Allow (inter-procedural) "CFG" reasoning for aligned regions
If an instruction is executed in an aligned region we can ignore
threading effects and use CFG reasoning (dominance and reachability).
This is true because all threads are together in an aligned region and
there cannot be one waiting for a signal at a place not connected via
the control flow.

More dedicated tests will follow.

More details can be found here:
"Co-Designing an OpenMP GPU Runtime and Optimizations for Near-Zero
Overhead Execution", IPDPS 2022,
https://www.osti.gov/servlets/purl/1890094
2023-01-23 22:45:48 -08:00
Johannes Doerfert
d41f93dae9 [OpenMP] Readnone calls do not have non-local side-effects 2023-01-23 22:45:47 -08:00
Johannes Doerfert
5d9cb20f40 [OpenMP] Run the Attributor as part of the device runtime optimization
This will help us propagate assumptions to call sites, among other
things.
2023-01-23 22:45:47 -08:00
Shivam Gupta
40003af984 [Clang][NFC] Remove a redundancy check in Sema::adjustMemberFunctionCC
If the current calling convection CurCC is not equal to Target calling
convection ToCC and current calling convention (CurCC) is equal to the
default calling convention (DefaultCC), that means DefaultCC can not be
equal to ToCC so the right part of the expression DefaultCC == ToCC is
not needed.

revelant code -
  if (CurCC == ToCC)
    return;
  if (CurCC != DefaultCC || DefaultCC == ToCC)
    return;

Found by PVS-Studio - https://pvs-studio.com/en/blog/posts/cpp/1003/, N41.

Differential Revision: https://reviews.llvm.org/D142338
2023-01-24 11:56:06 +05:30
Nicole Rabjohn
0f5099cd94 Opting out of Clang 16 ABI Changes for AIX and z/OS
There is already a GCC compatibility gap on AIX, & GCC compatibility is
not a concern on z/OS. GCC compatibility is not sufficient motivation
for breaking ABI on AIX and z/OS. This opts out of changes introduced in
https://reviews.llvm.org/D119051. For AIX only, also opt out of D117616
(which z/OS had picked up at the time ABI stabilization occurred).

Differential Revision: https://reviews.llvm.org/D142358
2023-01-24 01:14:05 -05:00
Mariusz Sikora
848978db4c [AMDGPU][NFC] Apply new naming convention for feature fmacf64
Differential Revision: https://reviews.llvm.org/D142329
2023-01-24 06:59:50 +01:00
Max Kazantsev
932ae48c27 [IndVars] Improve handling of multi-exit loops with known symbolic counts
This patch does two things, both related to support of multi-exit loops with
many exits that have known symbolic max exit count. They can theoretically
go independently, but I don't know how to write a test showing separate
impact.

Part 1: `SkipLastIter` can be set to `true` not when a particular exit has exit
count same as the whole loop (and therefore it must exit on the last iteration),
but when the aggregate of first few exits has umin same as whole loop exit count.
It means that it's not known which of them will exit exactly, but one of them will.

Part 2: when `SkipLastIter` is set, and exit count is `umin(a, b, c)`, instead of
`umin(a, b, c) - 1` use `umin(a - 1, b - 1, c - 1)`. We don't care about overflows
here, but the further logic knows how to deal with umin by element, but the
`SCEVAddExpr` node will confuse it.

Differential Revision: https://reviews.llvm.org/D141361
Reviewed By: nikic
2023-01-24 12:46:48 +07:00
Max Kazantsev
602916d2de [IndVars] Apply more optimistic SkipLastIter for AND/OR conditions
When exit by condition `C1` dominates exit by condition `C2`, and
max symbolic exit count for `C1` matches those for loop, we will
apply more optimistic logic to `C2` by setting `SkipLastIter` for it,
meaning that it will do 1 iteration less because the dominating branch
must exit on the last loop iteration.

But when we have a single exit by condition `C1 & C2`, we cannot
apply the same logic, because there is no dominating condition.

However, if we can prove that the symbolic max exit count of `C1 & C2`
matches those of `C1`, it means that for `C2` we can assume that it
doesn't matter on the last iteration (because the whole thing is `false`
because `C1` must be `false`). Therefore, in this situation, we can handle
`C2` as if it had `SkipLastIter`.

Differential Revision: https://reviews.llvm.org/D139934
Reviewed By: nikic
2023-01-24 12:26:22 +07:00
Andrew Young
a2f71d2732 [MLIR] Add LocationAttr declarations to ODS
This commit adds location attributes and arrays of locations to OpBase.td.
Using LocationAttrs directly in an operation is useful when the location does
not correspond 1-1 to an operation or value in the IR.  We use this in CIRCT to
store the declaration location of result ports of HWModule operations.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D142148
2023-01-23 20:42:14 -08:00
Johannes Doerfert
fedbc689e1 [Attributor] Check assumptions to improve isAlignedBarrier queries 2023-01-23 20:34:26 -08:00
Johannes Doerfert
1771d81475 [Attributor] Allow to delete (assume) intrinsics outside the SCC 2023-01-23 20:32:07 -08:00
Johannes Doerfert
2f6fce8bba [Attributor][FIX] Ensure not to run new queries during manifest
If we modified the IR during manifest, e.g., SPMDzation, we might end up
with un-cached reachability queries. This is not good as the result is
going to be optimistic. We now cache the updateImpl result and use it
during manifest.

Bug was exposed in a follow up extension.
2023-01-23 20:32:06 -08:00
Johannes Doerfert
75728b41f8 [Attributor][FIX] Reachability needs to process the entire worklist 2023-01-23 20:32:06 -08:00
Johannes Doerfert
9f0f84f140 [Attributor][FIX] Replace typo with something more sane 2023-01-23 20:32:05 -08:00
Xiang Li
c3728d2882 [mlir] support !shape.value_shape when replace WithOp in OutlineShapeComputationPass.
Fixes #60069  https://github.com/llvm/llvm-project/issues/60069

In case like:
  %1 = shape.with_shape %arg1, %0 : !shape.value_shape, !shape.shape
  %2 = shape.value_of %1 : tensor<?xf32>
cannot replace %2 with %arg1.
Transform it into
  %2 = shape.value_of %arg1 : tensor<?xf32>

Differential Revision: https://reviews.llvm.org/D142275
2023-01-23 22:24:23 -05:00
Haowei Wu
f2b58eb4ad Revert "[Fuchsia] Build windows runtimes using cross compilation on Linux"
This reverts commit 20bb7658f53b0b8db165ff4d404ede3f9b34862d.
It breaks Fuchsia stage2 builders.
2023-01-23 18:43:23 -08:00
Alexey Bader
b0b4cc1864 [bugpoint] Fix compilation of bugpoint-passes on Windows
Bugpoint also depends on libLLVMSupport.dll for 'llvm_unreachable'

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D140609
2023-01-23 17:42:16 -08:00
Vitaly Buka
5b190c4a2d Revert "[profile] Disable test which needs update after D141512"
Work around with -fno-slp-vectorize.

This reverts commit 31260a4ce43aab7c04f501095a9032de063ccaf9.
2023-01-23 17:35:38 -08:00
Louis Dionne
3c8397fa83 [libc++] Fix installation path for the modulemap
As pointed out in a post-commit comment of https://reviews.llvm.org/rGd00e035a4270.

Differential Revision: https://reviews.llvm.org/D142365
2023-01-23 20:12:26 -05:00
Siva Chandra Reddy
6363320ba6 [libc][NFC] Another round of replacement of static inline with LIBC_INLINE.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D142398
2023-01-24 00:37:09 +00:00
Kirill Stoimenov
2b0322ed56 [HWASAN] Fix PointsIntoChunk to untag pointers. Also added some checks where we know that the pointer should be untagged.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D142389
2023-01-24 00:35:17 +00:00
Francesco Petrogalli
aa19429b19 Re-apply [build] Fix stand-alone builds of clang.
This reverts commit 0e09bb8b143c80426c497a924ee4fa57a26af6b5.

Differential Revision: https://reviews.llvm.org/D142403
2023-01-24 01:29:44 +01:00
Francesco Petrogalli
0e09bb8b14 Revert "[build] Fix stand-alone builds of clang."
There is a typo in the cmake configuration. It should be
RISCVTargetParserTableGen, not RISCVTargetParserTablegen.

This reverts commit 5d02e38f56dfa6c46dd71658c185582af1ffb07b.
2023-01-24 01:24:51 +01:00
Nadeem, Usman
c9821abfc0 [WoA] Use fences for sequentially consistent stores/writes
LLVM currently uses LDAR/STLR and variants for acquire/release
as well as seq_cst operations. This is fine as long as all code uses
this convention.

Normally LDAR/STLR act as one way barriers but when used in
combination they provide a sequentially consistent model. i.e.
when an LDAR appears after an STLR in program order the STLR
acts as a two way fence and the store will be observed before
the load.

The problem is that normal loads (unlike ldar), when they appear
after the STLR can be observed before STLR (if my understanding
is correct). Possibly providing weaker than expected guarantees if
they are used for ordered atomic operations.

Unfortunately in Microsoft Visual Studio STL seq_cst ld/st are
implemented using normal load/stores and explicit fences:
dmb ish + str + dmb ish
ldr + dmb ish

This patch uses fences for MSVC target whenever we write to the
memory in a sequentially consistent way so that we don't rely on
the assumptions that just using LDAR/STLR will give us sequentially
consistent ordering.

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

Change-Id: I48f3500ff8ec89677c9f089ce58181bd139bc68a
2023-01-23 16:09:11 -08:00
Nadeem, Usman
a6a4fe203f [NFC][WoA] Precommit test for aarch64 atomics
This copies the atomic-ops file.
Committed without review.

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

Change-Id: I7d7b05339d9ca23f88848c56f73a3e4d3e1abeba
2023-01-23 16:09:11 -08:00
Kirill Stoimenov
eba322e9d7 [Sanitizer] Make GetBlockBeginFastLocked parameters const.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D142402
2023-01-24 00:01:35 +00:00
Kirill Stoimenov
cf6c43189f [HWASAN] Fix memory leaks in tests.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D142383
2023-01-23 23:59:07 +00:00
Joseph Huber
0ba42be63e [Clang][NFC] Fix documentation and remove unused tool
Summary:
I removed some documentation but not its Sphinx index, this fixes that.
Also I realized that we had a tool in the header still around so that's
gone too.
2023-01-23 17:57:21 -06:00
Francesco Petrogalli
5d02e38f56 [build] Fix stand-alone builds of clang.
The target RISCVTargetParserTablegen needs to be visible for stand-alone [1] builds of clang to prevent configuration failures.

[1] https://llvm.org/docs/GettingStarted.html#stand-alone-builds

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D142403
2023-01-24 00:56:58 +01:00
Scott Linder
a1baa7a5c5 [NFC] Add missing llvm:: specifier
This was omitted in 25c0ea2a5370813f46686918a84e0de27e107d08
2023-01-23 23:51:06 +00:00
Scott Linder
d9e778dfa7 [NFC] Use int underlying type for CodeGenOpt::Level
In practice the change from an unspecified underlying type to uint8_t in
25c0ea2a5370813f46686918a84e0de27e107d08 means some builds break due to
ambiguity resolving operator<< on ostreams (I assume because they define
uint8_t differently).

There were also valid points raised on the review saying that we can
just use int here anyway. Pinning it to any type removes the potential
for UB when constructing it, and int is the de-facto default.
2023-01-23 23:32:10 +00:00
Sanjay Patel
9aa4c6a1e4 [Support] revert accidentally removed "std::" specifiers
This snuck into e76c95fb40b1 but wasn't intended.
Note: for some reason, these prefixes are causing build failures
on a macOS XCode project of LLVM.
2023-01-23 18:31:43 -05:00