Guillaume Chatelet [Mon, 16 Jan 2023 12:43:52 +0000 (12:43 +0000)]
Deprecate Argument::getParamAlignment()
Florian Hahn [Mon, 16 Jan 2023 12:25:34 +0000 (12:25 +0000)]
[LoopUnroll] Don't update DT for changeToUnreachable.
There is no need to update the DT here, because there must be a unique
latch. Hence if the latch is not exiting it must directly branch back
to the original loop header and does not dominate any nodes.
Skipping a DT update here simplifies D141487.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D141810
Haojian Wu [Mon, 16 Jan 2023 12:13:20 +0000 (13:13 +0100)]
[bazel] Another blank-line format fix for the utils/bazel/configure.bzl, NFC
Sergey Kachkov [Mon, 16 Jan 2023 12:13:17 +0000 (15:13 +0300)]
Revert "[GVN] Refactor handling of pointer-select in GVN pass"
This reverts commit
fc7cdaa373308ce3d72218b4d80101ae19850a6c.
Zain Jaffal [Mon, 16 Jan 2023 12:04:39 +0000 (12:04 +0000)]
[AArch64] Add tests for dotreduce to check for wider vectors.
Currently we only reduce vector.reduce.add to sdot if the vectors are either <8 x i8> or <16 x i8>.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D141692
Max Kazantsev [Mon, 16 Jan 2023 11:53:34 +0000 (18:53 +0700)]
[JumpThreading] Preserve profile metadata during select unfolding, take 2
Jump threading can replace select and unconditional branch with
conditional branch, but when doing so loses profile information.
This destructive transform can eventually lead to a performance
degradation due to folding of branches in
shouldFoldCondBranchesToCommonDestination as branch probabilities
are no longer known.
The first version was reverted due to assert caused by i32 overflow,
fixed in this version.
Patch by Roman Paukner!
Differential Revision: https://reviews.llvm.org/D138132
Reviewed By: mkazantsev
Haojian Wu [Mon, 16 Jan 2023 11:57:57 +0000 (12:57 +0100)]
[bazel] Fix the format of utils/bazel/configure.bzl, NFC
Kerry McLaughlin [Mon, 16 Jan 2023 11:36:37 +0000 (11:36 +0000)]
[AArch64][SME] Add an instruction mapping for SME pseudos
Adds an instruction mapping to SMEInstrFormats which matches SME
pseudos with the real instructions they are transformed to.
A new flag is also added to AArch64Inst (SMEMatrixType), which is
used to indicate the base register required when emitting many
of the SME instructions.
This reduces the number of pseudos handled by the switch statement
in EmitInstrWithCustomInserter.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D136856
Jolanta Jensen [Tue, 10 Jan 2023 13:53:28 +0000 (13:53 +0000)]
[NFC] Fixed a typo in clang help docs
Fixed minor typo in clang help docs.
Differential Revision: https://reviews.llvm.org/D141507
Sven van Haastregt [Mon, 16 Jan 2023 11:32:12 +0000 (11:32 +0000)]
[OpenCL] Allow undefining header-only features
`opencl-c-base.h` always defines 5 particular feature macros for
SPIR-V, making it impossible to disable those features.
To allow disabling any of those features, let the header recognize
`__undef_<feature>` macros. The user can then pass the
`-D__undef_<feature>` flag on the command line to disable a specific
feature. The __undef macro could potentially also be set from
`-cl-ext=-feature`, but for now only change the header and only
provide __undef macros for the 5 features that are always enabled in
`opencl-c-base.h`.
Differential Revision: https://reviews.llvm.org/D141297
Utkarsh Saxena [Mon, 16 Jan 2023 06:29:38 +0000 (07:29 +0100)]
Add test for an invalid requirement in requires expr.
The one introduced in D140547 was brittle. Fixing max template depth to
a small value would still test the same issue without causing actual
stack exhaustion.
Differential Revision: https://reviews.llvm.org/D141818
Nikita Popov [Mon, 16 Jan 2023 11:03:29 +0000 (12:03 +0100)]
[Clang] Convert test to opaque pointers (NFC)
A very annoying update, because some but now all of the zero-index
GEPs are omitted with opaque pointers.
Sergey Kachkov [Thu, 22 Dec 2022 13:59:06 +0000 (16:59 +0300)]
[GVN] Refactor handling of pointer-select in GVN pass
This patch introduces new type of memory dependency - Select to
consistently handle it like Def/Clobber dependency.
Differential Revision: https://reviews.llvm.org/D141619
Markus Böck [Sun, 15 Jan 2023 13:52:05 +0000 (14:52 +0100)]
[mlir][NFC] Set `useFoldAPI` to `kEmitRawAttributesFolder` value for some dialects missed previously
Found these while working on https://reviews.llvm.org/D141604. These were previously not found due to the old implementation only emitting warnings if an Op has a `fold`.
Changing these values both avoid the deprecation warning and if new `fold`s were added to ops of these dialects, that they are already using the new API.
Differential Revision: https://reviews.llvm.org/D141795
David Green [Mon, 16 Jan 2023 10:44:38 +0000 (10:44 +0000)]
[AArch64] Sink to umull if we know tops bits are zero.
This is an extension to the code for sinking splats to multiplies, where
if we can detect that the top bits are known-zero we can treat the
instruction like a zext. The existing code was also adjusted in the
process to make it more precise about only sinking if both operands are
zext or sext.
Differential Revision: https://reviews.llvm.org/D141275
Florian Hahn [Mon, 16 Jan 2023 10:23:51 +0000 (10:23 +0000)]
[VPlan] Use VPDef prefix for VPDef IDs instead of VPRecipeBase (NFC).
Various places in the code where still using the VPRecipeBase:: prefix
for VPDef IDs or not prefix at all. Now that the VPDef IDs have been
moved to VPDef, use this prefix instead and consistently use it.
Max Kazantsev [Mon, 16 Jan 2023 09:49:54 +0000 (16:49 +0700)]
[SCEV][NFC] Make computeExitLimitFromCond public
Make it available for external use.
Differential Revision: https://reviews.llvm.org/D141457
Reviewed By: lebedev.ri
Matt Devereau [Fri, 16 Dec 2022 11:19:28 +0000 (11:19 +0000)]
[AArch64][InstCombine] Simplify repeated complex patterns in dupqlane
Repeated floating-point complex patterns in dupqlane such as (f32 a, f32 b, f32
a, f32 b) can be simplified to shufflevector(f64(a, b), undef, 0)
Benjamin Kramer [Mon, 16 Jan 2023 09:37:53 +0000 (10:37 +0100)]
Partially revert
931d04be2fc8
This change makes StringRefTest fail in some configuration. Might be a
standard library issue or miscompile.
Timm Bäder [Mon, 16 Jan 2023 07:39:37 +0000 (08:39 +0100)]
[clang][Interp][NFC] Use range for loop
David Spickett [Fri, 28 Oct 2022 09:13:13 +0000 (09:13 +0000)]
[LLDB] Fix help text for "platform settings"
This claims to take a platform name argument but doesn't.
That was probably the intent in
fbb7634934d40548b650574a2f2a85ab41527674
but it has only ever worked with the current platform.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D136928
Nikita Popov [Mon, 16 Jan 2023 09:27:46 +0000 (10:27 +0100)]
[WebAssembly] Convert test to opaque pointers (NFC)
This test was testing both typed and opaque pointers. Remove the
typed pointer check lines, and update the input IR to use opaque
pointers. Note that with opaque pointers, the "bitcast" is not
explicit, but rather just a mismatch in function type between
the call and the declaration.
Nikita Popov [Mon, 16 Jan 2023 09:26:11 +0000 (10:26 +0100)]
[WebAssembly] Remove redundant opaque pointers test (NFC)
add-prototype.ll has since been converted.
Nikita Popov [Mon, 16 Jan 2023 09:20:21 +0000 (10:20 +0100)]
[LoongArch] Convert tests to opaque pointers (NFC)
Haojian Wu [Fri, 13 Jan 2023 10:39:00 +0000 (11:39 +0100)]
[include-cleaner] FindHeaders respects IWYU export pragma for standard headers.
Fixes https://github.com/llvm/llvm-project/issues/59927
Differential Revision: https://reviews.llvm.org/D141670
Chuanqi Xu [Mon, 16 Jan 2023 08:58:13 +0000 (16:58 +0800)]
Add Release Notes and Doc for -fmodule-output
As the summary explained in https://reviews.llvm.org/D137058,
the design of `-fmodule-output` changes relatively frequently
so I skipped the release notes and docs for -fmodule-output in the
the patches. And the patches get accepted and landed. The patch adds
the related release notes and docs.
Yingchi Long [Mon, 16 Jan 2023 08:52:50 +0000 (16:52 +0800)]
Revert "[C2x] reject type definitions in offsetof"
This reverts commit
e327b52766ed497e4779f4e652b9ad237dfda8e6.
Valentin Clement [Mon, 16 Jan 2023 08:37:38 +0000 (09:37 +0100)]
[flang] Switch spread first argument lowering from asAddr to asBox
Use asBox so no simply contiguous argument do not issue a copy and also
support polymorphic entity out of the box.
Depends on D141667
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141678
Valentin Clement [Mon, 16 Jan 2023 08:36:28 +0000 (09:36 +0100)]
[flang] Update createTempMutableBox to support polymorphic entities
When creating temporary from a polymorphic entity, its dynamic type
information must be carried over to the temporary.
This patch updates createTempMutableBox to support passing a source_box
from which the information will be carried over.
This is tested on the spread intrinsic and follow-up patches will updates
other temporary creation where needed.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141667
Jean Perier [Mon, 16 Jan 2023 08:20:54 +0000 (09:20 +0100)]
[flang][NFC] centralize FreeMemOp generation in IntrinsicCall.cpp
The current intrinsic call lowering contains a lot of repetitive
patterns when it comes to dealing with temporary allocatable
results allocated by the runtime that need to be dereferenced and
for which a clean-up (free) must be scheduled in the StatementContext.
For HLFIR lowering, I will need to deal with the clean-up in a different
way since the results will be "moved" into expression nodes and
the clean-up will be inserted in bufferization after the last hlfir.expr
usage. Centralizing the clean-up code will make that easier, and is
regardless of this motivation a quality improvement.
Some static helpers had to be moved to IntrinsicBuilder method so that
they could call the readAndAddCleanUp code.
Differential Revision: https://reviews.llvm.org/D141669
Lorenzo Chelini [Fri, 13 Jan 2023 16:32:34 +0000 (17:32 +0100)]
[MLIR] Fix tiling for `tensor.unpack` with outer permutations
An outer dim permutation requires adjusting the offsets and sizes of the
`tensor.extract_slice` operations generated during tiling. Originally
this was done by computing an inverse permutation of the outer
permutation for both `tensor.pack` and `tensor.unpack`. For packing, the
tiling is applied on interchanged dimensions; thus, it is correct to
compute the inverse. For unpacking, on the other hand, tiling involves
the output tensor that does not have interchanged dimensions, and no
inverse is required.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D141688
Saagar Jha [Mon, 16 Jan 2023 07:38:41 +0000 (23:38 -0800)]
[lldb] Fix comments referring to BCR_M_IMVA_MATCH
It seems like these were copied from the single-step code and not
updated to match the new flags.
Differential revision: https://reviews.llvm.org/D141816
Pierre van Houtryve [Mon, 16 Jan 2023 07:28:08 +0000 (02:28 -0500)]
[AMDGPU] Regenerate extend-phi-subrange-not-in-parent.mir
Craig Topper [Mon, 16 Jan 2023 07:10:42 +0000 (23:10 -0800)]
[RISCV] Invert an if statement in lowerSELECT to reduce nesting. NFC
The if body returned at the end and contained more code than what
came after it. Reverse the condition and move the simpler code from
the end of the function into the new if body.
Chuanqi Xu [Mon, 16 Jan 2023 07:08:14 +0000 (15:08 +0800)]
[NFC] [Modules] Add test from PR60036
Although I failed to reproduce the problem in pr60036, it should be
always good to have more tests.
Lang Hames [Mon, 16 Jan 2023 06:24:49 +0000 (22:24 -0800)]
[ORC-RT] Fix a typo in file header.
Chuanqi Xu [Mon, 16 Jan 2023 06:07:58 +0000 (14:07 +0800)]
[Driver] [C++20] [Modules] Don't emit unused-argument warning for '-fmodule-output' and '-fmodule-output='
Suppres the r unused-argument warning for -fmodule-output according to
the discussion thread in
https://gcc.gnu.org/pipermail/gcc/2022-December/240239.html.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D140001
Chuanqi Xu [Mon, 16 Jan 2023 03:21:57 +0000 (11:21 +0800)]
[Driver] [C++20] [Modules] Support -fmodule-output= (2/2)
The patch implements `-fmodule-output=`. This is helpful if the build
systems want to generate these output files in other places which is not
the same with -o specified or the input file lived.
Reviewed By: dblaikie, iains
Differential Revision: https://reviews.llvm.org/D137059
Chuanqi Xu [Mon, 16 Jan 2023 05:42:36 +0000 (13:42 +0800)]
[NFC] Only run clang/test/Driver/module-output.cppm on x86 registered targets
On other targets (like ppc64-aix), the default output for `-c` may be `.s` instead of `.o`,
which makes the test failing. The patch require the test only run on
x86 registered targets to avoid the problem.
Mahesh Ravishankar [Tue, 6 Dec 2022 06:24:54 +0000 (06:24 +0000)]
[mlir][TilingInterface] NFC: Separate out a utility method to perform one step of tile + fuse.
Differential Revision: https://reviews.llvm.org/D141027
Mahesh Ravishankar [Tue, 6 Dec 2022 06:07:05 +0000 (06:07 +0000)]
[mlir][TilingInterface] NFC: Consolidate yield handling.
Add a new utility method to yield the tiled value as well as
preserving destination passing style.
Differential Revision: https://reviews.llvm.org/D139392
Mahesh Ravishankar [Wed, 4 Jan 2023 20:32:18 +0000 (20:32 +0000)]
[mlir] Add a method to `RewriteBase` to replace a `Value` selectively.
This method allows to selectively control from the caller when to
replace the uses of a `Value`. Still notifies the rewriter that the
user is updated in-place.
Differential Revision: https://reviews.llvm.org/D141026
wangpc [Mon, 16 Jan 2023 03:07:34 +0000 (11:07 +0800)]
[RISCV] Generate march string from target features
As what has been mentioned in D137517, this patch is to simplify
processors definitions in RISCV.td. We don't have to specify march
string since we can generate it from target features.
Reviewed By: fpetrogalli, kito-cheng
Differential Revision: https://reviews.llvm.org/D141479
Chuanqi Xu [Mon, 16 Jan 2023 03:39:04 +0000 (11:39 +0800)]
[NFC] Require tests to skip on windows to avoid handling the different
slash in the filesystem
The modified test fails on windows for the diffeent slash direction ('/'
in linux and '/' on windows). The patch requires the test to skip on
windows to avoid such differences.
Craig Topper [Mon, 16 Jan 2023 02:55:15 +0000 (18:55 -0800)]
[InstCombine] Remove dead code from foldICmpShlOne. NFC
This code handles (icmp eq/ne (1 << Y), C) if C is a power of 2.
This case is also handled by the more general foldICmpShlConstConst
which is called before we reach foldICmpShlOne.
Chuanqi Xu [Wed, 28 Dec 2022 05:48:08 +0000 (13:48 +0800)]
[Driver] [Modules] Support -fmodule-output (1/2)
Patches to support the one-phase compilation model for modules.
The behavior:
(1) If -o and -c is specified , the module file is in the same path
within the same directory as the output the -o specified and with a new
suffix .pcm.
(2) Otherwise, the module file is in the same path within the working
directory directory with the name of the input file with a new suffix
.pcm
For example,
```
Hello.cppm Use.cpp
```
A trivial one and the contents are ignored. When we run:
```
clang++ -std=c++20 -fmodule-output Hello.cppm -c
```
The directory would look like:
```
Hello.cppm Hello.o Hello.pcm Use.cpp
```
And if we run:
```
clang++ -std=c++20 -fmodule-output Hello.cppm -c -o output/Hello.o
```
Then the `output` directory may look like:
```
Hello.o Hello.pcm
```
Reviewed By: dblaikie, iains, tahonermann
Differential Revision: https://reviews.llvm.org/D137058
Amaury Séchet [Sun, 15 Jan 2023 21:53:46 +0000 (21:53 +0000)]
[DAG] Recombine (binop (shift x y))
This helps address regressions in D127115 .
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D141809
Freddy Ye [Mon, 16 Jan 2023 02:18:04 +0000 (10:18 +0800)]
[X86] Add AVX512FP16 test coverage to splat(fpext) tests.
Benjamin Kramer [Mon, 16 Jan 2023 00:43:35 +0000 (01:43 +0100)]
[FuncitonComparator] Clamp StringRef compare output to [-1,1]
The comparison can have different values (but same sign) on big endian
platforms, avoid that to make the unit test green there.
Roman Lebedev [Sun, 15 Jan 2023 21:52:06 +0000 (00:52 +0300)]
[NFC][X86] Improve test coverage for shuffles-of-shifts
Craig Topper [Sun, 15 Jan 2023 21:36:57 +0000 (13:36 -0800)]
[InstCombine] Generalize (icmp sgt (1 << Y), -1) -> (icmp ne Y, BitWidth-1) to any negative constant.
Similar for the sle version which will be canonicalized to slt first.
Alive2 proof as implemented: https://alive2.llvm.org/ce/z/_YawdM
@spatel's original Alive2: https://alive2.llvm.org/ce/z/3YB2vs
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D141773
Roman Lebedev [Sun, 15 Jan 2023 18:45:32 +0000 (21:45 +0300)]
[NFC][X86] Add tests for splat-in-disguise of shift-by-imm of splat
Roman Lebedev [Sun, 15 Jan 2023 18:36:34 +0000 (21:36 +0300)]
[NFC][TargetLowering] `isSplatValueForTargetNode()`: add `DAG` operand
Without it we can't recurse further.
Benjamin Kramer [Sun, 15 Jan 2023 20:39:31 +0000 (21:39 +0100)]
Benjamin Kramer [Sun, 15 Jan 2023 19:58:09 +0000 (20:58 +0100)]
[ADT] Forward some StringRef::find overloads to std::string_view
These are identical in terms of functionality and performance (checked
libc++ and libstdc++). We could do the same for rfind, but that actually
has a off-by one on its position argument.
StringRef::find(StringRef) seems to be quite a bit more optimized than
the standard library one, so leave it alone.
Benjamin Kramer [Sun, 15 Jan 2023 19:56:34 +0000 (20:56 +0100)]
[ADT] Make StringRef::compare like std::string_view::compare
string_view has a slightly weaker contract, which only specifies whether
the value is bigger or smaller than 0. Adapt users accordingly and just
forward to the standard function (that also compiles down to memcmp)
Johannes Doerfert [Sun, 15 Jan 2023 19:28:03 +0000 (11:28 -0800)]
[OpenMP][JIT] Introduce more debugging configuration options
The JIT is a great debugging tool since we can modify the IR manually
before launching it in an existing test case. The new flasks allow to
skip optimizations, to use the exact given IR, as well as to provide a
finished object file. The latter is useful to try out different backend
options and to have complete freedom with pass pipelines.
Documentation is included. Minimal refactoring was performed to make the
second object fit in nicely.
Johannes Doerfert [Wed, 4 Jan 2023 19:33:44 +0000 (11:33 -0800)]
[OpenMP][JIT] Cleanup JIT interface, caching, and races
The JIT interface was somewhat irregular as it used multiple global
functions. It also did not cache the results of the JIT, hence multiple
GPU systems would perform the work multiple times. Finally, there might
have been races on the state if we have multi-threaded initialization of
different embedded images, or one image initialized on multiple devices.
This patch tries to rectify all of the above. The JITEngine is now a
part of the GenericPluginTy and tied to one target triple. To support
multiple "ComputeUnitKind"s (previously confusingly called Arch or
[M]CPU) and to avoid re-jitting for the same ComputeUnitKind, we keep a
map of JIT results per ComputeUnitKind. All interaction with the JIT
happens through the JITEngine directly, two functions are exposed. Both
use (shared) locks to avoid races and cache the result. All JIT-related
environment variables are now defined together.
Differential Revision: https://reviews.llvm.org/D141081
Johannes Doerfert [Wed, 28 Dec 2022 06:02:47 +0000 (22:02 -0800)]
[OpenMP][NFC] Introduce helper functions to hide casts and such
Differential Revision: https://reviews.llvm.org/D140719
Saagar Jha [Sun, 15 Jan 2023 19:09:27 +0000 (11:09 -0800)]
[lldb] Fix typos and update "GDB To LLDB Command Map" to be a bit more clear
I've gone through the GDB To LLDB Command Map and tried to improve it:
- Fix obvious typos (e.g. <cope> → <code>)
- Wrap code and program names in <code> tags
- Reword a couple parts where (IMHO) the phrasing could be a bit better
Differential revision: https://reviews.llvm.org/D28758
Roman Lebedev [Sun, 15 Jan 2023 17:20:44 +0000 (20:20 +0300)]
[DAGCombiner] `combineShuffleOfSplatVal()`: try to canonicalize to a splat shuffle
As noted in https://reviews.llvm.org/D141778#inline-1369900,
we fail to produce splat shuffles from certain sequences
of shuffles, that may have non-shuffles in the middle of seq.
There is a big pitfail to avoid here: just because `isSplatValue()`
says that all demanded elements are splat, we can't pick any random
one of them, because some of them could be undef! We must ignore those!
LLVM GN Syncbot [Sun, 15 Jan 2023 17:42:57 +0000 (17:42 +0000)]
[gn build] Port
94461822c75d
Matt Arsenault [Fri, 13 Jan 2023 21:15:52 +0000 (16:15 -0500)]
DAG: Avoid stack lowering if bitcast has an illegal vector result type
A bitcast of <10 x i32> to <5 x i64> was ending up on the
stack. Instead of doing that, handle the case where the new type
doesn't evenly divide but the elements do. Extract the individual
elements and pad with undef.
Avoids stack usage for bitcasts involving <5 x i64>. In some of these
cases, later optimizations actually eliminated the stack objects but
left behind the unused temporary stack object to final emission.
Fixes: SWDEV-377548
Hui Xie [Fri, 4 Nov 2022 11:53:38 +0000 (11:53 +0000)]
[libc++][ranges] implement `std::views::elements_view`
`subrange` is also a `tuple-like`. To avoid the add entire `subrange` dependencies to `tuple-like`, we need forward declaration of `subrange`. However, the class template constraints of `subrange` currently requires `__iterator/concepts.h`, which requires `<concepts>`. The problem is that currently `tuple-like` is used in several different places, including libc++ extension for pair constructors. we don't want to add `<concepts>` to pair and other stuff. So this change also created several small headers that `subrange`'s declaration needed inside `__iterator/concepts/`
Differential Revision: https://reviews.llvm.org/D136268
Chris Lattner [Sun, 15 Jan 2023 06:05:54 +0000 (22:05 -0800)]
[MLIR] Simplify predicate in Matchers.h, NFC
The ConstantLike trait already static_asserts that operations
implementing it have a single result and zero operands, so we
don't need to redundantly check in Matchers.h
The static assert is in `class ConstantLike` in OpDefinition.h
Differential Revision: https://reviews.llvm.org/D141783
Markus Böck [Sun, 15 Jan 2023 13:52:14 +0000 (14:52 +0100)]
[mlir][ods] Rework how transitive use of deprecated defs are handled
The code currently attempting to recursively find uses of a deprecated def has a few deficiences:
* It recurses into all def uses. This is problematic as it also causes any users of a def using a deprecated def, to be considered deprecated, causing a transitive chain of deprecated defs (see `H_ButNotTransitivelyInNonAnonymousDef` in test case for reproducer)
* It did not recurse into other kinds of fields, such as list and DAGs
This patch fixes the issue by reworking the code to properly recurse into inits and not to recurse into def uses unless they are anonymous defs. Since inits (including DAG, List and anonymous defs) are uniqued, the memoization is kept and remains profitable.
Differential Revision: https://reviews.llvm.org/D141794
Kazu Hirata [Sun, 15 Jan 2023 17:13:26 +0000 (09:13 -0800)]
[Support] clang-format partMSBpartMSB and partLSB (NFC)
Kazu Hirata [Sun, 15 Jan 2023 17:04:57 +0000 (09:04 -0800)]
Use the default parameters of countTrailingZeros and find{First,Last}Set (NFC)
This patch uses the default parameters of countTrailingZeros,
findFirstSet, and findLastSet, which are ZB_Width, ZB_Max, and ZB_Max,
respectively.
Matt Arsenault [Tue, 21 Jul 2020 23:10:01 +0000 (19:10 -0400)]
GlobalISel: Enable CSE for G_SEXT_INREG
Simon Pilgrim [Sun, 15 Jan 2023 15:43:19 +0000 (15:43 +0000)]
[X86] Move isShuffleMaskInputInPlace to allow additional uses in a future patch. NFCI.
A future patch needs isShuffleMaskInputInPlace defined earlier in the source file.
Matt Arsenault [Sun, 4 Dec 2022 04:24:01 +0000 (23:24 -0500)]
ValueTracking: Teach CannotBeOrderedLessThanZero about rounding intrinsics
These should obviously preserve the sign although the variety of these
always confuses me.
Roman Lebedev [Sun, 15 Jan 2023 14:22:55 +0000 (17:22 +0300)]
[NFC][X86] Ensure we don't manage to produce broadcast-from-mem in subvec splat-store tests
https://godbolt.org/z/jfx8jvPba
Roman Lebedev [Sun, 15 Jan 2023 13:49:50 +0000 (16:49 +0300)]
[NFC][X86] Add subvector splat-store tests
https://godbolt.org/z/oGn7KqrKs
Mark de Wever [Sat, 14 Jan 2023 15:46:15 +0000 (16:46 +0100)]
[NFC][libc++] Removes uneeded std:: prefixes.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D141766
Paul Walker [Wed, 4 Jan 2023 00:08:35 +0000 (00:08 +0000)]
[SVE][CGBuiltins] Remove need for instcombine from ACLE tests.
The SVE builtins tests rely on optimisations to remove clutter from
the resulting IR that is not relevant to the tests. However, with
the increasing number of target intrinsic combines the clang tests
are moving further away from verifying what is relevant to clang.
During early SVE (or rather scalable vector) bringup, we chose to
mitigate bugs by minimising our usage of LLVM IR instructions then
later implemented the combines to lower the calls to generic IR once
scalable vector support had matured. With the mitigations no longer
required and the combines mostly trivial I have moved the logic into
CGBuiltins, which allows the existing tests to remain unchanged once
they stop using instcombine.
The optimisations include:
* Using shifts in place of multiplies by power-of-two values.
* Don't emit getelementptrs when offset is zero.
* Use IR based vector splats rather than calls to dup_x.
* Use IR based vector selects rather than calls to sel.
* Use i64 based indices for insertelement.
The test changes are the result of "sed -i -e 's/instcombine,//'",
with the exception of acle_sve_dupq.c which required regeneration
due to its previous reliance on a zext->tunc->zext combine.
The following tests still rely on instcombine because they require
changes beyond CGBuiltin.cpp:
CodeGen/aarch64-sve-intrinsics/acle_sve_clasta.c
CodeGen/aarch64-sve-intrinsics/acle_sve_clastb.c
CodeGen/aarch64-sve-intrinsics/acle_sve_cntb.c
CodeGen/aarch64-sve-intrinsics/acle_sve_cntd.c
CodeGen/aarch64-sve-intrinsics/acle_sve_cnth.c
CodeGen/aarch64-sve-intrinsics/acle_sve_cntw.c
CodeGen/aarch64-sve-intrinsics/acle_sve_dup-bfloat.c
CodeGen/aarch64-sve-intrinsics/acle_sve_dup.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1-bfloat.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sb.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sh.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1sw.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ub.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1uh.c
CodeGen/aarch64-sve-intrinsics/acle_sve_ld1uw.c
CodeGen/aarch64-sve-intrinsics/acle_sve_len-bfloat.c
CodeGen/aarch64-sve-intrinsics/acle_sve_len.c
CodeGen/aarch64-sve-intrinsics/acle_sve_rdffr.c
CodeGen/aarch64-sve-intrinsics/acle_sve_sel-bfloat.c
CodeGen/aarch64-sve-intrinsics/acle_sve_sel.c
CodeGen/aarch64-sve-intrinsics/acle_sve_st1-bfloat.c
CodeGen/aarch64-sve-intrinsics/acle_sve_st1.c
CodeGen/aarch64-sve-intrinsics/acle_sve_st1b.c
CodeGen/aarch64-sve-intrinsics/acle_sve_st1h.c
CodeGen/aarch64-sve-intrinsics/acle_sve_st1w.c
Tests within aarch64-sve2-intrinsics don't use opt but instead use
-O1 to cleanup their output. These tests remain unchanged and will
be visited by a later patch.
Depends on D140983
Differential Revision: https://reviews.llvm.org/D141056
Sergei Barannikov [Sun, 15 Jan 2023 07:31:07 +0000 (10:31 +0300)]
[CodeGen] Replace CCValAssign::Loc with std::variant (NFCI)
The motivation behind this change is as follows.
Targets with stack growing up (there are no such in-tree targets) pass
arguments at negative offsets relative to the stack pointer. This makes
it hard to use the generic value assigner because CCValAssign stores the
offset as an unsigned integer, which is then zero-extended when
converted to int64_t, e.g. when passing to `CreateFixedObject`. This
results in conversion of, for example, -4 into
4294967292, which is not
desired.
While it is possible to insert a cast to `int` before passing the result
of `getLocMemOffset` into `CreateFixedObject` in backend code, this is
error-prone, and some uses of `getLocMemOffset` are located in
places common to all backends (e.g. `CallLowering::handleAssignments`).
That said, I wanted to change the type of the memory offset from
`unsigned` to `int64_t` (this would be consistent with other places
where stack offsets are used). However, the `Loc` field which stores the
offset is shared between three different kinds of the location:
register, memory, and "pending". Storing a register number as `int64_t`
does not seem right (there are `Register` and `MCRegister` for this), so
I did the most straightforward change - replaced the `Loc` field with
std::variant.
The main change that changes the type of the memory offset from
`unsigned` to `int64_t` will be in a follow-up patch to simplify the
review.
Reviewed By: MaskRay, nikic
Differential Revision: https://reviews.llvm.org/D136043
Luo, Yuanke [Sun, 15 Jan 2023 04:19:36 +0000 (12:19 +0800)]
[X86] Add test case for folding select on vXi1
Kazu Hirata [Sun, 15 Jan 2023 05:10:14 +0000 (21:10 -0800)]
[libc] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sun, 15 Jan 2023 04:56:10 +0000 (20:56 -0800)]
[cross-project-tests] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sun, 15 Jan 2023 04:52:00 +0000 (20:52 -0800)]
[libc] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sun, 15 Jan 2023 04:22:48 +0000 (20:22 -0800)]
[libc] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Roman Lebedev [Sun, 15 Jan 2023 01:34:01 +0000 (04:34 +0300)]
[NFC][X86][Codegen] Extend tests for splat-storing the same scalar to memory
Looking at the changes, we might or might not care about the vector width
https://godbolt.org/z/7zfzThnYG
Roman Lebedev [Sun, 15 Jan 2023 00:49:16 +0000 (03:49 +0300)]
[NFC][X86][Codegen] Add tests for splat-storing the same scalar to memory
Kazu Hirata [Sun, 15 Jan 2023 00:37:11 +0000 (16:37 -0800)]
[flang] Do not include llvm/ADT/Optional.h (NFC)
Kazu Hirata [Sat, 14 Jan 2023 23:26:28 +0000 (15:26 -0800)]
[gtest] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Keith Smiley [Fri, 13 Jan 2023 22:17:07 +0000 (14:17 -0800)]
[lld-macho] Improve invalid fat binary warning
This nearly mirrors ld64's error for this case:
ld: warning: ignoring file path/to/file, file is universal (armv7,arm64) but does not contain the x86_64 architecture: path/to/file
Differential Revision: https://reviews.llvm.org/D141729
Fangrui Song [Sat, 14 Jan 2023 23:20:53 +0000 (15:20 -0800)]
Remove deleted file from module map
Kazu Hirata [Sat, 14 Jan 2023 23:09:00 +0000 (15:09 -0800)]
[llvm] Include <optional> instead of "llvm/ADT/Optional.h" (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Sat, 14 Jan 2023 22:06:18 +0000 (14:06 -0800)]
Remove redundant initialization of std::optional (NFC)
Kazu Hirata [Sat, 14 Jan 2023 21:53:40 +0000 (13:53 -0800)]
Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Sat, 14 Jan 2023 21:37:25 +0000 (13:37 -0800)]
[clang] Remove remaining uses of llvm::Optional (NFC)
This patch removes several "using" declarations and #include
"llvm/ADT/Optional.h".
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Simon Pilgrim [Sat, 14 Jan 2023 20:09:28 +0000 (20:09 +0000)]
[X86] Add absolute-difference vector tests
X86 doesn't have absdiff instructions, but we should be able to canonicalize to avoid unnecessary scalarization/extensions/selects
Simon Pilgrim [Sat, 14 Jan 2023 19:36:33 +0000 (19:36 +0000)]
[X86] Add absolute-difference scalar tests
X86 doesn't have absdiff instructions, but we should be able to canonicalize to avoid unnecessary extensions/selects
Tom Praschan [Fri, 30 Dec 2022 11:28:29 +0000 (12:28 +0100)]
[clangd] Hover: show CalleeArgInfo for literals and expressions
This is very useful when inlay hints are disabled.
Also, improve presentation of Hover when variable is passed by value to
a function with an unnamed parameter
Differential Revision: https://reviews.llvm.org/D140775
Andrew Savonichev [Wed, 11 Jan 2023 17:48:06 +0000 (20:48 +0300)]
[NVPTX] Drop memory references of LDG/LDU
This patch fixes machine verifier errors:
*** Bad machine code: Missing mayLoad flag ***
- function: foo1
- basic block: %bb.0 (0x5560fc64ef08)
- instruction: %4:float32regs =
INT_PTX_LDG_GLOBAL_f32areg64 killed %3:int64regs
:: (load (s32) from %ir.from1, addrspace 1)
mayLoad flag is missing because LDG and LDU instructions operate on
read-only memory, so we want to treat them as regular instructions and
exclude them from memory analysis.
Machine verifier checks for memoperands to determine whether an
instruction is a load, so dropping them during lowering fixes the
problem.
Differential Revision: https://reviews.llvm.org/D112466
Kazu Hirata [Sat, 14 Jan 2023 20:31:01 +0000 (12:31 -0800)]
[clang] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<. I'll post
a separate patch to remove #include "llvm/ADT/Optional.h".
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Craig Topper [Sat, 14 Jan 2023 19:18:47 +0000 (11:18 -0800)]
[InstCombine] Optimize (icmp slt (1 << Y), 1) -> (icmp eq Y, BitWidth-1).
The code tried to do this for (icmp sle (1 << Y), 0), but that is
canonicalized to sgt before we get there.
Simplify the code by removing the unreachable SGE and SLE handling.
Also remove the (1 << Y) >=u
2147483648 and (1 << Y) <u
2147483648
handling since those are canonicalized to (1 << Y) <s 0 and
(1 << Y) >=s 0 before we get there.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D141753
Kazu Hirata [Sat, 14 Jan 2023 19:07:21 +0000 (11:07 -0800)]
[clang] Add #include <optional> (NFC)
This patch adds #include <optional> to those files containing
llvm::Optional<...> or Optional<...>.
I'll post a separate patch to actually replace llvm::Optional with
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Carlos Galvez [Sat, 14 Jan 2023 17:40:54 +0000 (17:40 +0000)]
[clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folder
Fix applied by running:
run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces
Differential Revision: https://reviews.llvm.org/D141770
Simon Pilgrim [Sun, 1 Jan 2023 13:11:51 +0000 (13:11 +0000)]
[X86] Fix SLM uops/resources counts for XADD/XCHG reg-reg instructions
The RMW instructions still need addressing, probably with a new 'WriteXCHGRMW' scheduler class.
Based off llvm-exegesis captures, confirmed with Agner + uops.info