Siva Chandra Reddy [Sun, 27 Feb 2022 22:15:21 +0000 (22:15 +0000)]
[libc] Add a class "Atomic" as a simple equivalent of std::atomic.
Only the methods currently required by the libc have been added.
Most of the existing uses of atomic operations have been switched over
to this new class. A future change will clean up the rest of uses.
This change now allows building mutex and condition variable code with a
C++ compiler which does not have stdatomic.h, for example g++.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D120642
Kiran Chandramohan [Mon, 28 Feb 2022 23:39:22 +0000 (23:39 +0000)]
[Flang] NFC: Changes to adhere to coding guidelines
This patch includes some changes which brings the code in line with
llvm coding guidelines.
-> Remove curlies for one line if statements.
-> Remove else after return.
-> Removes a few usage of auto.
-> Add Doxygen comments
Addresses post review comments in D120403 by @schweitz.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D120657
not-jenni [Mon, 28 Feb 2022 23:30:13 +0000 (15:30 -0800)]
Adds a flag to optionally disable tosa decompositions
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D120338
Peter Klausler [Fri, 11 Feb 2022 17:44:47 +0000 (09:44 -0800)]
[flang] Catch I/O of bad derived type at compile time
Derived types with allocatable and pointer components cannot
be used in I/O data transfer statements unless they have defined
I/O procedures available (as type-bound or regular generics).
These cases are caught as errors by the I/O runtime library,
but it would be better if they were flagged during compilation.
(Address comment in review: don't use explicit name string lengths.)
Differential Revision: https://reviews.llvm.org/D120675
Jonas Devlieghere [Mon, 28 Feb 2022 23:31:54 +0000 (15:31 -0800)]
Revert "[Support] Allow the ability to change WithColor's auto detection function"
This reverts commit
a83cf7a84628a9e3a24cfd33c69f786cf74df4ec because it
breaks a bunch of build bots.
Hsiangkai Wang [Sat, 26 Feb 2022 02:39:48 +0000 (02:39 +0000)]
[AArch64][SME] Add rdsvl instruction
This patch adds support for the following SME instruction:
* RDSVL
The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-12
Differential Revision: https://reviews.llvm.org/D120603
Hsiangkai Wang [Fri, 25 Feb 2022 08:57:45 +0000 (08:57 +0000)]
[AArch64][SME] Add addsvl and addspl instructions
This patch adds support for the following SME instructions:
* ADDSPL, ADDSVL
The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-12
Differential Revision: https://reviews.llvm.org/D120554
Okwan Kwon [Tue, 22 Feb 2022 21:50:14 +0000 (21:50 +0000)]
[mlir] Match Arithmetic::ConstantOp and Tensor::ExtractSliceOp.
Add a pattern matcher for ExtractSliceOp when its source is a constant.
The matching heuristics can be governed by the control function since
generating a new constant is not always beneficial.
Differential Revision: https://reviews.llvm.org/D119605
Jonas Devlieghere [Mon, 28 Feb 2022 21:59:19 +0000 (13:59 -0800)]
[Support] Allow the ability to change WithColor's auto detection function
WithColor has an "auto detection mode" which looks whether the
corresponding whether the corresponding cl::opt is enabled or not. While
this is great when opting into cl::opt, it's not so great for downstream
users of this utility, which might have their own competing options to
enable or disable colors. The WithColor constructor takes a color mode,
but the big benefit of the class are its static error and warning
helpers and default error handlers.
In order to allow users of this utility to enable or disable colors
globally, this patch adds the ability to specify a global auto detection
function. By default, the auto detection function behaves the way that
it does today. The benefit of this patch lies in that it can be
overwritten. In addition to a ability to change the auto detection
function, I've also made it possible to get your hands on the default
auto detection function, so you swap it back if if you so desire.
This patch allow downstream users (like LLDB) to globally disable colors
with its own command line flag.
Differential revision: https://reviews.llvm.org/D120593
Clint Caywood [Mon, 28 Feb 2022 22:28:11 +0000 (17:28 -0500)]
Use __builtin_clz to find leading 1 in generic sqrt (where possible)
__builtin_clz requires just a single instruction on x86 and arm, so this is a performance improvement.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D120579
LLVM GN Syncbot [Mon, 28 Feb 2022 22:24:55 +0000 (22:24 +0000)]
[gn build] Port
Louis Dionne [Thu, 17 Feb 2022 16:19:45 +0000 (11:19 -0500)]
[libc++abi] Install the libc++abi headers from libc++abi
libc++abi should be responsible for installing its own headers, it
doesn't make sense for libc++ to be responsible for it.
Differential Revision: https://reviews.llvm.org/D101458
Louis Dionne [Mon, 28 Feb 2022 22:05:35 +0000 (17:05 -0500)]
[libc++][NFC] Fix typo in comment
Louis Dionne [Mon, 28 Feb 2022 22:03:55 +0000 (17:03 -0500)]
[libc++][NFC] Remove unused Lit feature in the test suite
Lei Zhang [Mon, 28 Feb 2022 21:43:03 +0000 (16:43 -0500)]
[mlir][linalg] Enhance FoldInsertPadIntoFill to support op chain
If we have a chain of `tensor.insert_slice` ops inserting some
`tensor.pad` op into a `linalg.fill` and ranges do not overlap,
we can also elide the `tensor.pad` later.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D120446
Lei Zhang [Mon, 28 Feb 2022 21:34:46 +0000 (16:34 -0500)]
[mlir][linalg] Fold tensor.pad when inserting into linalg.fill
Fold tensor.insert_slice(tensor.pad(<input>), linalg.fill) into
tensor.insert_slice(<input>, linalg.fill) if the padding value and
the filling value are the same.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D120410
Martin Storsjö [Tue, 18 Jan 2022 09:48:27 +0000 (09:48 +0000)]
[libcxx] [test] Fix the monetary locale curr_symbol test on Windows, Apple and FreeBSD
International currency symbols (like USD, EUR) are returned with a
trailing space, like "USD ", on previously supported Unix platforms.
On Windows, the locales return them without a trailing space.
Also adjust the test for expecting a different unicode sequence for
the national currency symbol for ru_RU.UTF-8 and zh_CN.UTF-8.
Differential Revision: https://reviews.llvm.org/D120547
Yaxun (Sam) Liu [Fri, 25 Feb 2022 05:03:36 +0000 (00:03 -0500)]
[HIP] File device library ABI version file name
It should be oclc_abi_version* instead of abi_version*.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D120557
Philip Reames [Mon, 28 Feb 2022 21:17:35 +0000 (13:17 -0800)]
[SLP] Check invariant that all instructions in bundle are in same block [NFC]
Scott Linder [Mon, 28 Feb 2022 20:20:25 +0000 (20:20 +0000)]
[YAMLParser] Add multi-line literal folding support
Last year I was working at Swift to add support for [Localization of Compiler Diagnostic Messages](https://forums.swift.org/t/localization-of-compiler-diagnostic-messages/36412/41). We are currently using YAML as the new diagnostic format. The LLVM::YAMLParser didn't have a support for multiline string literal folding and it's crucial to have that for the diagnostic message to help us keep up with the 80 columns rule. Therefore, I decided to add a multiline string literal folding support to the YAML parser.
Patch By: @HassanElDesouky (Hassan ElDesouky)
Differential Revision: https://reviews.llvm.org/D102590
Jorge Gorbe Moya [Mon, 28 Feb 2022 20:52:43 +0000 (12:52 -0800)]
[NFC] Don't pass temporary LangOptions to Lexer
Since https://reviews.llvm.org/D120334, passing a temporary LangOptions
object to Lexer results in stack-use-after-scope.
Arthur Eubanks [Mon, 28 Feb 2022 17:30:42 +0000 (09:30 -0800)]
[docs] Add note about interaction between clang plugins and -clear-ast-before-backend
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D120666
Craig Topper [Mon, 28 Feb 2022 20:46:31 +0000 (12:46 -0800)]
[RISCV] Only enable combineROTR_ROTL_RORW_ROLW with Zbp.
I think the immediate values we check for on the GREV nodes already
protect this, but better to be explicit.
Valentin Clement [Mon, 28 Feb 2022 20:37:18 +0000 (21:37 +0100)]
[flang][NFC] Add complex operations lowering tests
Just adds some lowering test for complex operations. These were not
added when the lowering landed.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D120672
Dávid Bolvanský [Mon, 28 Feb 2022 20:20:59 +0000 (21:20 +0100)]
[Clang] noinline call site attribute
Motivation:
```
int foo(int x, int y) { // any compiler will happily inline this function
return x / y;
}
int test(int x, int y) {
int r = 0;
[[clang::noinline]] r += foo(x, y); // for some reason we don't want any inlining here
return r;
}
```
In 2018, @kuhar proposed "Introduce per-callsite inline intrinsics" in https://reviews.llvm.org/D51200 to solve this motivation case (and many others).
This patch solves this problem with call site attribute. The implementation is "smaller" wrt approach which uses new intrinsics and thanks to https://reviews.llvm.org/D79121 (Add nomerge statement attribute to clang), we have got some basic infrastructure to deal with attrs on statements with call expressions.
GCC devs are more inclined to call attribute solution as well, as builtins are problematic for them - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104187. But they have no patch proposal yet so.. We have free hands here.
If this approach makes sense, next future steps would be support for call site attributes for always_inline / flatten.
Reviewed By: aaron.ballman, kuhar
Differential Revision: https://reviews.llvm.org/D119061
Erich Keane [Mon, 28 Feb 2022 20:13:16 +0000 (12:13 -0800)]
[NFC] Make 1st param to getTemplateInstantiationArgs const correct
The function doesn't modify anything, and took minimal effort to get
const-correct, AND is necessary for a patch I've been working on for
concepts.
LLVM GN Syncbot [Mon, 28 Feb 2022 20:01:32 +0000 (20:01 +0000)]
[gn build] Port
a3255f219a86
Arthur O'Dwyer [Thu, 2 Dec 2021 00:55:26 +0000 (19:55 -0500)]
[libc++] Explicitly reject `uniform_int_distribution<bool>` and `<char>`.
`uniform_int_distribution<T>` is UB unless `T` is one of the non-character,
non-boolean integer types (`short` or larger). However, libc++ has never
enforced this. D114129 accidentally made `uniform_int_distribution<bool>`
into an error. Make it now *intentionally* an error; and likewise for the
character types and all user-defined class and enum types; but permit
`__[u]int128_t` to continue working.
Apply the same static_assert to all the integer distributions.
Differential Revision: https://reviews.llvm.org/D114920
Arthur O'Dwyer [Fri, 18 Feb 2022 16:36:59 +0000 (11:36 -0500)]
[libc++] [ranges] Permit std::mergeable and std::sortable with HAS_NO_INCOMPLETE_RANGES.
This follows the general direction of D118736 that
`_LIBCPP_HAS_NO_INCOMPLETE_RANGES` does *not* guard anything outside
of the `std::ranges::` namespace itself. This means we must permit
`ranges::less` etc. in no-ranges mode; that seems fine to me.
Differential Revision: https://reviews.llvm.org/D120139
Dawid Jurczak [Mon, 28 Feb 2022 19:14:44 +0000 (20:14 +0100)]
[NFC] Don't pass temporary LangOptions to Lexer
Since https://reviews.llvm.org/D120334 we shouldn't pass temporary LangOptions to Lexer.
This change fixes stack-use-after-scope UB in LocalizationChecker found by sanitizer-x86_64-linux-fast buildbot
and resolve similar issue in HeaderIncludes.
Stanislav Mekhanoshin [Thu, 24 Feb 2022 19:13:46 +0000 (11:13 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle flat load/stores
TODO: merge flat with global promoting to flat.
Differential Revision: https://reviews.llvm.org/D120351
Fangrui Song [Mon, 28 Feb 2022 19:19:00 +0000 (11:19 -0800)]
[ELF] Change some non-null pointer parameters to references. NFC
To decrease difference for D120650. Also, rename some `OutputSection *sec` (and
`cmd`) to the more common `osec`.
Haowei Wu [Fri, 28 Jan 2022 23:30:43 +0000 (15:30 -0800)]
[doc] Add llvm-ifs commandline guide
This patch adds llvm-ifs commandline guide
Differential Review: https://reviews.llvm.org/D118514
Okwan Kwon [Mon, 28 Feb 2022 19:11:29 +0000 (19:11 +0000)]
Revert "[mlir] Fold Arithmetic::ConstantOp and Tensor::ExtractSliceOp."
This reverts commit
3104994104f0c2f274acf5e01eb6cc82e9cca06b.
Sanjay Patel [Mon, 28 Feb 2022 17:13:55 +0000 (12:13 -0500)]
[InstCombine] fold mul-with-overflow intrinsic with -1 operand
extractvalue (any_mul_with_overflow X, -1), 0 --> -X
There are similar other potential transforms that we could do as
noted by the last TODO in the test diffs.
Fixes #54053
Andrei Elovikov [Mon, 28 Feb 2022 17:46:51 +0000 (09:46 -0800)]
[NFC][LoopVectorizer] Simplify LoopVectorize/X86/gather_scatter.ll
The test used to run whole O3 pipeline. Modify it to contain LLVM IR right
before LV and limit passes to "-loop-vectorizer -simplifycfg".
For the RUN line with forced VF force interleave factor as well to simplify
CHECKs as interleaving isn't related to the purpose of the test.
I also tried to add "noalias" to pointer arguments in
@test_gather_not_profitable_pr48429 but LAI seems unable to use them.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D119786
Craig Topper [Mon, 28 Feb 2022 18:53:35 +0000 (10:53 -0800)]
[RISCV] Don't call combineROTR_ROTL_RORW_ROLW for SLLW/SRLW/SRAW nodes. NFC
I think the function does the correct thing internally, but it's
confusing to read.
Chia-hung Duan [Mon, 28 Feb 2022 18:21:28 +0000 (18:21 +0000)]
[mlir-tblgen] Fix non-deterministic generating static verifier in DRR.
Use SetVector instead of DenseSet to ensure we always generate the same
name for the same function. This issue is found in
https://github.com/llvm/llvm-project/issues/53768.
Reviewed By: quinnp, rdzhabarov
Differential Revision: https://reviews.llvm.org/D120514
Joseph Huber [Mon, 28 Feb 2022 18:14:54 +0000 (13:14 -0500)]
[OpenMP] Add verbose output for linker wrapper
Summary;
This path adds printing support for the linker wrapper. When the user
passes `-v` it will not print the commands used by the linker wrapper to
indicate to the user what is happening during the linking.
Fangrui Song [Mon, 28 Feb 2022 18:25:21 +0000 (18:25 +0000)]
[ELF] Rename Symbol::compare to shouldReplace. NFC
The return value is not a boolean instead of a tri-state.
Suggested by Peter Smith in D120640.
Konstantin Varlamov [Mon, 28 Feb 2022 17:55:27 +0000 (12:55 -0500)]
[libc++] Fix double file closing in `std::filesystem::remove_all()`.
According to Linux documentation (see e.g. https://linux.die.net/man/3/closedir):
> A successful call to `closedir()` also closes the underlying file
> descriptor associated with `dirp`.
Thus, calling `close()` after a successful call to `closedir()` is at
best redundant. Worse, should a different thread open a file in-between
the calls to `closedir()` and `close()` and get the same file descriptor,
the call to `close()` might actually close a different file than was
intended.
rdar://
89251874
Differential Revision: https://reviews.llvm.org/D120453
Okwan Kwon [Tue, 22 Feb 2022 21:50:14 +0000 (21:50 +0000)]
[mlir] Fold Arithmetic::ConstantOp and Tensor::ExtractSliceOp.
Fold ExtractSliceOp when the source is a constant.
luxufan [Tue, 22 Feb 2022 10:56:32 +0000 (18:56 +0800)]
[JITLink] Add R_RISCV_SUB6 relocation
Add R_RISCV_SUB6 relocation
Differential Revision: https://reviews.llvm.org/D120001
Craig Topper [Mon, 28 Feb 2022 17:30:27 +0000 (09:30 -0800)]
[RISCV] Custom type legalize i32 ISD::ABS on RV64 without Zbb.
Default type legalization will create sext_inreg+abs, but we may
not be able to remove the sext_inreg.
Instead this patch expands abs during type legalization to
Y = sraiw X, 31; subw(xor X, Y), Y) which doesn't require the input
to be sign extended.
This gives a big improvement for some neg-abs tests where the
abs is used more than the the neg. Previously the abs was expanded
a different way before and after type legalization. Now they are
expanded in a similar way enabling more CSE.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D120636
Arthur O'Dwyer [Sun, 27 Feb 2022 15:36:25 +0000 (10:36 -0500)]
[clang] Remove unused variable AllElementsInt.
This has been unused ever since it was committed in
b8a501ccf1.
Differential Revision: https://reviews.llvm.org/D120629
Sanjay Patel [Mon, 28 Feb 2022 17:03:11 +0000 (12:03 -0500)]
[InstCombine] fold select-of-zero-or-ones with negated op
(X u< 2) ? -X : -1 --> sext (X != 0)
(X u> 1) ? -1 : -X --> sext (X != 0)
https://alive2.llvm.org/ce/z/U3y5Bb
https://alive2.llvm.org/ce/z/hgi-4p
This is part of solving:
Sanjay Patel [Mon, 28 Feb 2022 16:20:02 +0000 (11:20 -0500)]
[InstCombine] add tests for select of zero or all ones; NFC
See #54053
Sanjay Patel [Mon, 28 Feb 2022 14:21:23 +0000 (09:21 -0500)]
[InstCombine] add tests for mul-with-overflow by -1; NFC
Erich Keane [Mon, 28 Feb 2022 15:03:55 +0000 (07:03 -0800)]
Clarify documentation of cpu_dispatch/cpu_specific
There has been some internal confusion lately as to how cpu_dispatch and
cpu_specific dispatch to processors, so this patch clarifies the
documentation to make it more clear that:
1- Unlike ICC, we do not consider the vendor string (that is, an AMD
processor might result in something other than generic)
2- there are some processors that aren't really distinguishable thanks
to the library limitation, so the variant being selected is unspecified.
In reality, I believe the 'stable_sort' makes it so the 1st one that
meets the requirements is the one that is selected (and that matches my
experimented result), but I don't want to limit our implementation.
Alexey Bataev [Tue, 22 Feb 2022 21:50:17 +0000 (13:50 -0800)]
[SLP]Improve bottom-to-top reordering.
Currently bottom-to-top reordering analysis counts orders of the
operands and then adds natural order counts for the operand users. It is
very conservative, this the user nodes themselves may require
reordering. Patch improves bottom-to-top analysis by checking for the
user nodes if they require/allows the reordring. If the user node must
be reordered, has reused scalars, is an alternate op vectorization node,
is a non-ordered gather node or may allow reordering because of the
reordered operands, such node is considered as the node that allows
reodring and is not counted as a node with the natural order.
Differential Revision: https://reviews.llvm.org/D120492
Dawid Jurczak [Fri, 25 Feb 2022 11:07:33 +0000 (12:07 +0100)]
[NFC][Lexer] Make Lexer::LangOpts const reference
This change can be seen as code cleanup but motivation is more performance related.
While browsing perf reports captured during Linux build we can notice unusual portion of instructions executed in std::vector<std::string> copy constructor like:
0.59% 0.58% clang-14 clang-14 [.] std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::vector
or even:
1.42% 0.26% clang clang-14 [.] clang::LangOptions::LangOptions
|
--1.16%--clang::LangOptions::LangOptions
|
--0.74%--std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::vector
After more digging we can see that relevant LangOptions std::vector members (*Files, ModuleFeatures and NoBuiltinFuncs)
are constructed when Lexer::LangOpts field is initialized on list:
Lexer::Lexer(..., const LangOptions &langOpts, ...)
: ..., LangOpts(langOpts),
Since LangOptions copy constructor is called by Lexer(..., const LangOptions &LangOpts,...) and local Lexer objects are created thousands times
(in Lexer::getRawToken, Preprocessor::EnterSourceFile and more) during single module processing in frontend it makes std::vector copy constructors surprisingly hot.
Unfortunately even though in current Lexer implementation mentioned std::vector members are unused and most of time empty,
no compiler is smart enough to optimize their std::vector copy constructors out (take a look at test assembly): https://godbolt.org/z/hdoxPfMYY even with LTO enabled.
However there is simple way to fix this. Since Lexer doesn't access *Files, ModuleFeatures, NoBuiltinFuncs and any other LangOptions fields (but only LangOptionsBase)
we can simply get rid of redundant copy constructor assembly by changing LangOpts type to more appropriate const LangOptions reference: https://godbolt.org/z/fP7de9176
Additionally we need to store LineComment outside LangOpts because it's written in SkipLineComment function.
Also FormatTokenLexer need to be adjusted a bit to avoid lifetime issues related to passing local LangOpts reference to Lexer.
After this change I can see more than 1% speedup in some of my microbenchmarks when using Clang release binary built with LTO.
For Linux build gains are not so significant but still nice at the level of -0.4%/-0.5% instructions drop.
Differential Revision: https://reviews.llvm.org/D120334
Nikita Popov [Mon, 28 Feb 2022 14:25:03 +0000 (15:25 +0100)]
[InlineCost] Use SmallPtrSet for DeadBlocks (NFC)
This set is only used with contains operations, so there is no
need to use a SetVector.
Archibald Elliott [Fri, 25 Feb 2022 18:39:34 +0000 (18:39 +0000)]
[NFC][Clang][AArch64] Clean up AArch64TargetInfo::hasFeature
Sander de Smalen [Mon, 28 Feb 2022 12:17:25 +0000 (12:17 +0000)]
[AArch64][SVE] Fold away SETCC if original input was predicate vector.
This adds the following two folds:
Fold 1:
setcc_merge_zero(
all_active, extend(nxvNi1 ...), != splat(0))
-> nxvNi1 ...
Fold 2:
setcc_merge_zero(
pred, extend(nxvNi1 ...), != splat(0))
-> nxvNi1 and(pred, ...)
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D119334
Florian Hahn [Mon, 28 Feb 2022 14:12:20 +0000 (14:12 +0000)]
Recommit "[VPlan] Introduce recipe to build scalar steps."
This reverts the revert commit
ff93260bf6bddfbad1fa65c4d5184988885b900f.
The underlying issue causing the PPC bot failures has been fixed in
cbaac1473403 and a corresponding test case has been added in
ad2cad1c521c.
Original message:
This patch adds a new VPScalarIVStepsRecipe to handle building scalar
steps.
In the first patch, it only handles the case where there is no vector
induction variable needed.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D115953
Timm Bäder [Mon, 28 Feb 2022 06:45:35 +0000 (07:45 +0100)]
[clang][tests] Fix ve-toolchain tests with CLANG_DEFAULT_UNWINDLIB
Otherwise, the driver will insert e.g. -lgcc_s when
CLANG_DEFAULT_UNWINDLIB=libgcc is set during the clang build.
Differential Revision: https://reviews.llvm.org/D120644
Valentin Clement [Mon, 28 Feb 2022 13:48:40 +0000 (14:48 +0100)]
[flang] Lower power operations
Lower the power operation for real, integer
and complex.
The power operation is lowered to library calls.
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D120403
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D120556
Momchil Velikov [Mon, 28 Feb 2022 11:51:17 +0000 (11:51 +0000)]
[AArch64] Async unwind - function prologues
This patch rearranges emission of CFI instructions, so the resulting
DWARF and `.eh_frame` information is precise at every instruction.
The current state is that the unwind info is emitted only after the
function prologue. This is fine for synchronous (e.g. C++) exceptions,
but the information is generally incorrect when the program counter is
at an instruction in the prologue or the epilogue, for example:
```
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
mov x29, sp
.cfi_def_cfa w29, 16
...
```
after the `stp` is executed the (initial) rule for the CFA still says
the CFA is in the `sp`, even though it's already offset by 16 bytes
A correct unwind info could look like:
```
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
...
```
Having this information precise up to an instruction is useful for
sampling profilers that would like to get a stack backtrace. The end
goal (towards this patch is just a step) is to have fully working
`-fasynchronous-unwind-tables`.
Reviewed By: danielkiss, MaskRay
Differential Revision: https://reviews.llvm.org/D111411
Adrian Kuegel [Mon, 28 Feb 2022 12:17:34 +0000 (13:17 +0100)]
[mlir] Apply ClangTidy performance fixes (NFC)
Sander de Smalen [Mon, 28 Feb 2022 11:32:05 +0000 (11:32 +0000)]
[AArch64][SVE] Handle more cases in findMoreOptimalIndexType.
This patch addresses @paulwalker-arm's comment on D117900 to
only update/write the by-ref operands iff the function returns
true. It also handles a few more cases where a series of added
offsets can be folded into the base pointer, rather than just looking
at a single offset.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D119728
David Spickett [Mon, 28 Feb 2022 11:56:07 +0000 (11:56 +0000)]
[compiler-rt] Disable coverage trace pc guard tests on Thumb
These are failing on our silent bot:
https://lab.llvm.org/staging/#/builders/162/builds/358
$ <run cmd>
main
foo
bar
baz
SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard-dso.cpp.tmp.2122517.sancov: 2 PCs written
SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard-dso.cpp.tmp_2.so.2122517.sancov: 1 PCs written
SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard-dso.cpp.tmp_1.so.2122517.sancov: 1 PCs written
$ <sancov cmd>
ERROR: Coverage points in binary and .sancov file do not match.
Also reproduces if you build for Thumb on v8 hardware.
Doesn't fail when built with Arm only code so I guess the Thumb mode bit
in the PCs might be the issue.
gysit [Mon, 28 Feb 2022 11:25:12 +0000 (11:25 +0000)]
[mlir][linalg] Check the iterator types are valid.
Improve the LinalgOp verification to ensure the iterator types is known. Previously, unknown iterator types have been ignored without warning, which can lead to confusing bugs.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D120649
Florian Hahn [Mon, 28 Feb 2022 11:14:21 +0000 (11:14 +0000)]
[LV] Remove induction recipes only used outside vector loop.
Exit values of vector inductions are generated completely independent of
the induction recipes. Consider them for removal, if they are not used
in loop.
This fixes a crash exposed by
49b23f451cf7130.
David Green [Mon, 28 Feb 2022 10:58:52 +0000 (10:58 +0000)]
Partially revert "[SchedModels][CortexA55] Add ASIMD integer instructions"
The Cortex-A55 scheduling model is used for -mcpu=generic, meaning it
can have a wider effect than just the A55. The changes to the A55
scheduling model seems to have caused performance regressions on
Cortex-A510 device which have latencies closer to the original and
different forwarding paths.
This partially reverts the changes from D117003, at least until we can
do something to improve Cortex-A510. According to my results, this
improves the A510 results without altering the A55 very much.
Luis Penagos [Mon, 28 Feb 2022 10:30:30 +0000 (11:30 +0100)]
[clang-format] Treat && followed by noexcept operator as a binary operator inside template arguments
Fixes https://github.com/llvm/llvm-project/issues/44544.
Reviewed By: curdeius, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D120445
Adrian Kuegel [Mon, 28 Feb 2022 10:52:39 +0000 (11:52 +0100)]
[mlir] Remove unused static variables (NFC)
Florian Hahn [Mon, 28 Feb 2022 10:39:08 +0000 (10:39 +0000)]
[LV] Add test with dead induction in vector loop used outside.
Add test with a induction phi that is not used in the vector loop, but
by an lcssa phi in the loop exit.
Endre Fülöp [Mon, 21 Feb 2022 22:10:24 +0000 (23:10 +0100)]
[analyzer] Add more sources to Taint analysis
Add more functions as taint sources to GenericTaintChecker.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D120236
LLVM GN Syncbot [Mon, 28 Feb 2022 10:06:58 +0000 (10:06 +0000)]
[gn build] Port
61835d19a848
Nikita Popov [Thu, 24 Feb 2022 13:39:59 +0000 (14:39 +0100)]
[InstCombine] Remove not of SPF min/max fold (NFCI)
This should no longer be necessary now that we canonicalize to
intrinsics. Might not be strictly NFC due to worklist order.
esmeyi [Mon, 28 Feb 2022 09:59:46 +0000 (04:59 -0500)]
[llvm-objcopy] Initial XCOFF32 support.
Summary: This is an initial implementation of lvm-objcopy for XCOFF32.
Currently only supports simple copying, op-passthrough to follow.
Reviewed By: jhenderson, shchenz
Differential Revision: https://reviews.llvm.org/D97656
Nikita Popov [Thu, 24 Feb 2022 13:38:04 +0000 (14:38 +0100)]
[InstCombine] Remove sub of SPF min/max fold (NFCI)
This isn't necessary anymore, now that we canonicalize SPF min/max
to intrinsics. Might not be strictly NFC due to worklist order
changes.
Florian Hahn [Mon, 28 Feb 2022 09:46:18 +0000 (09:46 +0000)]
[LV] Add test with IV that needs scalar steps and user outside of loop.
Also add a run line to check interleaving only. This test covers the PPC
buildbot failures caused by
49b23f451cf71.
Nikita Popov [Mon, 28 Feb 2022 09:41:56 +0000 (10:41 +0100)]
[InstCombine] Don't call matchSAddSubSat() for SPF (NFC)
Only call it for intrinsic min/max. The moved implementation is
unchanged apart from the one-use check: It is now hardcoded to
one-use, without the two-use special case for SPF.
Nikita Popov [Mon, 28 Feb 2022 09:28:16 +0000 (10:28 +0100)]
[InstCombine] Remove SPF moveAddAfterMinMax() (NFC)
As SPF min/max is canonicalized to intrinsics before this point,
this change should be entirely NFC.
Nikita Popov [Thu, 24 Feb 2022 13:35:18 +0000 (14:35 +0100)]
[InstCombine] Remove SPF moveNotAfterMinMax() (NFC)
This happens after SPF -> intrinsic canonicalization, and as such
should be entirely NFC.
Nikita Popov [Thu, 24 Feb 2022 12:19:00 +0000 (13:19 +0100)]
[InstCombine] Remove SPF factorizeMinMaxTree() (NFC)
SPF integer min/max is canonicalized to min/max intrinsics before
this code is reached, so this should be entirely NFC.
Mehdi Amini [Mon, 28 Feb 2022 08:54:38 +0000 (08:54 +0000)]
Add explicit `this->` to access method in attempt to fix gcc5 build (NFC)
Shraiysh Vaishay [Mon, 28 Feb 2022 08:38:31 +0000 (14:08 +0530)]
[mlir][OpenMP][NFC] Removing unnecessary builders for wsloop
This patch removes the builders for `omp.wsloop` operation that aren't
specifically needed anywhere. We can add them later if the need arises.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D120533
Iain Sandoe [Sat, 1 May 2021 12:07:45 +0000 (13:07 +0100)]
[C++20][Modules][7/8] Find the primary interface name for a module.
When we are building modules, there are cases where the only way to determine
validity of access is by comparing primary interface names. This is because we need
to be able to associate a primary interface name with an imported partition, but
before the primary interface module is complete - so that textual comparison is
necessary.
If this turns out to be needed many times, we could cache the result, but it seems
unlikely to be significant (at this time); cases with very many imported partitions
would seem unusual.
Differential Revision: https://reviews.llvm.org/D118598
Fangrui Song [Mon, 28 Feb 2022 08:50:06 +0000 (00:50 -0800)]
[ELF] Replace an unneeded dyn_cast_or_null with dyn_cast. NFC
Fangrui Song [Mon, 28 Feb 2022 08:24:25 +0000 (00:24 -0800)]
[ELF] Optimize SectionBase::Kind values to make isa<InputSection> more efficient. NFC
Surprisingly my lld executable is 1.5KiB smaller.
Fangrui Song [Mon, 28 Feb 2022 08:16:45 +0000 (00:16 -0800)]
[ELF] Make InputSection::classof inline. NFC
Alexander Belyaev [Mon, 28 Feb 2022 07:47:01 +0000 (08:47 +0100)]
[mlir] Purge linalg.tiled_loop.
Differential Revision: https://reviews.llvm.org/D119415
Fangrui Song [Mon, 28 Feb 2022 07:28:51 +0000 (23:28 -0800)]
[ELF] Move SyntheticSection check from InputSection::writeTo to OutputSection::writeTo. NFC
Simplify code and make the heavyweight operation to the call site so that it is
clearer how to improve the inefficient scheduling in the future.
Ilya Nozhkin [Mon, 28 Feb 2022 06:27:32 +0000 (14:27 +0800)]
Set error message if ValueObjectRegister fails to write back to register
SetValueFromCString and SetData methods return false if register can't
be written but they don't set a error message. It sometimes confuses
callers of these methods because they try to get the error message in case of
failure but Status::AsCString returns nullptr.
For example, lldb-vscode crashes due to this bug if some register can't
be written. It invokes SBError::GetCString in case of error and doesn't
check whether the result is nullptr (see request_setVariable implementation in
lldb-vscode.cpp for more info).
Reviewed By: labath, clayborg
Differential Revision: https://reviews.llvm.org/D120319
eric.tang [Wed, 19 Jan 2022 02:44:23 +0000 (10:44 +0800)]
[RISCV] Support hypervisor extention instructions
According to privileged spec version-
20211203
Add the following hypervisor instructions:
- HLV.B HLV.BU
- HLV.H HLV.HU HLVX.HU
- HLV.W HLV.WU HLVX.WU
- HLV.D
- HSV.B HSV.H HSV.W HSV.D
Signed-off-by: eric.tang <eric.tang@starfivetech.com>
Differential Revision: https://reviews.llvm.org/D117733
eric.tang [Fri, 14 Jan 2022 07:14:16 +0000 (15:14 +0800)]
[RISCV] Support Sinval extension and hypervisor memory management fence instructions
According to Privileged spec version-
20211203
Add Supervisor Memory-Management Instructions:
- SINVAL.VMA, SFENCE.W.INVAL, SFENCE.INVAL.IR
Add Hypervisor Memory-Management Instructions:
- HFENCE.VVMA, HFENCE.GVMA, HINVAL.VVMA, HINVAL.GVMA
Signed-off-by: eric.tang <eric.tang@starfivetech.com>
Differential Revision: https://reviews.llvm.org/D117654
Eric Tang [Thu, 17 Feb 2022 05:54:57 +0000 (13:54 +0800)]
[RISCV] Change GPRMemAtomic to GPRMemZeroOffset for general usage
Not only some AMO instructions but also other instructions need to
process (${gpr}) or 0(${gpr}), where the 0 is be silently ignored.
This patch does some changes for general usage.
Signed-off-by: Eric Tang <eric.tang@starfivetech.com>
Differential Revision: https://reviews.llvm.org/D120017
Zi Xuan Wu [Mon, 28 Feb 2022 05:47:55 +0000 (13:47 +0800)]
[Support] Fix the build errors because missing CSKYTargetParser.def in module.modulemap of
21bce9007ae8
Add textual header "Support/CSKYTargetParser.def" in module.modulemap.
Build Failure: https://green.lab.llvm.org/green/job/lldb-cmake/41771
Zi Xuan Wu [Tue, 15 Feb 2022 07:26:39 +0000 (15:26 +0800)]
[Support] Add CSKY target parser and attributes parser
Construct LLVM Support module about CSKY target parser and attribute parser.
It refers CSKY ABIv2 and implementation of GNU binutils and GCC.
https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf
Now we only support CSKY 800 series cpus and newer cpus in the future undering CSKYv2 ABI specification.
There are 11 archs including ck801, ck802, ck803, ck803s, ck804, ck805, ck807, ck810, ck810v, ck860, ck860v.
Every arch has base extensions, the cpus of that arch family have more extended extensions than base extensions.
We need specify extended extensions for every cpu. Every extension has its enum value, name and related llvm feature string with +/-.
Every enum value represents a bit of uint64_t integer.
Differential Revision: https://reviews.llvm.org/D119917
Chenbing Zheng [Mon, 28 Feb 2022 01:43:04 +0000 (09:43 +0800)]
[RISCV] Optimize (sext.w, srli) to sraiw with Zba.
In this patch, we add a more narrower exclusion for
zeroext (srl x) -> srli (slli x), so that it provides an opportunity
for the selection of sraiw.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120467
Kai Luo [Mon, 28 Feb 2022 02:27:26 +0000 (02:27 +0000)]
[AIX][cmake][NFC] Customize name of output atomic library
Let `archive-aix-libatomic` accept additional argument to customize name of output atomic library.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D120534
Todd Mortimer [Mon, 28 Feb 2022 00:43:49 +0000 (19:43 -0500)]
[Driver][OpenBSD] Enable unwind tables on all architectures
Mehdi Amini [Sun, 27 Feb 2022 21:41:23 +0000 (21:41 +0000)]
Add explicit capture for `this` pointer in attempt to fix gcc5 build (NFC)
Fangrui Song [Sun, 27 Feb 2022 20:49:36 +0000 (20:49 +0000)]
[ELF] Enforce double-dash form --error-limit
It's ld.lld specific and by convention we enforce the double-dash form to avoid
collision with the short option -e (--entry).
Jessica Clarke [Sun, 27 Feb 2022 20:48:52 +0000 (20:48 +0000)]
[RISCV] Fix parseBareSymbol to not double-parse top-level operators
By failing to lex the token we end up both parsing it as a binary
operator ourselves and parsing it as a unary operator when calling
parseExpression on the RHS. For plus this is harmless but for minus this
parses "foo - 4" as "foo - -4", effectively treating a top-level minus
as a plus.
Fixes https://github.com/llvm/llvm-project/issues/54105
Reviewed By: asb, MaskRay
Differential Revision: https://reviews.llvm.org/D120635
Fangrui Song [Sun, 27 Feb 2022 20:47:37 +0000 (20:47 +0000)]
[ELF] Use --error-limit instead of -error-limit
Fangrui Song [Sun, 27 Feb 2022 20:33:28 +0000 (20:33 +0000)]
[ELF] Change global variable backwardReferences to a LinkerDriver member variable. NFC
Similar to whyExtract.
Fangrui Song [Sun, 27 Feb 2022 20:23:09 +0000 (20:23 +0000)]
[ELF] Move --print-archive-stats= and --why-extract= beside --warn-backrefs report
So that early errors don't suppress their output.