Guillaume Chatelet [Tue, 13 Jun 2023 14:41:17 +0000 (14:41 +0000)]
[libc] Dispatch memmove to memcpy when buffers are disjoint
Most of the time `memmove` is called on buffers that are disjoint, in that case we can use `memcpy` which is faster.
The additional test is branchless on x86, aarch64 and RISCV with the zbb extension (bitmanip).
On x86 this patch adds a latency of 2 to 3 cycles.
Before
```
--------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
--------------------------------------------------------------------------------
BM_Memmove/0/0_median 5.00 ns 5.00 ns 10 bytes_per_cycle=1.25477/s bytes_per_second=2.62933G/s items_per_second=199.87M/s __llvm_libc::memmove,memmove Google A
BM_Memmove/1/0_median 6.21 ns 6.21 ns 10 bytes_per_cycle=3.22173/s bytes_per_second=6.75106G/s items_per_second=160.955M/s __llvm_libc::memmove,memmove Google B
BM_Memmove/2/0_median 8.09 ns 8.09 ns 10 bytes_per_cycle=5.31462/s bytes_per_second=11.1366G/s items_per_second=123.603M/s __llvm_libc::memmove,memmove Google D
BM_Memmove/3/0_median 5.95 ns 5.95 ns 10 bytes_per_cycle=2.71865/s bytes_per_second=5.69687G/s items_per_second=167.967M/s __llvm_libc::memmove,memmove Google L
BM_Memmove/4/0_median 5.63 ns 5.63 ns 10 bytes_per_cycle=2.28294/s bytes_per_second=4.78383G/s items_per_second=177.615M/s __llvm_libc::memmove,memmove Google M
BM_Memmove/5/0_median 5.68 ns 5.68 ns 10 bytes_per_cycle=2.16798/s bytes_per_second=4.54295G/s items_per_second=176.015M/s __llvm_libc::memmove,memmove Google Q
BM_Memmove/6/0_median 7.46 ns 7.46 ns 10 bytes_per_cycle=3.97619/s bytes_per_second=8.332G/s items_per_second=134.044M/s __llvm_libc::memmove,memmove Google S
BM_Memmove/7/0_median 5.40 ns 5.40 ns 10 bytes_per_cycle=1.79695/s bytes_per_second=3.76546G/s items_per_second=185.211M/s __llvm_libc::memmove,memmove Google U
BM_Memmove/8/0_median 5.62 ns 5.62 ns 10 bytes_per_cycle=3.18747/s bytes_per_second=6.67927G/s items_per_second=177.983M/s __llvm_libc::memmove,memmove Google W
BM_Memmove/9/0_median 101 ns 101 ns 10 bytes_per_cycle=9.77359/s bytes_per_second=20.4803G/s items_per_second=9.9333M/s __llvm_libc::memmove,uniform 384 to 4096
```
After
```
BM_Memmove/0/0_median 3.57 ns 3.57 ns 10 bytes_per_cycle=1.71375/s bytes_per_second=3.59112G/s items_per_second=280.411M/s __llvm_libc::memmove,memmove Google A
BM_Memmove/1/0_median 4.52 ns 4.52 ns 10 bytes_per_cycle=4.47557/s bytes_per_second=9.37843G/s items_per_second=221.427M/s __llvm_libc::memmove,memmove Google B
BM_Memmove/2/0_median 5.70 ns 5.70 ns 10 bytes_per_cycle=7.37396/s bytes_per_second=15.4519G/s items_per_second=175.399M/s __llvm_libc::memmove,memmove Google D
BM_Memmove/3/0_median 4.47 ns 4.47 ns 10 bytes_per_cycle=3.4148/s bytes_per_second=7.15563G/s items_per_second=223.743M/s __llvm_libc::memmove,memmove Google L
BM_Memmove/4/0_median 4.53 ns 4.53 ns 10 bytes_per_cycle=2.86071/s bytes_per_second=5.99454G/s items_per_second=220.69M/s __llvm_libc::memmove,memmove Google M
BM_Memmove/5/0_median 4.19 ns 4.19 ns 10 bytes_per_cycle=2.5484/s bytes_per_second=5.3401G/s items_per_second=238.924M/s __llvm_libc::memmove,memmove Google Q
BM_Memmove/6/0_median 5.02 ns 5.02 ns 10 bytes_per_cycle=5.94164/s bytes_per_second=12.4505G/s items_per_second=199.14M/s __llvm_libc::memmove,memmove Google S
BM_Memmove/7/0_median 4.03 ns 4.03 ns 10 bytes_per_cycle=2.47028/s bytes_per_second=5.17641G/s items_per_second=247.906M/s __llvm_libc::memmove,memmove Google U
BM_Memmove/8/0_median 4.70 ns 4.70 ns 10 bytes_per_cycle=3.84975/s bytes_per_second=8.06706G/s items_per_second=212.72M/s __llvm_libc::memmove,memmove Google W
BM_Memmove/9/0_median 90.7 ns 90.7 ns 10 bytes_per_cycle=10.8681/s bytes_per_second=22.7739G/s items_per_second=11.02M/s __llvm_libc::memmove,uniform 384 to 4096
```
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D152811
Vitaly Buka [Wed, 14 Jun 2023 08:15:59 +0000 (01:15 -0700)]
[test][hwasan] Allow test for any platform with tagging
Carl Ritson [Wed, 14 Jun 2023 08:13:32 +0000 (17:13 +0900)]
[AMDGPU] Pre-commit test for D152892 (NFC)
Nikita Popov [Wed, 14 Jun 2023 08:08:46 +0000 (10:08 +0200)]
[PhaseOrdering] Regenerate test checks (NFC)
Just naming changes.
Nikita Popov [Wed, 14 Jun 2023 07:18:10 +0000 (09:18 +0200)]
[InstCombine] Handle use count decrement in more cases
These two helpers also decrement the use count of the replaced
operand, so give them the same treatment as eraseInstruction().
Vitaly Buka [Wed, 14 Jun 2023 07:58:05 +0000 (00:58 -0700)]
[test][hwasan] Rename constants in test
Nikita Popov [Wed, 14 Jun 2023 07:57:01 +0000 (09:57 +0200)]
[Clang] Rename getElementBitCast() -> withElementType() (NFC)
This no longer creates a bitcast, just changes the element type
of the ConstantAddress.
Joshua Cao [Tue, 30 May 2023 03:57:20 +0000 (20:57 -0700)]
[SimpleLoopUnswitch] Unswitch AND/OR conditions of selects
If a select's condition is a AND/OR, we can unswitch invariant operands.
This patch uses existing logic from unswitching AND/OR's for branch
conditions.
This patch fixes the Cost computation for unswitching selects to have
the cost of the entire loop, since unswitching selects do not remove
branches. This is required for this patch because otherwise, there are
cases where unswitching selects of AND/OR is beating out unswitching of
branches.
This patch also prevents unswitching of logical AND/OR selects. This
should instead be done by unswitching of AND/OR branch conditions.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D151677
Joshua Cao [Tue, 30 May 2023 04:06:20 +0000 (21:06 -0700)]
[SimpleLoopUnswitch][NFC] Add tests for and/or conditions of selects
Matthias Springer [Wed, 14 Jun 2023 07:31:13 +0000 (09:31 +0200)]
[mlir][vector][bufferize] Better analysis for vector.transfer_write
The destination operand does not bufferize to a memory read if it is completely overwritten.
Differential Revision: https://reviews.llvm.org/D152823
Michael Platings [Wed, 14 Jun 2023 07:28:15 +0000 (08:28 +0100)]
Fix test Driver/mips-mti-linux.c
Nikita Popov [Wed, 31 May 2023 14:09:06 +0000 (16:09 +0200)]
[InstCombine] Revisit user of newly one-use instructions
Many folds in InstCombine are limited to one-use instructions. For
that reason, if the use-count of an instruction drops to one, it
makes sense to revisit that one user. This is one of the most
common reasons why InstCombine fails to finish in a single iteration.
Doing this revisit actually slightly improves compile-time, because
we save an extra InstCombine iteration in enough cases to make a
visible difference.
This is conceptually NFC, but not NFC in practice, because differences
in worklist order can result in slightly different folding behavior.
The regressed tests in or-shifted-masks.ll now require a sequence of
instcombine,early-cse,instcombine to fold fully. D152876 would make
these fold in a single instcombine run again.
Differential Revision: https://reviews.llvm.org/D151807
eopXD [Sat, 3 Jun 2023 16:02:37 +0000 (09:02 -0700)]
[11/11][Clang][RISCV] Expand all variants for vset on tuple types
This is the 11th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152078.
This patch also fixes the suffix for non-overloaded variants for
vset on tuple types.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152079
eopXD [Sat, 3 Jun 2023 15:41:40 +0000 (08:41 -0700)]
[10/11][Clang][RISCV] Expand all variants for vget on tuple types
This is the 10th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152077.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152078
eopXD [Sat, 3 Jun 2023 03:25:51 +0000 (20:25 -0700)]
[9/11][Clang][RISCV] Expand all variants for indexed strided segment store
This is the 9th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152076.
This patch expands all variants of indexed strided segment store.
This patch also fixes the trailing suffix in the intrinsics' function
name that representing the return type, adding `x{NF}`.
For the same reason mentioned in [3/11], only full test case for
vsuxseg2ei32, vsoxseg2ei32 is added for now.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152077
eopXD [Sat, 3 Jun 2023 03:20:04 +0000 (20:20 -0700)]
[8/11][Clang][RISCV] Expand all variants for indexed strided segment load
This is the 8th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152075.
This patch expands all variants of indexed strided segment load,
including the policy variants. This patch also fixes the trailing suffix
in the intrinsics' function name that representing the return type,
adding `x{NF}`.
For the same reason mentioned in [3/11], only full test case for
vluxseg2ei32, vloxseg2ei32 is added for now.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152076
eopXD [Sat, 3 Jun 2023 03:07:08 +0000 (20:07 -0700)]
[7/11][Clang][RISCV] Expand all variants for strided segment store
This is the 7th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152074.
This patch expands all variants for strided segment store. The store
intrinsics does not have any policy variants. This patch also fixes the
trailing suffix in the intrinsics' function name that representing the
return type, adding `x{NF}`.
For the same reason mentioned in [3/11], only full test case for
vssseg2e32 is added for now.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152075
eopXD [Sat, 3 Jun 2023 02:58:24 +0000 (19:58 -0700)]
[6/11][Clang][RISCV] Expand all variants for strided segment load
This is the 6th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152073.
This patch expands all variants of strided segment load, including the
policy variants. This patch also fixes the trailing suffix in the
intrinsics' function name that representing the return type, adding
`x{NF}`.
For the same reason mentioned in [3/11], only full test case for
vlsseg2e32 is added.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152074
Chuanqi Xu [Wed, 14 Jun 2023 07:04:39 +0000 (15:04 +0800)]
[NFC] skip the test modules-vtable.cppm on windows
The new added test has problems on windows since the patch is about ABI
and MSVC ABI is not covered. Skip the test on windows to make the CI
green.
eopXD [Tue, 30 May 2023 17:14:06 +0000 (10:14 -0700)]
[5/11][Clang][RISCV] Expand all variants for unit stride fault-first segment load
This is the 5th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152072.
This patch expands all variants of unit stride fault-first segment
load, including the policy variants. This patch also fixes the
trailing suffix in the intrinsics' function name that representing
the return type, adding `x{NF}`.
For the same reason mentioned in [3/11], only full test case for
vlseg2e32ff is added.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152073
Zi Xuan Wu (Zeson) [Wed, 14 Jun 2023 06:58:48 +0000 (14:58 +0800)]
[CSKY] Add support for half-precision floats
Complete fp16 support by ensuring that load extension / truncate store operations are properly expanded.
Piyou Chen [Wed, 14 Jun 2023 06:05:09 +0000 (23:05 -0700)]
[NFC][RISCV] rename findFirstNonVersionCharacter with findLastNonVersionCharacter
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152506
Matthias Springer [Wed, 14 Jun 2023 06:41:19 +0000 (08:41 +0200)]
[mlir][IR] Improve listener notifications for ops without results
`RewriterBase::Listener::notifyOperationReplaced` notifies observers that an op is about to be replaced with a range of values. This notification is not very useful for ops without results, because it does not specify the replacement op (and it cannot be deduced from the replacement values). It provides no additional information over the `notifyOperationRemoved` notification.
This revision adds an additional notification when a rewriter replaces an op with another op. By default, this notification triggers the original "op replaced with values" notification, so there is no functional change for existing code.
This new API is useful for the transform dialect, which needs to track op replacements. (Updated in a subsequent revision.)
Also includes minor documentation improvements.
Differential Revision: https://reviews.llvm.org/D152814
eopXD [Tue, 30 May 2023 16:50:51 +0000 (09:50 -0700)]
[4/11][Clang][RISCV] Expand all variants for unit stride segment store
This is the 4th patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152071.
This patch expands all variants for unit stride segment store. The
store intrinsics does not have any policy variants. This patch also
fixes the trailing suffix in the intrinsics' function name that
representing the return type, adding `x{NF}`.
For the same reason mentioned in [3/11], only full test case for
vsseg2e32 is added.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152072
eopXD [Tue, 30 May 2023 15:32:48 +0000 (08:32 -0700)]
[3/11][Clang][RISCV] Expand all variants for unit stride segment load
This is the 3rd patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152070.
This patch expands all variants of unit stride segment load, including
the policy variants. This patch also fixes the trailing suffix in the
intrinsics' function name that representing the return type, adding
`x{NF}`.
Currently the tuple type co-exists with the non-tuple type intrinsics.
Since the co-existance is temporary, this patch only adds test cases of
all variants for vlseg2e32 to show the capability done.
Test cases of other data type and NF will be added in the patch-set
when the replacement happens.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152071
eopXD [Sun, 28 May 2023 13:14:11 +0000 (06:14 -0700)]
[2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types
This is the 2nd patch of the patch-set. For the cover letter, please
checkout D152069.
Depends on D152069.
This patch also removes redundant checks related to tuples and dedicate
the check to happen in `RVVType::verifyType`.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152070
Valentin Clement [Wed, 14 Jun 2023 06:20:11 +0000 (23:20 -0700)]
[flang][openacc] Lower gang dim to MLIR
Lower gang dim from the parse tree to the new MLIR
representation.
Depends on D151972
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D151973
River Riddle [Fri, 9 Jun 2023 21:08:41 +0000 (14:08 -0700)]
[Orc][Coff] Skip registration of voltbl sections
We're getting asserts for duplicate section registration during
linking which stems back to these sections. From previous
discussions, it seems like these are metadata sections that can
be dropped. See the discussion in D116474 and
https://bugs.llvm.org/show_bug.cgi?id=45111.
Differential Revision: https://reviews.llvm.org/D152574
Michael Platings [Tue, 6 Jun 2023 17:56:59 +0000 (18:56 +0100)]
[Docs] Multilib design
Reviewed By: peter.smith, MaskRay
Differential Revision: https://reviews.llvm.org/D143587
Michael Platings [Wed, 1 Feb 2023 15:48:46 +0000 (15:48 +0000)]
[Driver] BareMetal ToolChain multilib layering
This enables layering baremetal multilibs on top of each other.
For example a multilib containing only a no-exceptions libc++ could be
layered on top of a multilib containing C libs. This avoids the need
to duplicate the C library for every libc++ variant.
Differential Revision: https://reviews.llvm.org/D143075
Michael Platings [Tue, 31 Jan 2023 15:45:16 +0000 (15:45 +0000)]
[Driver] Enable selecting multiple multilibs
This will enable layering multilibs on top of each other.
For example a multilib containing only a no-exceptions libc++ could be
layered on top of a multilib containing C libs. This avoids the need
to duplicate the C library for every libc++ variant.
This change doesn't expose the functionality externally, it only opens
the functionality up to be potentially used by ToolChain classes.
Differential Revision: https://reviews.llvm.org/D143059
Michael Platings [Tue, 7 Feb 2023 16:19:23 +0000 (16:19 +0000)]
[Driver] Enable multilib.yaml in the BareMetal ToolChain
The default location for multilib.yaml is lib/clang-runtimes, without
any target-specific suffix. This will allow multilibs for different
architectures to share a common include directory.
To avoid breaking the arm-execute-only.c CHECK-NO-EXECUTE-ONLY-ASM
test, add a ForMultilib argument to getARMTargetFeatures.
Since the presence of multilib.yaml can change the exact location of a
library, relax the baremetal.cpp test.
Differential Revision: https://reviews.llvm.org/D142986
Michael Platings [Thu, 9 Mar 2023 19:38:26 +0000 (19:38 +0000)]
[Driver] Add -print-multi-flags-experimental option
This option causes the flags used for selecting multilibs to be printed.
This is an experimental feature that is documented in detail in D143587.
Differential Revision: https://reviews.llvm.org/D142933
Michael Platings [Tue, 6 Jun 2023 14:31:46 +0000 (15:31 +0100)]
[Driver] Multilib YAML parsing
The format includes a ClangMinimumVersion entry to avoid a potential
source of subtle errors if an older version of Clang were to be used
with a multilib.yaml that requires a newer Clang to work correctly.
This feature is comparable to CMake's cmake_minimum_required.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D142932
Kirill Stoimenov [Sat, 10 Jun 2023 00:16:48 +0000 (00:16 +0000)]
[HWASAN] Implement munmap interceptor for HWASAN
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D152763
Wang Rui [Wed, 14 Jun 2023 05:21:25 +0000 (13:21 +0800)]
[LoongArch] Ignore warnings when there is no environment in triple
In Rust bare-metal targets, there is no environment component in triple name. This patch ignores warnings that look like:
```
warning: triple-implied ABI conflicts with provided target-abi ‘lp64s', using target-abi
```
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D152778
Chuanqi Xu [Wed, 14 Jun 2023 04:45:34 +0000 (12:45 +0800)]
[ABI] [C++20] [Modules] Don't generate vtable if the class is defined in other module unit
Close https://github.com/llvm/llvm-project/issues/61940.
The root cause is that clang will generate vtable as strong symbol now
even if the corresponding class is defined in other module units. After
I check the wording in Itanium ABI, I find this is not inconsistent.
Itanium ABI 5.2.3
(https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable) says:
> The virtual table for a class is emitted in the same object containing
> the definition of its key function, i.e. the first non-pure virtual
> function that is not inline at the point of class definition.
So the current behavior is incorrect. This patch tries to address this.
Also I think we need to do a similar change for MSVC ABI. But I don't
find the formal wording. So I don't address this in this patch.
Reviewed By: rjmccall, iains, dblaikie
Differential Revision: https://reviews.llvm.org/D150023
Fabio D'Urso [Wed, 14 Jun 2023 03:54:08 +0000 (03:54 +0000)]
[scudo] Fix bound checks in MemMap and ReservedMemory methods
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D152690
Jonas Devlieghere [Wed, 14 Jun 2023 03:48:05 +0000 (20:48 -0700)]
[lldb] Fix Debugger whitespace and formatting (NFC)
Remove trailing whitespace and fix formatting.
Jonas Devlieghere [Wed, 14 Jun 2023 03:50:14 +0000 (20:50 -0700)]
[lldb] Include <atomic> in LLDBAssert
Jonas Devlieghere [Wed, 14 Jun 2023 03:24:18 +0000 (20:24 -0700)]
[lldb] Print lldbassert to debugger diagnostics
When hitting an lldbassert in a non-assert build, we emit a blurb
including the assertion, the triggering file and line and a pretty
backtrace leading up to the issue. Currently, this is all printed to
stderr. That's fine on the command line, but when used as library, for
example from Xcode, this information doesn't make it to the user. This
patch uses the diagnostic infrastructure to report LLDB asserts as
diagnostic events.
The patch is slightly more complicated than I would've liked because of
layering. lldbassert is part of Utility while the debugger diagnostics
are implemented in Core.
Differential revision: https://reviews.llvm.org/D152866
Valentin Clement [Wed, 14 Jun 2023 03:43:44 +0000 (20:43 -0700)]
[flang][openacc][NFC] Remove unused genObjectList function
genObjectList is not used anymore. Just remove it.
Depends on D151975
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D151976
Valentin Clement [Wed, 14 Jun 2023 03:33:20 +0000 (20:33 -0700)]
[flang][openacc] Add parsing support for dim in gang clause
Add parsing supprot for dim in gang clause
Depends on D151971
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D151972
Valentin Clement [Wed, 14 Jun 2023 03:32:04 +0000 (20:32 -0700)]
[mlir][flang][openacc] Use new firstprivate representation for compute construct
Use the new firstprivate representation on the comupte construct.
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D151975
Kelvin Li [Wed, 14 Jun 2023 02:57:47 +0000 (22:57 -0400)]
[flang] Fix flang-aarch64-latest-gcc build failure
The failure is due to mismatch of the SmallVector parameter and the
return when built by gcc.
Nico Weber [Wed, 14 Jun 2023 03:08:43 +0000 (20:08 -0700)]
[gn] Fix case of directory I added in
9239cde390e
Nico Weber [Wed, 14 Jun 2023 02:41:34 +0000 (19:41 -0700)]
[gn build] Port
2700da5fe28d (lld/unittests etc)
Craig Topper [Wed, 14 Jun 2023 01:01:22 +0000 (18:01 -0700)]
Revert "[RISCV] Fold binary op into select if profitable."
This reverts commit
d0189584631e587279ee5f0af5feb94d8045bb31.
Build failures have been reported in the Linux kernel.
Noah Goldstein [Wed, 14 Jun 2023 00:32:19 +0000 (19:32 -0500)]
[InstCombine] Transform `(binop1 (binop2 (lshift X,Amt),Mask),(lshift Y,Amt))`
If `Mask` and `Amt` are not constants and `binop1` and `binop2` are
the same we can transform to:
`(binop (lshift (binop X, Y), Amt), Mask)`
If `binop` is `add`, `lshift` must be `shl`.
If `Mask` and `Amt` are constants `C` and `C1` respectively.
We can transform to:
`(lshift1 (binop1 (binop2 X, (inv_lshift1 C, C1), Y)), C1)`
Saving an instruction IFF:
`lshift1` is same opcode as `lshift2`
Either `bitwise1` and/or `bitwise2` is `and`.
Proofs(1/2): https://alive2.llvm.org/ce/z/BjN-m_
Proofs(2/2): https://alive2.llvm.org/ce/z/bZn5QB
This is to help fix the regression caused in D151807
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152568
Noah Goldstein [Fri, 9 Jun 2023 17:54:51 +0000 (12:54 -0500)]
[InstCombine] Add tests for (binop (binop (lshift X,Amt),Mask),(lshift Y,Amt)); NFC
Differential Revision: https://reviews.llvm.org/D152567
Matt Arsenault [Sat, 10 Jun 2023 17:03:22 +0000 (13:03 -0400)]
TargetTransformInfo: Add addrspacesMayAlias
For some reason we used to only handle address space aliasing through
chaining a target specific AA pass. We need never-fail simple queries
in order to lower memmove intrinsics based purely on the address
spaces.
I also think it would be better if BasicAA checked this, rather than
relying on the target AA passes. Currently we go through the more
expensive AA analyses before getting to the trivial address space
checks.
Matt Arsenault [Mon, 12 Jun 2023 12:15:42 +0000 (08:15 -0400)]
DAG: Fix typo in GET_FPENV legality check
This made GET_FPENV unusable since the DAG builder would always emit
the mem version.
Philip Reames [Wed, 14 Jun 2023 00:07:17 +0000 (17:07 -0700)]
[RISCV] Minor style changes to performCombineVMergeAndVOps [nfc]
Making the code a bit easier to follow, so that merging an upcoming change is more straight forward.
Diego Caballero [Sat, 10 Jun 2023 00:36:33 +0000 (00:36 +0000)]
[mlir][Vector] Add basic scalable vectorization support to Linalg vectorizer
For now, only elementwise operations are supported. Operations that perform any
kind of data permutation require changes in the representation of scalable
dimensions in VectorType.
Differential Revision: https://reviews.llvm.org/D152599
Vasileios Porpodas [Tue, 13 Jun 2023 19:39:23 +0000 (12:39 -0700)]
[SLP][NFC] Precommit test that exposes a bug in ShuffleBuilder.
ShuffleBuilder generates a zero mask here:
`[[TMP6:%.*]] = shufflevector <2 x float> [[TMP3]], <2 x float> poison, <4 x i32> zeroinitializer`
But the correct mask is `0,0,1,1`, or we should have reused `TMP4`.
Differential Revision: https://reviews.llvm.org/D152868
Johannes Doerfert [Tue, 13 Jun 2023 23:39:49 +0000 (16:39 -0700)]
[Attributor][NFC] Make the MustBeExecutedContextExplorer optional
For a lightweight pass we do not want to instantiate or use the
MustBeExecutedContextExplorer. This simply allows such a configuration.
While at it, the explorer is now allocated with the bump allocator.
Philip Reames [Tue, 13 Jun 2023 23:19:02 +0000 (16:19 -0700)]
[RISCV] Canonicalize towards vmerge w/passthrough representation
This is the first patch in a series to change how we represent tail agnostic, tail undefined, and tail undisturbed operations. In current code, we tend to use an unsuffixed pseudo for undefined (despite calling it TA most places in code), and the _TU form for both agnostic and undisturbed (via the policy operand).
The key observation behind this patch is that we can represent tail undefined via a pseudo with a passthrough operand if that operand is IMPLICIT_DEF (aka undef). We already have a few instances of this in tree - see vmv.s.x and vslide* - but we can do this more universally. Once complete, we will be able to delete roughly ~1/3 of our vector pseudo classes.
A bit more information on the overall goal can be found in this discourse post: https://discourse.llvm.org/t/riscv-transition-in-vector-pseudo-structure-policy-variants/71295.
This patch doesn't actually remove the legacy unsuffixed pseudo as there's still some path from intrinsic lowering which uses it. (I have not yet located it.) This also means we don't have to modify any of the lookup tables which makes the migration simpler. We can defer deleting the tables and pseudos until one final change once all the instructions have been migrated.
There are a couple of regressions in the tests. At first, these concerned me, but it turns out that all of them are differences in expansion of a single source level instruction. I think we can safely ignore this for the moment. I did explore changing the handling of IMPLICIT_DEF in ScheduleDAG, but that causes an absolutely *massive* test diff with minimal profit. I really don't think it's worth doing.
Differential Revision: https://reviews.llvm.org/D152380
Johannes Doerfert [Tue, 13 Jun 2023 21:47:14 +0000 (14:47 -0700)]
[Attributor][FIX] Ensure unknown accesses are honored
If we had an unknown access but already some prior knowledge (known), we
could have ended up ignoring the unknown access all together. The
problem is that we track unknown not as all locations but separately.
This patch bridges the gap and expands the unknown bits to "all bits"
when we add an access.
Fixes: https://github.com/llvm/llvm-project/issues/63291
Johannes Doerfert [Tue, 13 Jun 2023 21:55:51 +0000 (14:55 -0700)]
[Attributor][NFC] Precommit test for #63291
See: https://github.com/llvm/llvm-project/issues/63291
Craig Topper [Tue, 13 Jun 2023 23:09:25 +0000 (16:09 -0700)]
[RISCV] Introduce the concept of DLEN(data path width) into getLMULCost.
SiFive's x280 CPU has a vector unit that VLEN/2 bits wide. This
means that LMUL=1 operations take 2 to process all VLEN bits.
This patch adds a DLenFactor tuning parameter and applies it to
TuneSiFive7. getLMULCost has been updated to use this factor in
its calculations. I've added an x280 command line to one cost
model test to demonstrate the effect.
Reviewed By: arcbbb
Differential Revision: https://reviews.llvm.org/D152421
Alex Langford [Sat, 10 Jun 2023 00:06:22 +0000 (17:06 -0700)]
[lldb][NFCI] Remove StructuredData::Dictionary::GetValueForKeyAsString overloads involving ConstString
In an effort to keep the ConstString StringPool small, I plan on
removing use of ConstString in StructuredData. The only class that
really uses it is StructuredData::Dictionary.
This one was fairly easy to remove, I plan on removing the others in
follow-up changes.
Differential Revision: https://reviews.llvm.org/D152597
Dave Lee [Mon, 29 May 2023 02:16:49 +0000 (19:16 -0700)]
[lldb] Default can_create to true in GetChildAtIndex (NFC)
Existing callers of `GetChildAtIndex` pass true for can_create. This change
makes true the default value, callers don't have to pass an opaque true.
See also D151966 for the same change to `GetChildMemberWithName`.
Differential Revision: https://reviews.llvm.org/D152031
Pranav Kant [Tue, 13 Jun 2023 22:43:56 +0000 (22:43 +0000)]
[Bazel] Fix build
Alex Langford [Fri, 2 Jun 2023 00:06:06 +0000 (17:06 -0700)]
[lldb][NFCI] Change return type of Properties::GetExperimentalSettingsName
Most users of this stick it into a StringRef. The one user that doesn't
just tries to get the length out of it, which we can precompute by
putting it in a constexpr StringLiteral.
Differential Revision: https://reviews.llvm.org/D151951
Wu, Yingcong [Tue, 13 Jun 2023 21:51:46 +0000 (14:51 -0700)]
[sanitizer] Adjust code path of ChooseExternalSymbolizer for Windows
If `path` is null, `user_path` must also be null. With the current code path, the message of explicitly disabling symbolizer will never be reported. This patch adjusts the if-else structure to make that message can be reported.
Reviewed By: cchen15, MaskRay
Differential Revision: https://reviews.llvm.org/D148907
Artem Dergachev [Tue, 13 Jun 2023 20:39:45 +0000 (13:39 -0700)]
[-Wtcb-enforcement] Disable on unevaluated code.
It doesn't make sense for this warning to warn about things
that don't impact runtime behavior.
Keith Smiley [Tue, 13 Jun 2023 18:32:30 +0000 (11:32 -0700)]
[llvm-objdump/mac] Add support for LC_ATOM_INFO
This is a new load command first supported in Xcode 15's tools
Differential Revision: https://reviews.llvm.org/D152847
Louis Dionne [Mon, 12 Jun 2023 21:16:32 +0000 (14:16 -0700)]
[libc++] Refactor __debug_three_way_comp
This makes __debug_three_way_comp consistent with __debug_less and
in particular gets rid of a potential use-after-move caused by the
use of std::forward. In the previous version of the code, we would
call `__do_compare_assert` after forwarding the arguments into the
comparator, which could end up using the arguments after they've been
moved from.
This also simplifies how we call `__do_compare_assert` by using
`if constexpr` and adds a missing test for proxy iterators in
lexicographical_compare_three_way, which could have found this
issue.
Differential Revision: https://reviews.llvm.org/D152753
Anshil Gandhi [Tue, 13 Jun 2023 21:14:11 +0000 (15:14 -0600)]
[InstSimplify] Fold all global variables with initializers
Allow computing size of interposable or externally initializable global variables.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152145
Krzysztof Parzyszek [Sat, 3 Jun 2023 17:32:45 +0000 (10:32 -0700)]
[RDF] Allow individual units in PhysicalRegisterInfo::alias
Vitaly Buka [Tue, 13 Jun 2023 21:03:32 +0000 (14:03 -0700)]
[test][asan] Remove XFAIL after D152604
Valentin Clement [Tue, 13 Jun 2023 20:57:43 +0000 (13:57 -0700)]
[flang][openacc] Relax rule for end directive on combined construct
Make the keyword `loop` optional for the end driective on combined
construct. This done to extend compatibility with other compiler that
allow this.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D151856
Anton Rydahl [Tue, 13 Jun 2023 19:40:11 +0000 (20:40 +0100)]
Updated the 'getting involved' documentation for Flang to correct the technical call details
modified: flang/docs/GettingInvolved.md
Reviewed By: NimishMishra
Differential Revision: https://reviews.llvm.org/D152466
Med Ismail Bennani [Tue, 13 Jun 2023 20:45:59 +0000 (13:45 -0700)]
Revert "[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64"
This reverts commit
4177b490358432a457935ba5d6d076ae60de588f, since I
landed it by mistake.
Med Ismail Bennani [Tue, 13 Jun 2023 18:43:17 +0000 (11:43 -0700)]
[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64
This patch should address the failure of TestStackCoreScriptedProcess
that is happening specifically on x86_64.
It turns out that in
1370a1cb5b97, I changed the way we extract integers
from a `StructuredData::Dictionary` and in order to get a stop info from
the scripted process, we call a method that returns a `SBStructuredData`
containing the stop reason data.
TestStackCoreScriptedProcess` was failing specifically on x86_64 because
the stop info dictionary contains the signal number, that the `Scripted
Thread` was trying to extract as a signed integer where it was actually
parsed as an unsigned integer. That caused `GetValueForKeyAsInteger` to
return the default value parameter, `LLDB_INVALID_SIGNAL_NUMBER`.
This patch address the issue by extracting the signal number with the
appropriate type and re-enables the test.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Tue, 13 Jun 2023 18:21:08 +0000 (11:21 -0700)]
[lldb] Improve corefile saving ergonomics
This patch improves the way the user can save the process state into a
corefile by adding completion handler that would provide tab completion
for the corefile path and also resolves the corefile path to expand
relative path.
Differential Revision: https://reviews.llvm.org/D152842
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Valentin Clement [Tue, 13 Jun 2023 20:39:06 +0000 (13:39 -0700)]
[mlir][openacc] Add gang dim operand to acc.loop operation
OpenACC 3.3 introduces a dim argument on the gang clause. This patch
adds a new operand for it on the acc.loop and update the custom
gang clause parser/printer for it.
Depends on D151970
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D151971
Alexandre Ganea [Tue, 13 Jun 2023 20:22:51 +0000 (16:22 -0400)]
[LLD] Allow usage of LLD as a library
As discussed in https://github.com/llvm/llvm-project/issues/53475 this patch allows using LLD-as-a-lib. It also lets clients link only the drivers that they want (see unit tests).
This also adds the unit test infra as in the other LLVM projects. Among the test coverage, I've added the original issue from @krzysz00, see: https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction
Important note: this doesn't allow (yet) linking in parallel. This will come a bit later, in subsequent patches, for COFF at last.
Differential revision: https://reviews.llvm.org/D119049
Arthur Eubanks [Tue, 13 Jun 2023 20:17:32 +0000 (13:17 -0700)]
[Passes] Remove some legacy printer passes
MemDepPrinter doesn't have a new PM equivalent, but MemDep is soft deprecated anyway and adding one should be easy if somebody wants to.
Maksim Panchenko [Tue, 13 Jun 2023 01:21:58 +0000 (18:21 -0700)]
[BOLT][NFCI] Remove redundant instance of MCAsmBackend
Use instance of MCAsmBackend from BinaryContext instead of creating a
new one.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D152849
Wenlei He [Tue, 13 Jun 2023 04:20:19 +0000 (21:20 -0700)]
[LoopSink] Allow sinking to PHI-use
This change allows sinking defs from loop preheader with PHI-use into loop body. Loop sink can now see through PHI-use and select incoming blocks of value being used as candidate sink destination.
It makes loop sink more effective so more LICM can be undone if proven unprofitable with profile info. It addresses the motivating case in D87551, without resorting to profile guided LICM which breaks canonicalization.
Differential Revision: https://reviews.llvm.org/D152772
Kelvin Li [Mon, 29 May 2023 20:10:12 +0000 (16:10 -0400)]
[flang] Add PowerPC vec_add, vec_and, vec_mul, vec_sub and vec_xor intrinsics
Differential Revision: https://reviews.llvm.org/D151857
Reid Kleckner [Mon, 12 Jun 2023 20:50:50 +0000 (13:50 -0700)]
[MS] Fix passing aligned records by value in some cases
It's not exactly clear what the meaning of TypeInfo::AlignRequirement
is, so go directly to the ASTRecordLayout for records and check the
required alignment there. Compare that number with the stack alignment
value of 4.
This fixes cases when the alignment attribute does not appear directly
on the record [1], or when the attribute on the record is underaligned
[2].
[1]: `struct Foo { int __declspec(align(16)) x; };`
[2]: `struct __declspec(align(1)) Bar { int x; };`
Fixes https://llvm.org/pr63257
Differential Revision: https://reviews.llvm.org/D152752
Craig Topper [Tue, 13 Jun 2023 19:46:26 +0000 (12:46 -0700)]
[SelectionDAG] Don't allow type legalization to create noop VP_TRUNCATE.
Type legalization may need to promote the result to the same type
as the input. Instead of forming a vp_truncate with the same
source and dest type, don't create any vp_truncate.
Handling in getNode like is done for ISD::TRUNCATE.
Fangrui Song [Tue, 13 Jun 2023 19:45:34 +0000 (12:45 -0700)]
[CMake][BLAKE3] Fix unused -mavx512vl warning when CMAKE_OSX_ARCHITECTURES=arm64
This fixes
```
% ninja -C out/play LLVMSupport
ninja: Entering directory `out/play'
[151/158] Building ASM object lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o
clang: warning: argument unused during compilation: '-mavx512vl' [-Wunused-command-line-argument]
```
and applies `disable_blake3_x86_simd()`.
This fixes the root cause of commit
5160f6fefb0021a0b23e99c7cf621a330241c211 ("broke cross-builds of llvm from x86_64 to arm64 mac"...)
Vitaly Buka [Tue, 13 Jun 2023 19:26:41 +0000 (12:26 -0700)]
[test][sanitizer] Fix test on windows
AdityaK [Tue, 13 Jun 2023 19:22:46 +0000 (12:22 -0700)]
Enable zbb for riscv android
Differential Revision: https://reviews.llvm.org/D152729
Reviewers: enh, pirama, jrtc27
Alexandre Ganea [Tue, 13 Jun 2023 19:12:55 +0000 (15:12 -0400)]
[LLD][COFF] Allow overwriting directives exports with cmd-line exports
MSVC link.exe allows overriding exports on the cmd-line with exports seen in OBJ directives. The typical case is what is described in #62329.
Before this patch, trying to override an export with `/export` or `/def` would generate a duplicate warning. This patches tries to replicate the MSVC behavior. A second override on the cmd-line would still generate the warning.
There's still a case which we don't cover: MSVC link.exe is able to demangle an exported OBJ directive function, and match it with a unmangled export function in a .def file. In the meanwhile, one can use the mangled export in the .def to cover that case.
This fixes #62329
Differential revision: https://reviews.llvm.org/D149611
Vitaly Buka [Tue, 13 Jun 2023 19:26:41 +0000 (12:26 -0700)]
[test][sanitizer] Fix test on windows
Maksim Panchenko [Sat, 6 May 2023 20:27:48 +0000 (13:27 -0700)]
[BOLT][NFC] Change signature of MCPlusBuilder::isUnsupportedBranch()
Make MCPlusBuilder::isUnsupportedBranch() take MCInst, not opcode.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D152765
Nicolai Hähnle [Fri, 2 Dec 2022 02:15:13 +0000 (03:15 +0100)]
Scalarizer: limit scalarization for small element types
Scalarization can expose optimization opportunities for the individual
elements of a vector, and can therefore be beneficial on targets like
GPUs that tend to operate on scalars anyway.
However, notably with 16-bit operations it is often beneficial to keep
<2 x i16 / half> vectors around since there are packed instructions for
those.
Refactor the code to operate on "fragments" of split vectors. The
fragments are usually scalars, but may themselves be smaller vectors
when the scalarizer-min-bits option is used. If the split is uneven,
the last fragment is a shorter remainder.
This is almost NFC when the new option is unused, but it happens to
clean up some code in the fully scalarized case as well.
Differential Revision: https://reviews.llvm.org/D149842
LLVM GN Syncbot [Tue, 13 Jun 2023 19:06:20 +0000 (19:06 +0000)]
[gn build] Port
474a2b9367ad
AMS21 [Tue, 13 Jun 2023 18:56:54 +0000 (18:56 +0000)]
[clang-tidy] Add more checks for functions which should be noexcept
Added new checks
- `performance-noexcept-destructor`
- `performance-noexcept-swap`
Also added cppcoreguidlines aliases for the 2 new checks as well as `performance-noexcept-move-constructor`
This fixes llvm#62154
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D148697
Mike Crowe [Tue, 13 Jun 2023 18:15:13 +0000 (18:15 +0000)]
[clang-tidy] Move formatDereference to FixitHintUtils
I'd like to use RedundantStringCStrCheck's formatDereference function
from the up-coming modernize-use-std-print check. Let's move it to
FixItHintUtils so that the implementation can be shared.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D150602
Dave Lee [Mon, 29 May 2023 01:48:32 +0000 (18:48 -0700)]
[lldb] Default can_create to true in GetChildMemberWithName (NFC)
It turns out all existing callers of `GetChildMemberWithName` pass true for `can_create`.
This change makes `true` the default value, callers don't have to pass an opaque true.
Differential Revision: https://reviews.llvm.org/D151966
Valentin Clement [Tue, 13 Jun 2023 18:16:31 +0000 (11:16 -0700)]
[mlir][openacc][NFC] Fix current gang clause parser
The custom parser for the gang values was not implemented correctly.
This patch fixes the noted issue and allows the num/static values
to appear in any order.
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D151970
AMS21 [Tue, 13 Jun 2023 18:00:03 +0000 (18:00 +0000)]
[clang-tidy] Fix crash in `modernize-use-default-member-init`
This was causes by `getValueOfValueInit` unconditionally calling
`getScalarTypeKind` on the member type, which would then trigger an
assertions since arrays are not scalar type.
This fixes llvm#63285
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D152802
AMS21 [Tue, 13 Jun 2023 17:58:16 +0000 (17:58 +0000)]
[clang-tidy] Fix false positive in `readability-named-parameter` for defaulted out-of-line special member functions
This fixes llvm#63056
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D152825
Augusto Noronha [Wed, 7 Jun 2023 23:17:37 +0000 (16:17 -0700)]
[lldb] Never print children if the max depth has been reached
When formatting a variable, the max depth would potentially be ignored
if the current value object failed to print itself. Change that to
always respect the max depth, even if failure occurs.
rdar://
109855463
Differential Revision: https://reviews.llvm.org/D152409
Craig Topper [Tue, 13 Jun 2023 17:54:00 +0000 (10:54 -0700)]
[RISCV] Remove RISCVII::hasMergeOp. NFC
We can mostly get this from the operand info in MCInstrDesc.
The exception is the _TIED pseudos so I've added a new flag for those.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D152313