peter klausler [Thu, 1 Apr 2021 19:59:59 +0000 (12:59 -0700)]
[flang] Implement numeric intrinsic functions in runtime
Adds APIs, implementations, and unit tests for AINT, ANINT,
CEILING, EXPONENT, FLOOR, FRACTION, MOD, MODULO, NEAREST, NINT,
RRSPACING, SCALE, SET_EXPONENT, & SPACING.
Differential Revision: https://reviews.llvm.org/D99764
Tom Stellard [Thu, 1 Apr 2021 04:35:04 +0000 (21:35 -0700)]
llvm-shlib: Create object libraries for each component and link against them
This makes it possible to build libLLVM.so without first creating a
static library for each component. In the case where only libLLVM.so is
built (i.e. ninja LLVM) this eliminates 150 linker jobs.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D95727
Philip Reames [Thu, 1 Apr 2021 21:45:14 +0000 (14:45 -0700)]
[funcattrs] Respect nofree attribute on callsites (not just callee)
Fangrui Song [Thu, 1 Apr 2021 21:37:34 +0000 (14:37 -0700)]
[Driver] -nostdinc -nostdinc++: don't warn for -Wunused-command-line-argument
Craig Topper [Thu, 1 Apr 2021 21:07:04 +0000 (14:07 -0700)]
[RISCV] Add isel patterns to handle vrsub intrinsic with 2 vector operands.
This occurs when we type legalize an i64 scalar input on RV32. We
need to manually splat, which requires a vector input. Rather
than special case this in lowering just pattern match it.
Philip Reames [Thu, 1 Apr 2021 20:58:13 +0000 (13:58 -0700)]
[tests] Add tests for forthcoming funcattrs nosync inference improvement
These are basically all the attributor tests for the same attribute with some minor cleanup for readability and autogened.
Jian Cai [Thu, 1 Apr 2021 19:22:50 +0000 (12:22 -0700)]
Reland "Add support to -Wa,--version in clang""
This relands commit
3cc3c0f8352ec33ca2f2636f94cb1d85fc57ac16 with fixed
test cases, which was reverted by commit
bf2479c347c8ca88fefdb144d8bae0a7a4231e2a.
Louis Dionne [Tue, 2 Mar 2021 21:18:37 +0000 (16:18 -0500)]
[libc++][NFC] Increase readability of typeinfo comparison of ARM64
We wasted a good deal of time trying to figure out whether our implementation
was correct. In the end, it was, but it wasn't so easy to determine. This
patch dumbs down the implementation and improves the documentation to make
it easier to validate.
See https://lists.llvm.org/pipermail/libcxx-dev/2020-December/001060.html.
Differential Revision: https://reviews.llvm.org/D97802
Vitaly Buka [Thu, 1 Apr 2021 19:40:28 +0000 (12:40 -0700)]
[scudo][NFC] Make tests runs with --gtest_repeat=2
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D99766
Vitaly Buka [Thu, 1 Apr 2021 19:44:31 +0000 (12:44 -0700)]
[Scudo] Fix SizeClassAllocatorLocalCache::drain
It leaved few blocks in PerClassArray[0].
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D99763
David Green [Thu, 1 Apr 2021 20:21:40 +0000 (21:21 +0100)]
[ARM] Allow v6m runtime loop unrolling
This removes the restriction that only Thumb2 targets enable runtime
loop unrolling, allowing it for Thumb1 only cores as well. The existing
T2 heuristics are used (for the time being) to control when and how
unrolling is performed.
Differential Revision: https://reviews.llvm.org/D99588
Vitaly Buka [Thu, 1 Apr 2021 04:46:53 +0000 (21:46 -0700)]
[NFC][scudo] Simplify UseQuarantine initialization
peter klausler [Thu, 1 Apr 2021 19:54:22 +0000 (12:54 -0700)]
[flang] Fix arm clang build
The new source file flang/runtime/complex-reduction.c contains
a portability work-around that implicitly assumed that a recent
version of clang would be used; this patch changes the code and
should be portable to older clangs and any other C compilers that
don't support the standard CMPLXF/CMPLX/CMPLXL macros.
Joseph Huber [Wed, 31 Mar 2021 20:00:38 +0000 (16:00 -0400)]
[OpenMP] Pass mapping names to add components in a user defined mapper
Summary:
Currently the mapping names are not passed to the mapper components that set up
the array region. This means array mappings will not have their names availible
in the runtime. This patch fixes this by passing the argument name to the region
correctly. This means that the mapped variable's name will be the declared
mapper that placed it on the device.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D99681
Craig Topper [Thu, 1 Apr 2021 18:47:11 +0000 (11:47 -0700)]
[RISCV] Use softPromoteHalf legalization for fp16 without Zfh rather than PromoteFloat.
The default legalization strategy is PromoteFloat which keeps
half in single precision format through multiple floating point
operations. Conversion to/from float is done at loads, stores,
bitcasts, and other places that care about the exact size being 16
bits.
This patches switches to the alternative method softPromoteHalf.
This aims to keep the type in 16-bit format between every operation.
So we promote to float and immediately round for any arithmetic
operation. This should be closer to the IR semantics since we
are rounding after each operation and not accumulating extra
precision across multiple operations. X86 is the only other
target that enables this today. See https://reviews.llvm.org/D73749
I had to update getRegisterTypeForCallingConv to force f16 to
use f32 when the F extension is enabled. This way we can still
pass it in the lower bits of an FPR for ilp32f and lp64f ABIs.
The softPromoteHalf would otherwise always give i16 as the
argument type.
Reviewed By: asb, frasercrmck
Differential Revision: https://reviews.llvm.org/D99148
Anastasia Stulova [Thu, 1 Apr 2021 19:31:00 +0000 (20:31 +0100)]
[OpenCL][Docs] Update links to the C++ for OpenCL documentation
Philip Reames [Thu, 1 Apr 2021 19:17:01 +0000 (12:17 -0700)]
Update a test missed in 6ef4505
Philip Reames [Thu, 1 Apr 2021 19:01:29 +0000 (12:01 -0700)]
[Attributor] Cleanup detection of non-relaxed atomics in nosync inference
The code was checking for cases which are disallowed by the verifier. Delete dead code and adjust style.
Philip Reames [Thu, 1 Apr 2021 18:48:19 +0000 (11:48 -0700)]
[Attributor] Cleanup intrinsic handling in nosync inference [mostly NFC]
Mostly stylistic adjustment, but the old code didn't handle the memcpy.inline intrinsic. By using the matcher class, we now do.
Martin Storsjö [Tue, 23 Mar 2021 11:09:26 +0000 (13:09 +0200)]
[libcxx] [test] Make the condvar wait_for tests less brittle
These seem to fail occasionally (they are marked as possibly requiring
a retry).
When doing a condvar wait_for(), it can wake up before the timeout
as a spurious wakeup. In these cases, the wait_for() method returns that
the timeout wasn't hit, and the test reruns another wait_for().
On Windows, it seems like the wait_for() operation often can end up
returning slightly before the intended deadline - when intending to
wait for 250 milliseconds, it can return after e.g. 235 milliseconds.
In these cases, the wait_for() doesn't indicate a timeout.
Previously, the test then reran a new wait_for() for a full 250
milliseconds each time. So for N consecutive wakeups slightly too early,
we'd wait for (N+1)*250 milliseconds. Now it only reruns wait_for() for
the remaining intended wait duration.
Differential Revision: https://reviews.llvm.org/D99175
Philip Reames [Thu, 1 Apr 2021 18:34:43 +0000 (11:34 -0700)]
[funcattrs] Infer nosync from readnone and non-convergent
This implements the most basic possible nosync inference. The choice of inference rule is taken from the comments in attributor and the discussion on the review of the change which introduced the nosync attribute (
0626367202c).
This is deliberately minimal. As noted in code comments, I do plan to add a more robust inference which actually scans the function IR directly, but a) I need to do some refactoring of the attributor code to use common interfaces, and b) I wanted to get something in. I also wanted to minimize the "interesting" analysis discussion since that's time intensive.
Context: This combines with existing nofree attribute inference to help prove dereferenceability in the ongoing deref-at-point semantics work.
Differential Revision: https://reviews.llvm.org/D99749
Greg Clayton [Wed, 17 Mar 2021 05:10:29 +0000 (22:10 -0700)]
Fix "image lookup --address" Summary results for inline functions.
Inline callstacks were being incorrectly displayed in the results of "image lookup --address". The deepest frame wasn't displaying the line table line entry, it was always showing the inline information's call file and line on the previous frame. This is now fixed and has tests to make sure it doesn't regress.
Differential Revision: https://reviews.llvm.org/D98761
Philip Reames [Thu, 1 Apr 2021 18:32:22 +0000 (11:32 -0700)]
Infer dereferenceability from malloc and friends
Hookup TLI when inferring object size from allocation calls. This allows the analysis to prove dereferenceability for known allocation functions (such as malloc/new/etc) in addition to those marked explicitly with the allocsize attribute.
This is a follow up to 0129cd5 now that the bug fixed by
e2c6621e6 is resolved.
As noted in the test, this relies on being able to prove that there is no free between allocation and context (e.g. hoist location). At the moment, this is handled conservatively. I'm working strengthening out ability to reason about no-free regions separately.
Differential Revision: https://reviews.llvm.org/D99737
Martin Storsjö [Tue, 30 Mar 2021 09:40:30 +0000 (12:40 +0300)]
[ARM] Remove an unused parameter in ARMWinCOFFObjectWriter. NFC.
This writer only ever operates on 32 bit arm code.
Differential Revision: https://reviews.llvm.org/D99575
Martin Storsjö [Tue, 23 Mar 2021 12:00:12 +0000 (14:00 +0200)]
[libcxx] [test] Remove XFAIL LIBCXX-WINDOWS-FIXME from time.clock.file/now.pass.cpp
This doesn't fail when _LIBCPP_HAS_NO_INT128 is defined consistently
in both CMAKE_CXX_FLAGS and LIBCXX_TEST_COMPILER_FLAGS; the XFAIL was
added based on early CI testruns where that flag was missing in
LIBCXX_TEST_COMPILER_FLAGS.
Differential Revision: https://reviews.llvm.org/D99705
Philip Reames [Thu, 1 Apr 2021 18:21:34 +0000 (11:21 -0700)]
Extract isVolatile helper on Instruction [NFCI]
We have this logic duplicated in several cases, none of which were exhaustive. Consolidate it in one place.
I don't believe this actually impacts behavior of the callers. I think they all filter their inputs such that their partial implementations were correct. If not, this might be fixing a cornercase bug.
peter klausler [Wed, 31 Mar 2021 16:14:08 +0000 (09:14 -0700)]
[flang] Implement reductions in the runtime
Add runtime APIs, implementations, and tests for ALL, ANY, COUNT,
MAXLOC, MAXVAL, MINLOC, MINVAL, PRODUCT, and SUM reduction
transformantional intrinsic functions for all relevant argument
and result types and kinds, both without DIM= arguments
(total reductions) and with (partial reductions).
Complex-valued reductions have their APIs in C so that
C's _Complex types can be used for their results.
Some infrastructure work was also necessary or noticed:
* Usage of "long double" in the compiler was cleaned up a
bit, and host dependences on x86 / MSVC have been isolated
in a new Common/long-double header.
* Character comparison has been exposed via an extern template
so that reductions could use it.
* Mappings from Fortran type category/kind to host C++ types
and vice versa have been isolated into runtime/cpp-type.h and
then used throughout the runtime as appropriate.
* The portable 128-bit integer package in Common/uint128.h
was generalized to support signed comparisons.
* Bugs in descriptor indexing code were fixed.
Differential Revision: https://reviews.llvm.org/D99666
Raphael Isemann [Thu, 1 Apr 2021 17:50:08 +0000 (19:50 +0200)]
[lldb] Prevent that LLDB randomly crashes in CommandLineParser::addOption by initializing LLVM's command line parser
Since quite a while Apple's LLDB fork (that contains the Swift debugging
support) is randomly crashing in `CommandLineParser::addOption` with an error
such as `CommandLine Error: Option 'h' registered more than once!`
The backtrace of the crashing thread is shown below. There are also usually many
other threads also performing similar clang::FrontendActions which are all
trying to generate (usually outdated) Clang modules which are used by Swift for
various reasons.
```
[ 6] LLDB`CommandLineParser::addOption(llvm::cl::Option*, llvm::cl::SubCommand*) + 856
[ 7] LLDB`CommandLineParser::addOption(llvm::cl::Option*, llvm::cl::SubCommand*) + 733
[ 8] LLDB`CommandLineParser::addOption(llvm::cl::Option*, bool) + 184
[ 9] LLDB`llvm::cl::ParseCommandLineOptions(...) [inlined] ::CommandLineParser::ParseCommandLineOptions(... + 1279
[ 9] LLDB`llvm::cl::ParseCommandLineOptions(...) + 497
[ 10] LLDB`setCommandLineOpts(clang::CodeGenOptions const&) + 416
[ 11] LLDB`EmitAssemblyHelper::EmitAssemblyWithNewPassManager(...) + 98
[ 12] LLDB`clang::EmitBackendOutput(...) + 4580
[ 13] LLDB`PCHContainerGenerator::HandleTranslationUnit(clang::ASTContext&) + 871
[ 14] LLDB`clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 43
[ 15] LLDB`clang::ParseAST(clang::Sema&, bool, bool) + 579
[ 16] LLDB`clang::FrontendAction::Execute() + 74
[ 17] LLDB`clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1808
```
The underlying reason for the crash is that the CommandLine code in LLVM isn't
thread-safe and will never be thread-safe with its current architecture. The way
LLVM's CommandLine logic works is that all parts of the LLVM can provide command
line arguments by defining `cl::opt` global variables and their constructors
(which are invoked during static initialisation) register the variable in LLVM's
CommandLineParser (which is also just a global variable). At some later point
after static initialization we actually try to parse command line arguments and
we ask the CommandLineParser to parse our `argv`. The CommandLineParser then
lazily constructs it's internal parsing state in a non-thread-safe way (this is
where the crash happens), parses the provided command line and then goes back to
the respective `cl::opt` global variables and sets their values according to the
parse result.
As all of this is based on global state, this whole mechanism isn't thread-safe
so the only time to ever use it is when we know we only have one active thread
dealing with LLVM logic. That's why nearly all callers of
`llvm::cl::ParseCommandLineOptions` are at the top of the `main` function of the
some LLVM-based tool. One of the few exceptions to this rule is in the
`setCommandLineOpts` function in `BackendUtil.cpp` which is in our backtrace:
```
static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) {
SmallVector<const char *, 16> BackendArgs;
BackendArgs.push_back("clang"); // Fake program name.
if (!CodeGenOpts.DebugPass.empty()) {
BackendArgs.push_back("-debug-pass");
BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
}
if (!CodeGenOpts.LimitFloatPrecision.empty()) {
BackendArgs.push_back("-limit-float-precision");
BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
}
BackendArgs.push_back(nullptr);
llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
BackendArgs.data());
}
```
This is trying to set `cl::opt` variables in the LLVM backend to their right
value as the passed via CodeGenOptions by invoking the CommandLine parser. As
this is just in some generic Clang CodeGen code (where we allow having multiple
threads) this is code is clearly wrong. If we're unlucky it either overwrites
the value of the global variables or it causes the CommandLine parser to crash.
So the next question is why is this only crashing in LLDB? The main reason seems
to be that easiest way to crash this code is to concurrently enter the initial
CommandLineParser construction where it tries to collect all the registered
`cl::opt` options and checks for sanity:
```
// If it's a DefaultOption, check to make sure it isn't already there.
if (O->isDefaultOption() &&
SC->OptionsMap.find(O->ArgStr) != SC->OptionsMap.end())
return;
// Add argument to the argument map!
if (!SC->OptionsMap.insert(std::make_pair(O->ArgStr, O)).second) {
errs() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr
<< "' registered more than once!\n";
HadErrors = true;
}
```
The `OptionsMap` here is global variable and if we end up in this code with two
threads at once then two threads at the same time can register an option (such
as 'h') when they pass the first `if` and then we fail with the sanity check in
the second `if`.
After this sanity check and initial setup code the only remaining work is just
parsing the provided CommandLine which isn't thread-safe but at least doesn't
crash in all my attempts at breaking it (as it's usually just reading from the
already generated parser state but not further modifying it). The exception to
this is probably that once people actually specify the options in the code
snippet above we might run into some new interesting ways to crash everything.
To go back to why it's only affecting LLDB: Nearly all LLVM tools I could find
(even if they are using threads) seem to call the CommandLine parser at the
start so they all execute the initial parser setup at a point where there is
only one thread. So once the code above is executed they are mostly safe from
the sanity check crashes. We even have some shady code for the gtest `main` in
`TestMain.cpp` which is why this also doesn't affect unit tests.
The only exception to this rule is ... *drum roll* ... LLDB! it's not using that
CommandLine library for parsing options so it also never ends up calling it in
`main`. So when we end up in the `FrontendAction` code from the backtrace we are
already very deep in some LLDB logic and usually already have several threads.
In a situation where Swift decides to compile a large amount of Clang modules in
parallel we then end up entering this code via several threads. If several
threads reach this code at the same time we end up in the situation where the
sanity-checking code of CommandLine crashes. I have a very reliable way of
demonstrating the whole thing in D99650 (just run the unit test several times,
it usually crashes after 3-4 attempts).
We have several ways to fix this:
1. Make the whole CommandLine mechanism in LLVM thread-safe.
2. Get rid of `setCommandLineOpts` in `BackendUtil.cpp` and other callers of the
command line parsing in generic Clang code.
3. Initialise the CommandLine library in a safe point in LLDB.
Option 1 is just a lot of work and I'm not even sure where to start. The whole
mechanism is based on global variables and global state and this seems like a
humongous task.
Option 2 is probably the best thing we can do in the near future. There are only
two callers of the command line parser in generic Clang code. The one in
`BackendUtils.cpp` looks like it can be replaced with some reasonable
refactoring (as it only deals with two specific options). There is another one
in `ExecuteCompilerInvocation` which deals with forwarding the generic `-mllvm`
options to the backend which seems like it will just end up requiring us to do
Option 1.
Option 3 is what this patch is doing. We just parse some dummy command line
invocation in a point of the LLDB execution where we only have one thread that
is dealing with LLVM/Clang stuff. This way we are at least prevent the frequent
crashes for users as parsing the dummy command line invocation will set up the
initial parser state safely.
Fixes rdar://
70989856
Reviewed By: mib, JDevlieghere
Differential Revision: https://reviews.llvm.org/D99652
Jim Ingham [Wed, 31 Mar 2021 23:59:52 +0000 (16:59 -0700)]
Add support for fetching signed values from tagged pointers.
The ObjC runtime offers both signed & unsigned tagged pointer value
accessors to tagged pointer providers, but lldb's tagged pointer
code only implemented the unsigned one. This patch adds an
emulation of the signed one.
The motivation for doing this is that NSNumbers use the signed
accessor (they are always signed) and we need to follow that in our
summary provider or we will get incorrect values for negative
NSNumbers.
The data-formatter-objc test file had NSNumber examples (along with lots of other
goodies) but the NSNumber values weren't tested. So I also added
checks for those values to the test.
I also did a quick audit of the other types in that main.m file, and
it looks like pretty much all the other values are either intermediates
or are tested.
Differential Revision: https://reviews.llvm.org/D99694
Alexey Bataev [Thu, 1 Apr 2021 17:56:25 +0000 (10:56 -0700)]
[SLP]Test for min/max reductions bug, NFC.
Aden Grue [Thu, 1 Apr 2021 17:55:50 +0000 (10:55 -0700)]
Add a pattern to combine composed subview ops
Differential Revision: https://reviews.llvm.org/D99229
Louis Dionne [Wed, 31 Mar 2021 17:13:14 +0000 (13:13 -0400)]
[libc++] NFC: Add a simple test to make sure we destroy elements in std::list
Differential Revision: https://reviews.llvm.org/D99672
Nick Desaulniers [Thu, 1 Apr 2021 17:32:28 +0000 (10:32 -0700)]
[MC][ARM] add .w suffixes for RSB/RSBS T1
See also:
F5.1.167 RSB, RSBS (register) T1 shift or rotate by value variant
of the Arm ARM.
Link: https://github.com/ClangBuiltLinux/linux/issues/1309
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D99542
Louis Dionne [Thu, 1 Apr 2021 17:40:04 +0000 (13:40 -0400)]
[libc++] Print the CMake version before generating CMake
Petr Hosek [Thu, 1 Apr 2021 06:23:20 +0000 (23:23 -0700)]
[CMake] Include dependency on cxx-headers in compiler-rt tests
The missing dependency was revealed by D97572.
Differential Revision: https://reviews.llvm.org/D99706
Raphael Isemann [Thu, 1 Apr 2021 16:41:44 +0000 (18:41 +0200)]
Avoid calling ParseCommandLineOptions in BackendUtil if possible
Calling `ParseCommandLineOptions` should only be called from `main` as the
CommandLine setup code isn't thread-safe. As BackendUtil is part of the
generic Clang FrontendAction logic, a process which has several threads executing
Clang FrontendActions will randomly crash in the unsafe setup code.
This patch avoids calling the function unless either the debug-pass option or
limit-float-precision option is set. Without these two options set the
`ParseCommandLineOptions` call doesn't do anything beside parsing
the command line `clang` which doesn't set any options.
See also D99652 where LLDB received a workaround for this crash.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D99740
Louis Dionne [Thu, 1 Apr 2021 13:47:49 +0000 (09:47 -0400)]
[libc++] Fix codesigning in run.py
Without this patch, we'd always try to codesign the first argument in
the command line, which in some cases is not something we can codesign
(e.g. `bash` for some .sh.cpp tests).
Note that this "hack" is the same thing we do in `ssh.py` - we might need
to admit that it's not a hack after all in the future, but I'm not ready
for that yet.
Differential Revision: https://reviews.llvm.org/D99726
Philip Reames [Thu, 1 Apr 2021 17:37:22 +0000 (10:37 -0700)]
Mark unordered memset/memmove/memcpy as nosync
Mostly a means to remove a bit of code from attributor in advance of implementing a FuncAttr inference for nosync.
Craig Topper [Thu, 1 Apr 2021 17:17:53 +0000 (10:17 -0700)]
[RISCV] Fix handling of nxvXi64 vmsgt(u).vx intrinsics on RV32.
We need to splat the scalar separately and use .vv, but there is
no vmsgt(u).vv. So add isel patterns to select vmslt(u).vv with
swapped operands.
We also need to get VT to use for the splat from an operand rather
than the result since the result VT is nxvXi1.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D99704
Nick Desaulniers [Thu, 1 Apr 2021 17:27:03 +0000 (10:27 -0700)]
[MC][ARM] add .w suffixes for ORN/ORNS T1
See also:
F5.1.128 ORN, ORNS (register) T1 shift or rotate by value variant
of the Arm ARM.
Link: https://github.com/ClangBuiltLinux/linux/issues/1309
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D99538
LLVM GN Syncbot [Thu, 1 Apr 2021 17:18:32 +0000 (17:18 +0000)]
[gn build] Port
fdc4f19e2f80
Craig Topper [Thu, 1 Apr 2021 16:41:36 +0000 (09:41 -0700)]
[RISCV] Add custom type legalization to form MULHSU when possible.
There's no target independent ISD opcode for MULHSU, so custom
legalize 2*XLen multiplies ourselves. We have to be a little
careful to prefer MULHU or MULHSU.
I thought about doing this in isel by pattern matching the
(add (mul X, (srai Y, XLen-1)), (mulhu X, Y)) pattern. I decided
against this because the add might become part of a chain of adds.
I don't trust DAG combine not to reassociate with other adds making
it difficult to find both pieces again.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D99479
Craig Topper [Thu, 1 Apr 2021 16:37:44 +0000 (09:37 -0700)]
[RISCV] Add MULHU and MULHS tests with a constant operand.
Vedant Kumar [Thu, 1 Apr 2021 17:00:52 +0000 (10:00 -0700)]
[lldb/test] Respect --apple-sdk path when querying SDK info
Respect --apple-sdk <path> if it's specified. If the SDK is simply
mounted from some disk image, and not actually installed, this is the
only way to use it.
Differential Revision: https://reviews.llvm.org/D99746
Jay Foad [Thu, 1 Apr 2021 16:20:14 +0000 (17:20 +0100)]
[AMDGPU] Remove SIAddIMGInit pass which is now unused
Differential Revision: https://reviews.llvm.org/D99748
Jay Foad [Wed, 31 Mar 2021 15:45:21 +0000 (16:45 +0100)]
[AMDGPU][GlobalISel] Add IMG init in selectImageIntrinsic
Doing this during instruction selection avoids the cost of running
SIAddIMGInit which is yet another pass over the MIR.
Differential Revision: https://reviews.llvm.org/D99670
Jay Foad [Thu, 1 Apr 2021 16:13:12 +0000 (17:13 +0100)]
[AMDGPU][SDag] Add IMG init in AdjustInstrPostInstrSelection
Doing this in a post-isel hook avoids the cost of running SIAddIMGInit
which is yet another pass over the MIR.
Differential Revision: https://reviews.llvm.org/D99747
Petr Hosek [Thu, 1 Apr 2021 00:34:05 +0000 (17:34 -0700)]
[CMake] Remove {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_PREFIX
These variables were introduced during early work on the runtimes build
but were obsoleted by {LIBCXX,LIBCXXABI,LIBUNWIND}_INSTALL_LIBRARY_DIR.
Differential Revision: https://reviews.llvm.org/D99697
Simon Pilgrim [Thu, 1 Apr 2021 14:58:44 +0000 (15:58 +0100)]
[PPC] Regenerate PR27078 test checks
Samuel [Thu, 1 Apr 2021 17:04:04 +0000 (10:04 -0700)]
[llvm-reduce] Move tests to tools folder
Move tests for llvm-reduce to tools folder
Reviewed By: fhahn, lebedev.ri
Differential Revision: https://reviews.llvm.org/D99632
Dave Lee [Thu, 1 Apr 2021 16:26:26 +0000 (09:26 -0700)]
[lldb] Update test.rst with a paragraph about pdb
Debugging tests sometimes involves debugging the Python source. This adds a paragraph to
the "Debugging Test Failures" section about using `pdb`, and also describes how to run
lldb commands from pdb.
Differential Revision: https://reviews.llvm.org/D99744
Joseph Huber [Thu, 1 Apr 2021 13:55:14 +0000 (09:55 -0400)]
[OpenMP][NFC] Fix typo in libomptarget error message
Summary:
There was a typo suggesting the user to use `LIBOMPTARGET_DEBUG` instead of
`LIBOMPTARGET_INFO`
Yaxun (Sam) Liu [Wed, 31 Mar 2021 21:33:11 +0000 (17:33 -0400)]
[HIP] remove overloaded abs in header
This function seems to be introduced by accident by
https://github.com/llvm/llvm-project/commit/
aa2b593f1495a972a4a592952760ec9d5f7c01f1
Such overloaded abs function did not exist before
the refactoring, and does not exist in
https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/__clang_cuda_cmath.h
Conceptually it also does not make sense, since it adds something like
double abs(int x) {
return ::abs((double)x);
}
It caused regressions in CuPy.
Reviewed by: Aaron Enye Shi, Artem Belevich
Differential Revision: https://reviews.llvm.org/D99738
Craig Topper [Thu, 1 Apr 2021 15:51:28 +0000 (08:51 -0700)]
[RISCV] Improve 64-bit integer materialization for some cases.
This adds a new integer materialization strategy mainly targeted
at 64-bit constants like 0xffffffff where there are 32 or more trailing
ones with leading zeros. We can materialize these by using an addi -1
and srli to restore the leading zeros. This matches what gcc does.
I haven't limited to just these cases though. The implementation
here takes the constant, shifts out all the leading zeros and
shifts ones into the LSBs, creates the new sequence, adds an srli,
and checks if this is shorter than our original strategy.
I've separated the recursive portion into a standalone function
so I could append the new strategy outside of the recursion. Since
external users are no longer using the recursive function, I've
cleaned up the external interface to return the sequence instead of
taking a vector by reference.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D98821
Philip Reames [Thu, 1 Apr 2021 16:03:13 +0000 (09:03 -0700)]
[tests] Cover the most basic cases of nosync inference
cchen [Thu, 1 Apr 2021 16:02:23 +0000 (11:02 -0500)]
[OpenMP51][DOCS] Mark "add present modifier in defaultmap clause" as
done, NFC.
Sanjay Patel [Thu, 1 Apr 2021 14:37:06 +0000 (10:37 -0400)]
[LoopVectorize] auto-generate complete checks; NFC
We can't see how much overhead/redundancy is being
created with the partial checks.
To make it smaller and easier to read, I reduced the
vectorization factor because that does not add new
information - it just duplicates things.
Stella Stamenova [Thu, 1 Apr 2021 15:45:36 +0000 (08:45 -0700)]
[lldb] Un-XFAIL TestAutoInstallMainExecutable on Windows
Jay Foad [Thu, 1 Apr 2021 15:31:22 +0000 (16:31 +0100)]
[AMDGPU] Small cleanup to constructRetValue and its caller. NFC.
Philip Reames [Thu, 1 Apr 2021 15:29:47 +0000 (08:29 -0700)]
[deref-at-point] restrict inference of dereferenceability based on allocsize attribute
Support deriving dereferenceability facts from allocation sites with known object sizes while correctly accounting for any possibly frees between allocation and use site. (At the moment, we're conservative and only allowing it in functions where we know we can't free.)
This is part of the work on deref-at-point semantics. I'm making the change unconditional as the miscompile in this case is way too easy to trip by accident, and the optimization was only recently added (by me).
There will be a follow up patch wiring through TLI since that should now be doable without introducing widespread miscompiles.
Differential Revision: https://reviews.llvm.org/D95815
Mircea Trofin [Tue, 9 Mar 2021 04:55:53 +0000 (20:55 -0800)]
[regalloc] Ensure Query::collectInterferringVregs is called before interval iteration
The main part of the patch is the change in RegAllocGreedy.cpp: Q.collectInterferringVregs()
needs to be called before iterating the interfering live ranges.
The rest of the patch offers support that is the case: instead of clearing the query's
InterferingVRegs field, we invalidate it. The clearing happens when the live reg matrix
is invalidated (existing triggering mechanism).
Without the change in RegAllocGreedy.cpp, the compiler ices.
This patch should make it more easily discoverable by developers that
collectInterferringVregs needs to be called before iterating.
I will follow up with a subsequent patch to improve the usability and maintainability of Query.
Differential Revision: https://reviews.llvm.org/D98232
Timm Bäder [Thu, 1 Apr 2021 15:32:40 +0000 (17:32 +0200)]
Revert "[clang][parser] Set source ranges for GNU-style attributes"
This reverts commit
1ea9fa8c507ec360cf43faf46d13b149e37c950d.
Timm Bäder [Thu, 25 Mar 2021 12:32:42 +0000 (13:32 +0100)]
[clang][parser] Set source ranges for GNU-style attributes
Set the source ranges for parsed GNU-style attributes in
ParseGNUAttributes(), the same way that ParseCXX11Attributes() does it.
Differential Revision: https://reviews.llvm.org/D75844
Anirudh Prasad [Thu, 1 Apr 2021 14:38:42 +0000 (10:38 -0400)]
[AsmParser][SystemZ][z/OS] Add in support to accept "#" as part of an Identifier token
- This patch adds in support to accept the "#" character as part of an Identifier.
- This support is needed especially for the HLASM dialect since "#" is treated as part of the valid "Alphabet" range
- The way this is done is by making use of the previous precedent set by the `AllowAtInIdentifier` field in `MCAsmLexer.h`. A new field called `AllowHashInIdentifier` is introduced.
- The static function `IsIdentifierChar` is also updated to accept the `#` character if the `AllowHashInIdentifier` field is set to true.
Note: The field introduced in `MCAsmLexer.h` could very well be moved to `MCAsmInfo.h`. I'm not opposed to it. I decided to put it in `MCAsmLexer` since there seems to be some sort of precedent already with `AllowAtInIdentifier`.
Reviewed By: abhina.sreeskantharajan, nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/D99277
Bradley Smith [Thu, 25 Mar 2021 15:07:43 +0000 (15:07 +0000)]
[AArch64][SVE] Improve codegen for select nodes with fixed types
Additionally, move the existing fixed vselect tests to *-vselect.ll.
Differential Revision: https://reviews.llvm.org/D99418
Bradley Smith [Tue, 30 Mar 2021 14:46:03 +0000 (15:46 +0100)]
[AArch64][SVE] SVE functions should use the SVE calling convention for fast calls
When an SVE function calls another SVE function using the C calling
convention we use the more efficient SVE VectorCall PCS. However,
for the Fast calling convention we're incorrectly falling back to
the generic AArch64 PCS.
This patch adds the same "can use SVE vector calling convention"
detection used by CallingConv::C to CallingConv::Fast.
Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D99657
Brendon Cahoon [Thu, 25 Mar 2021 20:26:33 +0000 (16:26 -0400)]
[AMDGPU] Enable output modifiers for double precision instructions
Update SIFoldOperands pass to recognize v_add_f64 and v_mul_f64
instructions for folding output modifiers.
Differential Revision: https://reviews.llvm.org/D99505
Alexey Bataev [Tue, 30 Mar 2021 13:47:55 +0000 (06:47 -0700)]
[SLP]Improve and fix getVectorElementSize.
1. Need to cleanup InstrElementSize map for each new tree, otherwise might
use sizes from the previous run of the vectorization attempt.
2. No need to include into analysis the instructions from the different basic
blocks to save compile time.
Differential Revision: https://reviews.llvm.org/D99677
Simon Pilgrim [Thu, 1 Apr 2021 13:27:32 +0000 (14:27 +0100)]
[DAG] MergeInnerShuffle with BinOps - sometimes accept undef mask elements
If the inner shuffle already contains undef elements, then accept them in the merged shuffle as well.
This helps some X86 HADD/SUB patterns where slow targets were ending up with HADD/SUB because the (un)merged shuffles were stuck either side of the ADD/SUB - meaning we ended up with a total cost much higher than the "2*shuffle+add" that a slow target usually expands a HADD/SUB to.
Andrzej Warzynski [Mon, 29 Mar 2021 10:36:57 +0000 (11:36 +0100)]
[flang] Move .f77 to the list of fixed-form file extensions
The free form was introduced in Fortran 90, so treating .f77 as
free-form was a bug.
Differential Revision: https://reviews.llvm.org/D99494
Anastasia Stulova [Thu, 1 Apr 2021 12:54:54 +0000 (13:54 +0100)]
[OpenCL][Docs] Added a label for C++ libs section and example link
Pavel Labath [Thu, 1 Apr 2021 12:44:01 +0000 (14:44 +0200)]
[lldb] Make TestLoadUsingLazyBind work on linux
and probably other posix oses. Use extra_images to ensure
LD_LIBRARY_PATH is set correctly.
Also take the opportunity to remove hand-rolled library extension
management code in favor of the existing one.
Alexey Bataev [Thu, 1 Apr 2021 12:32:18 +0000 (05:32 -0700)]
[SLP]Remove `else` after `return`, NFC.`
Pavel Labath [Thu, 1 Apr 2021 09:58:45 +0000 (11:58 +0200)]
[lldb] Rewrite TestAutoInstallMainExecutable logic
The test uses debug info from one binary to debug a different one. This
does not work on macos, and its pure luck that it works elsewhere (the
variable that it inspects happens to have the same address in both).
The purpose of this test is to verify that lldb has not overwritten the
target executable. That can be more easily achieved by checking the exit
code of the binary, so change the test to do that.
Also remove the llgs_test decorator, as it's preventing the test from
running on macos. All the test needs is the platform functionality of
lldb-server, which is available everywhere.
Michał Górny [Thu, 1 Apr 2021 12:17:47 +0000 (14:17 +0200)]
[lldb] [test] Mark lldb-server multiprocess tests as LLGS cat
Dmitry Preobrazhensky [Thu, 1 Apr 2021 11:21:00 +0000 (14:21 +0300)]
[AMDGPU][MC][GFX10][GFX90A] Corrected _e32/_e64 suffices
Fixed bugs https://bugs.llvm.org//show_bug.cgi?id=49643, https://bugs.llvm.org//show_bug.cgi?id=49644, https://bugs.llvm.org//show_bug.cgi?id=49645.
Differential Revision: https://reviews.llvm.org/D99413
Simon Pilgrim [Thu, 1 Apr 2021 09:08:08 +0000 (10:08 +0100)]
[X86][SSE] Fold HOP(HOP(X,X),HOP(Y,Y)) -> HOP(PERMUTE(HOP(X,Y)),PERMUTE(HOP(X,Y))
For slow-hop targets, attempt to merge HADD/SUB pairs used in chains.
Simon Pilgrim [Wed, 31 Mar 2021 16:36:34 +0000 (17:36 +0100)]
[X86][SSE] Enable (F)HADD/SUB handling to SimplifyMultipleUseDemandedVectorElts
Attempt to bypass unused horiz-op operands.
This is very similar to the PACKSS/PACKUS handling - we should try to merge these.
Simon Pilgrim [Wed, 31 Mar 2021 13:13:08 +0000 (14:13 +0100)]
[X86][SSE] Add isHorizOp helper function. NFCI.
Dmitry Preobrazhensky [Thu, 1 Apr 2021 10:41:09 +0000 (13:41 +0300)]
[AMDGPU][MC] Added flag to identify VOP instructions which have a single variant
By convention, VOP1/2/C instructions which can be promoted to VOP3 have _e32 suffix while promoted instructions have _e64 suffix. Instructions which have a single variant should have no _e32/_e64 suffix. Unfortunately there was no simple way to identify single variant instructions - it was implemented by a hack. See bug https://bugs.llvm.org/show_bug.cgi?id=39086.
This fix simplifies handling of single VOP instructions by adding a dedicated flag.
Differential Revision: https://reviews.llvm.org/D99408
Florian Hahn [Thu, 1 Apr 2021 10:11:58 +0000 (11:11 +0100)]
[SLP] Add test cases for missing SLP vectorization on AArch64.
Balázs Kéri [Thu, 1 Apr 2021 09:10:07 +0000 (11:10 +0200)]
[clang][Checkers] Extend PthreadLockChecker state dump (NFC).
Add printing of map 'DestroyRetVal'.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D98502
David Sherwood [Tue, 23 Mar 2021 14:35:03 +0000 (14:35 +0000)]
[NFC] Add tests for scalable vectorization of loops with large stride acesses
This patch just adds tests that we can vectorize loop such as these:
for (i = 0; i < n; i++)
dst[i * 7] += 1;
and
for (i = 0; i < n; i++)
if (cond[i])
dst[i * 7] += 1;
using scalable vectors, where we expect to use gathers and scatters in the
vectorized loop. The vector of pointers used for the gather is identical
to those used for the scatter so there should be no memory dependences.
Tests are added here:
Transforms/LoopVectorize/AArch64/sve-large-strides.ll
Differential Revision: https://reviews.llvm.org/D99192
Vinayaka Bandishti [Thu, 1 Apr 2021 09:08:24 +0000 (14:38 +0530)]
[MLIR][Affine] Add utility to check if the slice is valid
Fixes a bug in affine fusion pipeline where an incorrect slice is computed.
After the slice computation is done, original domain of the the source is
compared with the new domain that will result if the fusion succeeds. If the
new domain must be a subset of the original domain for the slice to be
valid. If the slice computed is incorrect, fusion based on such a slice is
avoided.
Relevant test cases are added/edited.
Fixes https://bugs.llvm.org/show_bug.cgi?id=49203
Differential Revision: https://reviews.llvm.org/D98239
Muhammad Omair Javaid [Thu, 1 Apr 2021 09:15:00 +0000 (14:15 +0500)]
[LLDB] Fix sync issue in TestVSCode_launch.test_progress_events
This fixes flakiness in TestVSCode_launch.test_progress_events
vscode.progress_events some times failed to populate in time for
follow up iterations.
Adding a minor delay before the the for the loop fixes the issue.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D99497
Muhammad Omair Javaid [Thu, 1 Apr 2021 09:10:14 +0000 (14:10 +0500)]
Revert "Revert "[LLDB] Arm64/Linux test case for MTE and Pointer Authentication regset""
This reverts commit
feb6f2c78fa9474e7329c4a809f175b1675d0975.
Muhammad Omair Javaid [Wed, 31 Mar 2021 18:01:38 +0000 (23:01 +0500)]
Revert "Revert "[LLDB] Arm64/Linux Add MTE and Pointer Authentication registers""
This reverts commit
71b648f7158c7a0b4918eaa3e94d307e4bbfce97.
There was a typo in the last commit which was causing LLDB AArch64 Linux
buildbot testsuite failures. Now fixed in current version.
Yevgeny Rouban [Thu, 1 Apr 2021 08:33:00 +0000 (15:33 +0700)]
[LoopFlatten] Do not report CFG analyses as up-to-date
Removes CFGAnalyses from the preserved analyses set
returned by LoopFlattenPass::run().
Reviewed By: Dave Green, Ta-Wei Tu
Differential Revision: https://reviews.llvm.org/D99700
Harald van Dijk [Thu, 1 Apr 2021 08:47:56 +0000 (09:47 +0100)]
[Driver] Fix architecture triplets and search paths for Linux x32
Currently, support for the x32 ABI is handled as a multilib to the
x86_64 target only. However, full self-hosting x32 systems treating it
as a separate architecture with its own architecture triplets as well as
search paths exist as well, in Debian's x32 port and elsewhere.
This adds the missing architecture triplets and search paths so that
clang can work as a native compiler on x32, and updates the tests so
that they pass when using an x32 libdir suffix.
Additionally, we would previously also assume that objects from any
x86_64-linux-gnu GCC installation could be used to target x32. This
changes the logic so that only GCC installations that include x32
support are used when targetting x32, meaning x86_64-linux-gnux32 GCC
installations, and x86_64-linux-gnu and i686-linux-gnu GCC installations
that include x32 multilib support.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D52050
Sam Parker [Wed, 31 Mar 2021 08:25:18 +0000 (09:25 +0100)]
[WebAssembly] Invert branch condition on xor input
A frequent pattern for floating point conditional branches use an xor
to invert the input for the branch. Instead we can fold away the xor
by swapping the branch target instead.
Differential Revision: https://reviews.llvm.org/D99171
Nicolas Vasilache [Wed, 31 Mar 2021 09:33:08 +0000 (09:33 +0000)]
[mlir][Python][Linalg] Add missing attributes to linalg ops
This revision tightens up the handling of attributes for both named
and generic linalg ops.
To demonstrate the IR validity, a working e2e Linalg example is added.
Differential Revision: https://reviews.llvm.org/D99430
Pavel Labath [Thu, 1 Apr 2021 07:01:35 +0000 (09:01 +0200)]
[lldb] Fix build errors from
3bea7306e8
The addition of the dummy constructors requires matching changes in os-
and arch-specific files, which I forgot about.
Pavel Labath [Thu, 1 Apr 2021 06:13:50 +0000 (08:13 +0200)]
[lldb] Fix compilation with gcc-6.5
This fixes (works around) two errors with gcc-6.5.
- in the RegisterContext_x86 files, gcc is unable to synthesize a
default constructor -- it thinks it needs to initialize the virtual
base class, even though said classes are abstract. I fix that by
providing a dummy constructor.
- In ReproducerInstrumentationTest, it is not able to deduce that the
TestingRegistry class is movable (it contains a map of unique
pointers). I change the type from Optional<TestingRegistry> to
unique_ptr<TestingRegistry), so that moving is not required
(copying/moving a polymorphic type is not a very good idea in any
case).
Marek Kurdej [Thu, 1 Apr 2021 06:29:55 +0000 (08:29 +0200)]
[libc++] Build and test with -Wundef warning. NFC.
This will avoid typos like `_LIBCPP_STD_VERS` (<future>) or using `#if TEST_STD_VER > 17` without including "test_macros.h".
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D99515
Max Kazantsev [Thu, 1 Apr 2021 06:10:10 +0000 (13:10 +0700)]
[NFC] Undo some erroneous renamings
Some vars renamed by mistake during auto-replacements. Undoing them.
Max Kazantsev [Thu, 1 Apr 2021 05:31:57 +0000 (12:31 +0700)]
[NFC] Disambiguate LI in GVN
Name GVN uses name 'LI' for two different unrelated things:
LoadInst and LoopInfo. This patch relates the variables with
former meaning into 'Load' to disambiguate the code.
Jonas Devlieghere [Thu, 1 Apr 2021 04:40:26 +0000 (21:40 -0700)]
[lldb] Remove references to LLDB_CAPTURE_REPRODUCER
Remove the remaining references to LLDB_CAPTURE_REPRODUCER. I removed
the functionality in an earlier commit but forgot that there was a
corresponding test and logic to unset it in our test suite.
Jonas Devlieghere [Thu, 1 Apr 2021 04:34:47 +0000 (21:34 -0700)]
[lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger
Make sure we always terminate the debugger by using a RAII object.
Differential revision: https://reviews.llvm.org/D99702
Jonas Devlieghere [Thu, 1 Apr 2021 04:35:45 +0000 (21:35 -0700)]
[lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)
Consistently use return with EXIT_SUCCESS or EXIT_FAILURE instead of
mix-and-matching return, exit 0, 1 etc.
Differential revision: https://reviews.llvm.org/D99701
Chen Zheng [Fri, 26 Mar 2021 07:21:46 +0000 (03:21 -0400)]
[debug-info] support new tuning debugger type DBX for XCOFF DWARF
Based on this debugger type, for now, we plan to:
1: use inline string by default for XCOFF DWARF
2: generate no column info for debug line table.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D99400