Commit Graph

464394 Commits

Author SHA1 Message Date
Joshua Cao
67d4538a81 [SimpleLoopUnswitch][NFC] Add tests for and/or conditions of selects 2023-06-14 00:42:42 -07:00
Matthias Springer
80853a1673 [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
2023-06-14 09:38:51 +02:00
Michael Platings
01b6f06263 Fix test Driver/mips-mti-linux.c 2023-06-14 08:30:03 +01:00
Nikita Popov
f7a977c7b3 [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
2023-06-14 09:12:30 +02:00
eopXD
804306b382 [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
2023-06-14 00:10:13 -07:00
eopXD
d1b6b893ed [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
2023-06-14 00:08:58 -07:00
eopXD
9828c89591 [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
2023-06-14 00:08:17 -07:00
eopXD
9588b18969 [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
2023-06-14 00:07:35 -07:00
eopXD
91b90e0ea0 [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
2023-06-14 00:06:58 -07:00
eopXD
06c0b0ac5a [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
2023-06-14 00:05:59 -07:00
Chuanqi Xu
baf0b12ca6 [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.
2023-06-14 15:05:31 +08:00
eopXD
ff6f7902f9 [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
2023-06-14 00:05:02 -07:00
Zi Xuan Wu (Zeson)
d90468d161 [CSKY] Add support for half-precision floats
Complete fp16 support by ensuring that load extension / truncate store operations are properly expanded.
2023-06-14 15:03:07 +08:00
Piyou Chen
fc4350cb43 [NFC][RISCV] rename findFirstNonVersionCharacter with findLastNonVersionCharacter
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D152506
2023-06-13 23:55:34 -07:00
Matthias Springer
71d50c890b [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
2023-06-14 08:51:14 +02:00
eopXD
b59ca492d9 [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
2023-06-13 23:51:02 -07:00
eopXD
0e9548bbc5 [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
2023-06-13 23:48:36 -07:00
eopXD
5847ec4deb [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
2023-06-13 23:45:31 -07:00
Valentin Clement
66546d94fc
[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
2023-06-13 23:20:41 -07:00
River Riddle
639e411c02 [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
2023-06-13 23:08:48 -07:00
Michael Platings
a5aeba7376 [Docs] Multilib design
Reviewed By: peter.smith, MaskRay

Differential Revision: https://reviews.llvm.org/D143587
2023-06-14 06:46:42 +01:00
Michael Platings
ab2c80bb12 [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
2023-06-14 06:46:41 +01:00
Michael Platings
edc1130c0a [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
2023-06-14 06:46:41 +01:00
Michael Platings
b4eebc8674 [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
2023-06-14 06:46:41 +01:00
Michael Platings
a794ab92b4 [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
2023-06-14 06:46:41 +01:00
Michael Platings
4794bdab7a [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
2023-06-14 06:46:40 +01:00
Kirill Stoimenov
fba9fd1afa [HWASAN] Implement munmap interceptor for HWASAN
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D152763
2023-06-14 05:36:12 +00:00
Wang Rui
06cdc6f9ce [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
2023-06-14 13:23:54 +08:00
Chuanqi Xu
d8a36b00d1 [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
2023-06-14 12:45:34 +08:00
Fabio D'Urso
bd96d7b81f [scudo] Fix bound checks in MemMap and ReservedMemory methods
Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D152690
2023-06-14 03:55:54 +00:00
Jonas Devlieghere
1ae6a782f0
[lldb] Fix Debugger whitespace and formatting (NFC)
Remove trailing whitespace and fix formatting.
2023-06-13 20:50:30 -07:00
Jonas Devlieghere
d132b854b3
[lldb] Include <atomic> in LLDBAssert 2023-06-13 20:50:29 -07:00
Jonas Devlieghere
83a6a0a620
[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
2023-06-13 20:46:33 -07:00
Valentin Clement
cf875caaa3
[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
2023-06-13 20:44:22 -07:00
Valentin Clement
5923e46fce
[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
2023-06-13 20:33:36 -07:00
Valentin Clement
e6d8598e13
[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
2023-06-13 20:32:23 -07:00
Kelvin Li
99794e2239 [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.
2023-06-13 23:17:59 -04:00
Nico Weber
4de67143ba [gn] Fix case of directory I added in 9239cde390 2023-06-13 20:08:43 -07:00
Nico Weber
9239cde390 [gn build] Port 2700da5fe2 (lld/unittests etc) 2023-06-13 19:45:34 -07:00
Craig Topper
f9d0bf0631 Revert "[RISCV] Fold binary op into select if profitable."
This reverts commit d018958463.

Build failures have been reported in the Linux kernel.
2023-06-13 18:17:36 -07:00
Noah Goldstein
91cdffcb2f [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
2023-06-13 20:08:35 -05:00
Noah Goldstein
b7f34cea5a [InstCombine] Add tests for (binop (binop (lshift X,Amt),Mask),(lshift Y,Amt)); NFC
Differential Revision: https://reviews.llvm.org/D152567
2023-06-13 20:08:35 -05:00
Matt Arsenault
a09f79d227 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.
2023-06-13 20:44:00 -04:00
Matt Arsenault
cdcbef1b14 DAG: Fix typo in GET_FPENV legality check
This made GET_FPENV unusable since the DAG builder would always emit
the mem version.
2023-06-13 20:10:21 -04:00
Philip Reames
4a779a9b75 [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.
2023-06-13 17:07:59 -07:00
Diego Caballero
77a5ea2e67 [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
2023-06-13 23:55:15 +00:00
Vasileios Porpodas
9d5466849a [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
2023-06-13 16:52:36 -07:00
Johannes Doerfert
bed6a6e7e0 [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.
2023-06-13 16:49:56 -07:00
Philip Reames
d8562e27e0 [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
2023-06-13 16:26:37 -07:00
Johannes Doerfert
6d8f14f001 [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
2023-06-13 16:21:56 -07:00