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
Kirill Stoimenov [Sat, 14 Jan 2023 18:23:39 +0000 (18:23 +0000)]
[HWASAN][Fuchsia] Fixed Fuchsia build.
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D141771
Roman Lebedev [Sat, 14 Jan 2023 16:35:42 +0000 (19:35 +0300)]
[NFC][Codegen][X86] Improve test coverage for wide shift legalization
James Le Cuirot [Sat, 7 Jan 2023 13:52:39 +0000 (13:52 +0000)]
[llvm] Don't require third-party components when cross-compiling
It is possible to build LLVM with just the "llvm" and "cmake" components
checked out. This requires disabling the `LLVM_INCLUDE_BENCHMARKS` and
`LLVM_INCLUDE_TESTS` options. These options are not passed through to
the native build when cross-compiling though, so the build will break if
the "third-party" component is missing. We don't need the benchmarks or
tests for the native build, so disable these unconditionally. This fixes
cross-compiling on Gentoo, where only the required components are
checked out.
Differential Revision: https://reviews.llvm.org/D141196
Markus Böck [Sat, 14 Jan 2023 16:41:15 +0000 (17:41 +0100)]
[mlir][tblgen] Fix undefined behaviour found by MSVC debug iterators
Incrementing past the end iterator of any container in C++ is immediate undefined behaviour.
This is guaranteed to occur in the loop condition due to the expression cur = earlyIncIt++, which when earlyIncIt is the end iterator (aka we just did the last iteration of the loop), will do an increment on the end iterator.
To fix this, the patch refactors the loop to a more conventional loop using iterators, with the only difference being that the increment happens through the erase operation, which conveniently returns an iterator to the element after the erased element. Thanks to that guarantee there is also no need to use std::list over std::vector.
I also opted to reduce the inner loop find_if, because I felt splitting the "search" and the effects of if it was successful made the code (subjectively) nicer, and also avoided having to add an extra "bool erased" to the outer loop body.
Differential Revision: https://reviews.llvm.org/D141758
Haojian Wu [Sat, 14 Jan 2023 16:46:39 +0000 (17:46 +0100)]
Fix a -Wgnu-designator warning, NFC.
Roman Lebedev [Sat, 14 Jan 2023 15:55:24 +0000 (18:55 +0300)]
[Codegen][LegalizeIntegerTypes] New legalization strategy for scalar shifts: shift through stack
https://reviews.llvm.org/D140493 is going to teach SROA how to promote allocas
that have variably-indexed loads. That does bring up questions of cost model,
since that requires creating wide shifts.
Indeed, our legalization for them is not optimal.
We either split it into parts, or lower it into a libcall.
But if the shift amount is by a multiple of CHAR_BIT,
we can also legalize it throught stack.
The basic idea is very simple:
1. Get a stack slot 2x the width of the shift type
2. store the value we are shifting into one half of the slot
3. pad the other half of the slot. for logical shifts, with zero, for arithmetic shift with signbit
4. index into the slot (starting from the base half into which we spilled, either upwards or downwards)
5. load
6. split loaded integer
This works for both little-endian and big-endian machines:
https://alive2.llvm.org/ce/z/YNVwd5
And better yet, if the original shift amount was not a multiple of CHAR_BIT,
we can just shift by that remainder afterwards: https://alive2.llvm.org/ce/z/pz5G-K
I think, if we are going perform shift->shift-by-parts expansion more than once,
we should instead go through stack, which is what this patch does.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140638
Simon Pilgrim [Sat, 14 Jan 2023 15:24:35 +0000 (15:24 +0000)]
[X86] vector-reduce-and-bool.ll - add 'is allones' test coverage
Tomas Matheson [Fri, 9 Dec 2022 11:36:06 +0000 (11:36 +0000)]
[AArch64] Reland "Improve TargetParser API"
Reworked after several other major changes to the TargetParser since
this was reverted. Combined with several other changes.
Inline calls for the following macros and delete AArch64TargetParser.def:
AARCH64_ARCH, AARCH64_CPU_NAME, AARCH64_CPU_ALIAS, AARCH64_ARCH_EXT_NAME
Squashed changes from D139278 and D139102.
Differential Revision: https://reviews.llvm.org/D138792
Simon Pilgrim [Sat, 14 Jan 2023 14:02:17 +0000 (14:02 +0000)]
[X86] Add SSE/AVX1/AVX2 + f16/f32 test coverage to splat(fpext) tests
As discussed on D141657
Mehdi Amini [Sat, 14 Jan 2023 04:52:46 +0000 (04:52 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in IntRangeOptimizations.cpp (NFC)
Kazu Hirata [Sat, 14 Jan 2023 09:34:49 +0000 (01:34 -0800)]
[mlir] Remove remaining uses of llvm::Optional (NFC)
This patch removes one "using" declaration and #include
"llvm/ADT/Optional.h". It keeps several "using" declarations in
headers for downstream users.
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 09:25:58 +0000 (01:25 -0800)]
[mlir] 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 08:37:18 +0000 (00:37 -0800)]
[InstCombine] Add test coverage for (icmp sgt/sle (1 << Y), 0). NFC"
We already optimize the sgt case to (icmp ne Y, BitWidth-1), but
we miss optimizing sle because it canonicalizes to (icmp slt (1 << X), 1)
first.
Craig Topper [Sat, 14 Jan 2023 08:37:01 +0000 (00:37 -0800)]
Revert "[InstCombine] Add test coverage for (icmp slt/sge (1 << Y), 0). NFC"
This reverts commit
e25f2287dd7d6854b0bbfb9878fecdbbad21038d.
I messed up the predicates in the description.
Craig Topper [Sat, 14 Jan 2023 08:31:14 +0000 (00:31 -0800)]
[InstCombine] Add test coverage for (icmp slt/sge (1 << Y), 0). NFC
We already optimize the slt case to (icmp eq Y, BitWidth-1), but
we miss optimizing sge because it canonicalizes to (icmp sgt (1 << X), 1)
first.
Craig Topper [Sat, 14 Jan 2023 06:57:36 +0000 (22:57 -0800)]
[CodeGen][Target] Remove uses of Register::isPhysicalRegister/isVirtualRegister. NFC
Use isPhysical/isVirtual methods.
Phoebe Wang [Sat, 14 Jan 2023 03:18:56 +0000 (11:18 +0800)]
[X86] Do not lower INSERT_VECTOR_ELT to vselect for vXf16 without BWI
We cannot handle i8/i16/f16 vselect without BWI.
Fixes #59980
Reviewed By: RKSimon, skan
Differential Revision: https://reviews.llvm.org/D141668
NAKAMURA Takumi [Sat, 14 Jan 2023 06:12:20 +0000 (15:12 +0900)]
JITLink/ELF_i386.cpp: Fix a warning in D141746. [-Wswitch]
Kirill Stoimenov [Sat, 14 Jan 2023 04:19:46 +0000 (20:19 -0800)]
[LSAN][Fuchsia] Added ForEachExtraThreadStackRange to support Fuchsia code.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141724
Kazu Hirata [Sat, 14 Jan 2023 05:05:06 +0000 (21:05 -0800)]
[mlir] 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
Kshitij Jain [Sat, 14 Jan 2023 01:31:43 +0000 (01:31 +0000)]
Fixes handling logic for i386/ELF GOTPC relocation
The i386/ELF JITLink backend was not correctly handling the GOTPC relocation
by skipping the in-built addend, which was manifesting itself in the form of
a segmentation fault in the `LF_external_to_absolute_conversion.s` test. This
CR has fixed that issue.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D141746