Caroline Concatto [Mon, 21 Dec 2020 15:04:29 +0000 (15:04 +0000)]
[AArch64][SVE]Add cost model for vector reduce for scalable vector
This patch computes the cost for vector.reduce<operand> for scalable vectors.
The cost is split into two parts: the legalization cost and the horizontal
reduction.
Differential Revision: https://reviews.llvm.org/D93639
OCHyams [Tue, 19 Jan 2021 11:04:25 +0000 (11:04 +0000)]
[DebugInfo][dexter] Add dexter tests for merged values
These dexter tests illustrate PR48719, the summary of which is:
Sometimes we insert dbg.values for merged values (PHIs) when promoting
variables, sometimes we don't. Sometimes there is no PHI because the merged
value is never used. It doesn't matter because LiveDebugValues understands these
merged values (implicit or otherwise) and correctly updates the debug
info. Importantly, these merged variable values (which may or may not exist as
PHIs, and may or not be represented with dbg.values) are //always// implicitly
defined by the combination of incoming edges and the incoming variable locations
along those edges by virtue of LiveDebugValues existing. Unfortunately, it is
possible to mess with the CFG and remove / move these edges before
LiveDebugValues runs. In this case our debug info model only works when the
merged value is tracked by a dbg.value. Currently, this is only done rigorously
for variables which are A) promoted in the first round of mem2reg and B) are
used after the merge point.
As an example, compile the following source with -O3 -g and step through with a
debugger. You will see parama=5 throughout the function fun which is incorrect -
we expect to see param=20 after the conditional assignment.
__attribute__((optnone))
void esc(int* p) {}
__attribute__((optnone))
void fluff() {}
__attribute__((noinline))
int fun(int parama, int paramb) {
if (parama)
parama = paramb;
fluff(); // DexLabel('s0')
esc(¶ma);
return 0;
}
int main() {
return fun(5, 20);
}
1. parama is escaped by esc(¶ma) so it is not promoted by
SROA/mem2reg (failing condition "A" above).
2. InstCombine's LowerDbgDeclare converts the dbg.declare to a set of
dbg.values (tracking the stored SSA values).
3. InstCombine replaces the two stores to parama's alloca (the initial
parameter register store in entry and the assignment in if.then) with a
PHI+store in the common sucessor.
4. SimplifyCFG folds the blocks together and converts the PHI to a
select.
The debug info is not updated to account for the merged value in the successor
prior to SimplifyCFG when it exists as a PHI, or during when it becomes a
select.
As with D89543, which added some dexter tests for escaped locals, the idea is
to build a set of source-level tests which highlights existing issues and
might be useful in evaluating a new debug info model.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D94761
Faris Rehman [Tue, 19 Jan 2021 10:01:38 +0000 (10:01 +0000)]
[flang][driver] Add support for `-I` in the new driver
Add support for option -I in the new Flang driver. This will allow for
included headers and module files in other directories, as the default
search path is currently the working folder. The behaviour of this is
consistent with the current f18 driver, where the current folder (i.e.
".") has the highest priority followed by the order of '-I's taking
priority from first to last.
Summary of changes:
- Add SearchDirectoriesFromDashI to PreprocessorOptions, to be forwarded
into the parser's searchDirectories
- Add header files and non-functional module files to be used in
regression tests. The module files are just text files and are used to
demonstrated that paths specified with `-I` are taken into account when
searching for .mod files.
Differential Revision: https://reviews.llvm.org/D93453
Alexander Belyaev [Tue, 19 Jan 2021 11:03:13 +0000 (12:03 +0100)]
[mlir] Add `complex.abs`, `complex.div` and `complex.mul` to ComplexOps.
Differential Revision: https://reviews.llvm.org/D94911
Simon Pilgrim [Tue, 19 Jan 2021 11:03:45 +0000 (11:03 +0000)]
[X86][SSE] combineVectorSignBitsTruncation - fold trunc(srl(x,c)) -> packss(sra(x,c))
If a srl doesn't introduce any sign bits into the truncated result, then replace with a sra to let us use a PACKSS truncation - fixes a regression noticed in D56387 on pre-SSE41 targets that don't have PACKUSDW.
Hans Wennborg [Tue, 19 Jan 2021 10:37:50 +0000 (11:37 +0100)]
Revert
5238e7b302 "[InstCombine] Replace one-use select operand based on condition"
This caused a miscompile in Chromium, see comments on the codereview for
discussion and pointer to a reproducer.
> InstCombine already performs a fold where X == Y ? f(X) : Z is
> transformed to X == Y ? f(Y) : Z if f(Y) simplifies. However,
> if f(X) only has one use, then we can always directly replace the
> use inside the instruction. To actually be profitable, limit it to
> the case where Y is a non-expr constant.
>
> This could be further extended to replace uses further up a one-use
> instruction chain, but for now this only looks one level up.
>
> Among other things, this also subsumes D94860.
>
> Differential Revision: https://reviews.llvm.org/D94862
This also reverts the follow-up
a003f26539cf4db744655e76c41f4c4a8913f116:
> [llvm] Prevent infinite loop in InstCombine of select statements
>
> This fixes an issue where the RHS and LHS the comparison operation
> creating the predicate were swapped back and forth forever.
>
> Differential Revision: https://reviews.llvm.org/D94934
Jay Foad [Tue, 19 Jan 2021 10:26:19 +0000 (10:26 +0000)]
[AMDGPU] Simplify AMDGPUInstPrinter::printExpSrcN. NFC.
Change-Id: Idd7f47647bc0faa3ad6f61f44728c0f20540ec00
Florian Hahn [Tue, 19 Jan 2021 09:22:40 +0000 (09:22 +0000)]
[LoopRotate] Add PrepareForLTO stage, avoid rotating with inline cands.
D84108 exposed a bad interaction between inlining and loop-rotation
during regular LTO, which is causing notable regressions in at least
CINT2006/473.astar.
The problem boils down to: we now rotate a loop just before the vectorizer
which requires duplicating a function call in the preheader when compiling
the individual files ('prepare for LTO'). But this then prevents further
inlining of the function during LTO.
This patch tries to resolve this issue by making LoopRotate more
conservative with respect to rotating loops that have inline-able calls
during the 'prepare for LTO' stage.
I think this change intuitively improves the current situation in
general. Loop-rotate tries hard to avoid creating headers that are 'too
big'. At the moment, it assumes all inlining already happened and the
cost of duplicating a call is equal to just doing the call. But with LTO,
inlining also happens during full LTO and it is possible that a previously
duplicated call is actually a huge function which gets inlined
during LTO.
From the perspective of LV, not much should change overall. Most loops
calling user-provided functions won't get vectorized to start with
(unless we can infer that the function does not touch memory, has no
other side effects). If we do not inline the 'inline-able' call during
the LTO stage, we merely delayed loop-rotation & vectorization. If we
inline during LTO, chances should be very high that the inlined code is
itself vectorizable or the user call was not vectorizable to start with.
There could of course be scenarios where we inline a sufficiently large
function with code not profitable to vectorize, which would have be
vectorized earlier (by scalarzing the call). But even in that case,
there probably is no big performance impact, because it should be mostly
down to the cost-model to reject vectorization in that case. And then
the version with scalarized calls should also not be beneficial. In a way,
LV should have strictly more information after inlining and make more
accurate decisions (barring cost-model issues).
There is of course plenty of room for things to go wrong unexpectedly,
so we need to keep a close look at actual performance and address any
follow-up issues.
I took a look at the impact on statistics for
MultiSource/SPEC2000/SPEC2006. There are a few benchmarks with fewer
loops rotated, but no change to the number of loops vectorized.
Reviewed By: sanwou01
Differential Revision: https://reviews.llvm.org/D94232
Muhammad Omair Javaid [Tue, 19 Jan 2021 09:52:23 +0000 (14:52 +0500)]
[LLDB] Test SVE dynamic resize with multiple threads
This patch adds a new test case which depends on AArch64 SVE support and
dynamic resize capability enabled. It created two seperate threads which
have different values of sve registers and SVE vector granule at various
points during execution.
We test that LLDB is doing the size and offset updates properly for all
of the threads including the main thread and when we VG is updated using
prctl call or by 'register write vg' command the appropriate changes are
also update in register infos.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D82866
Muhammad Omair Javaid [Tue, 19 Jan 2021 09:52:23 +0000 (14:52 +0500)]
[LLDB] Add support to resize SVE registers at run-time
This patch builds on previously submitted SVE patches regarding expedited
register set and per thread register infos. (D82853 D82855 and D82857)
We need to resize SVE register based on value received in expedited list.
Also we need to resize SVE registers when we write vg register using
register write vg command. The resize will result in a updated offset
for all of fpr and sve register set. This offset will be configured
in native register context by RegisterInfoInterface and will also be
be updated on client side in GDBRemoteRegisterContext.
A follow up patch will provide a API test to verify this change.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D82863
Pavel Labath [Tue, 19 Jan 2021 09:53:51 +0000 (10:53 +0100)]
[lldb] Re-enable TestPlatformProcessConnect on macos
The test couldn't find lldb-server as it's path was being overridden by
LLDB_DEBUGSERVER_PATH environment variable (pointing to debugserver).
This test should always use lldb-server, as it tests its platform
capabilities.
There's no need for the environment override, as lldb-server tests
should test the executable they just built, so I just remote the
override capability.
Yvan Roux [Tue, 19 Jan 2021 09:07:56 +0000 (10:07 +0100)]
[ARM][MachineOutliner] Add stack fixup feature
This patch handles cases where we have to save/restore the link register
into the stack and and load/store instruction which use the stack are
part of the outlined region. It checks that there will be no overflow
introduced by the new offset and fixup these instructions accordingly.
Differential Revision: https://reviews.llvm.org/D92934
David Spickett [Mon, 18 Jan 2021 15:36:16 +0000 (15:36 +0000)]
[lldb] Fix crash in "help memory read"
When a command option does not have a short version
(e.g. -f for --file), we use an arbitrary value in the
short_option field to mark it as invalid.
(though this value is unqiue to be used later for other
things)
We check that this short option is valid to print using
llvm::isPrint. This implicitly casts our int to char,
meaning we check the last char of any short_option value.
Since the arbitrary value we chose for these options is
some shortened hex version of the name, this returned true
even for invalid values.
Since llvm::isPrint returns true we later call std::islower
and/or std::isupper on the short_option value. (the int)
Calling these functions with something that cannot be validly
converted to unsigned char is undefined. Somehow we got/get
away with this but for me compiling with g++-9 I got a crash
for "help memory read".
The other command that uses this is "target variable" but that
didn't crash for unknown reasons.
Checking that short_option can fit into an unsigned char before
we call llvm::isPrint means we will not attempt to call islower/upper
on these options since we have no reason to print them.
This also fixes bogus short options being shown for "memory read"
and target variable.
For "target variable", before:
-e <filename> ( --file <filename> )
-b <filename> ( --shlib <filename> )
After:
--file <filename>
--shlib <filename>
(note that the bogus short options are just the bottom byte of our
arbitrary short_option value)
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D94917
Fraser Cormack [Thu, 14 Jan 2021 15:56:11 +0000 (15:56 +0000)]
[RISCV] Add scalable-vector integer extension patterns
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94694
Tres Popp [Mon, 18 Jan 2021 22:40:22 +0000 (23:40 +0100)]
[llvm] Prevent infinite loop in InstCombine of select statements
This fixes an issue where the RHS and LHS the comparison operation
creating the predicate were swapped back and forth forever.
Differential Revision: https://reviews.llvm.org/D94934
serge-sans-paille [Tue, 19 Jan 2021 09:22:57 +0000 (10:22 +0100)]
[lit] Harmonize lit and llvm versionning
In addition to consistency, we'll hit a wall when 11.1.0 gets released, because
we cannot represent it with lit versioning scheme.
Differential Revision: https://reviews.llvm.org/D94157
Lang Hames [Tue, 19 Jan 2021 08:51:19 +0000 (19:51 +1100)]
[ORC] Move LookupRequest from OrcShared to Orc.
It depends on Orc types (SymbolLookupSet), so can't be part of OrcShared.
Tres Popp [Fri, 15 Jan 2021 16:11:41 +0000 (17:11 +0100)]
[llvm][nvptx] add atomicity to counter in ISelLowering
Previously uniqueCallSite could have race conditions between different
threads. Now it is accessed with an atomic RMW and will be unique
between different threads.
Differential Revision: https://reviews.llvm.org/D94784
David Sherwood [Fri, 27 Nov 2020 08:36:28 +0000 (08:36 +0000)]
[NFC] Make remaining cost functions in LoopVectorize.cpp use InstructionCost
A previous patch has already changed getInstructionCost to return
an InstructionCost type. This patch changes the other various
getXXXCost functions to return an InstructionCost too. This is a
non-functional change - I've added a few asserts that the costs
are valid in places where we're selecting between vector call
and intrinsic costs. However, since we don't yet return invalid
costs from any of the TTI implementations these asserts should
not fire.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D94065
Luo, Yuanke [Tue, 19 Jan 2021 04:42:59 +0000 (12:42 +0800)]
[X86][AMX] Fix the typo.
The dpbsud should be dpbssd.
Differential Revision: https://reviews.llvm.org/D94943
Jan Svoboda [Fri, 15 Jan 2021 16:55:03 +0000 (17:55 +0100)]
[clang][cli] Parse Lang and CodeGen options separately
This patch moves the parsing of `{Lang,CodeGen}Options` from `parseSimpleArgs` to the original `Parse{Lang,CodeGen}Args` functions.
This ensures all marshalled `LangOptions` are being parsed **after** the call `setLangDefaults`, which in turn enables us to marshall `LangOptions` that somehow depend on the defaults. (In a future patch.)
Now, `CodeGenOptions` need to be parsed **after** `LangOptions`, because `-cl-mad-enable` (a `CodeGenOpt`) depends on the value of `-cl-fast-relaxed-math` and `-cl-unsafe-math-optimizations` (`LangOpts`).
Unfortunately, this removes the nice property that marshalled options get parsed in the exact order they appear in the `.td` file. Now we cannot be sure that a TableGen record referenced in `ImpliedByAnyOf` has already been parsed. This might cause an ordering issues (i.e. reading value of uninitialized variable). I plan to mitigate this by moving each `XxxOpt` group from `parseSimpleArgs` back to their original parsing function. With this setup, if an option from group `A` references option from group `B` in TableGen, the compiler will require us to make the `CompilerInvocation` member for `B` visible in the parsing function for `A`. That's where we notice that `B` didn't get parsed yet.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D94682
Andy Wingo [Mon, 30 Nov 2020 13:55:29 +0000 (14:55 +0100)]
[WebAssembly] Change prefix on data segment flags to WASM_DATA_SEGMENT
Element sections will also need flags, so we shouldn't squat the
WASM_SEGMENT namespace.
Depends on D90948.
Differential Revision: https://reviews.llvm.org/D92315
Andy Wingo [Tue, 5 Jan 2021 10:05:18 +0000 (11:05 +0100)]
[WebAssembly] call_indirect issues table number relocs
This patch changes to make call_indirect explicitly refer to the
corresponding function table, residualizing TABLE_NUMBER relocs against
it.
With this change, wasm-ld now sees all references to tables, and can
link multiple tables.
Differential Revision: https://reviews.llvm.org/D90948
Timm Bäder [Sun, 17 Jan 2021 06:51:45 +0000 (07:51 +0100)]
[clang][driver][NFC][obvious] Remove obsolete unistd.h include
getuid() is not being called in this file anymore.
Guillaume Chatelet [Fri, 15 Jan 2021 11:07:44 +0000 (11:07 +0000)]
[libc][NFC] remove dependency on non standard ssize_t
`ssize_t` is from POSIX and is not standard unfortunately.
Rewritting the code so it doesn't depend on it.
Differential Revision: https://reviews.llvm.org/D94760
Guillaume Chatelet [Tue, 19 Jan 2021 08:11:37 +0000 (08:11 +0000)]
[libc][NFC] Remove dead code
Marek Kurdej [Tue, 19 Jan 2021 07:21:09 +0000 (08:21 +0100)]
[libc++] [P0935] [C++20] Eradicating unnecessarily explicit default constructors from the standard library.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D91292
ShihPo Hung [Fri, 8 Jan 2021 06:51:37 +0000 (22:51 -0800)]
[RISCV] Add intrinsics for vector AMO operations
Add vamoswap, vamoadd, vamoxor, vamoand, vamoor,
vamomin, vamomax, vamominu, vamomaxu intrinsics.
Reviewed By: craig.topper, khchen
Differential Revision: https://reviews.llvm.org/D94589
Yang Fan [Sun, 17 Jan 2021 04:35:01 +0000 (12:35 +0800)]
[NFC][AIX][XCOFF] Fix compile warning on strncpy
GCC warning:
```
In file included from /usr/include/string.h:495,
from /usr/include/c++/9/cstring:42,
from /llvm-project/llvm/include/llvm/ADT/Hashing.h:53,
from /llvm-project/llvm/include/llvm/ADT/ArrayRef.h:12,
from /llvm-project/llvm/include/llvm/MC/MCAsmBackend.h:12,
from /llvm-project/llvm/lib/MC/XCOFFObjectWriter.cpp:14:
In function ‘char* strncpy(char*, const char*, size_t)’,
inlined from ‘{anonymous}::Section::Section(const char*, llvm::XCOFF::SectionTypeFlags, bool, {anonymous}::CsectGroups)’ at /llvm-project/llvm/lib/MC/XCOFFObjectWriter.cpp:146:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 8 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D94872
Siva Chandra [Tue, 19 Jan 2021 05:59:12 +0000 (21:59 -0800)]
[libc][NFC][Obvious] Add a missing dep.
Mehdi Amini [Tue, 19 Jan 2021 05:59:15 +0000 (05:59 +0000)]
Fix a few GCC compiler warnings (NFC)
Siva Chandra Reddy [Tue, 19 Jan 2021 05:36:40 +0000 (21:36 -0800)]
[libc][NFC] Use ASSERT_EQ instead of EXPECT_EQ in fenv/exception_status_test
Lang Hames [Tue, 19 Jan 2021 04:58:42 +0000 (15:58 +1100)]
[ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.
OrcShared is the correct home for this header since Orc was split in
1d0676b54c4. (It should have been moved in that commit, but was overlooked).
Richard Smith [Sat, 7 Nov 2020 02:14:41 +0000 (18:14 -0800)]
[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.
Previously committed as
9e08e51a20d0d2b1c5724bb17e969d036fced4cd, and
reverted because a dependency commit was reverted. This incorporates the
following follow-on commits that were also reverted:
7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0 by Simon Pilgrim
ed13d8c66781b50ff007cb089c5905f9bb9e8af2 by me
95c7b6cadbc9a3d4376ef44edbeb3c8bb5b8d7fc by Sam McCall
430d5d8429473c2b10b109991d7577a3cea41140 by Dave Zarzycki
Richard Smith [Wed, 16 Dec 2020 21:51:56 +0000 (13:51 -0800)]
Following up on PR48517, fix handling of template arguments that refer
to dependent declarations.
Treat an id-expression that names a local variable in a templated
function as being instantiation-dependent.
This addresses a language defect whereby a reference to a dependent
declaration can be formed without any construct being value-dependent.
Fixing that through value-dependence turns out to be problematic, so
instead this patch takes the approach (proposed on the core reflector)
of allowing the use of pointers or references to (but not values of)
dependent declarations inside value-dependent expressions, and instead
treating template arguments as dependent if they evaluate to a constant
involving such dependent declarations.
This ends up affecting a bunch of OpenMP tests, due to OpenMP
imprecisely handling instantiation-dependent constructs, bailing out
early instead of processing dependent constructs to the extent possible
when handling the template.
Previously committed as
8c1f2d15b826591cdf6bd6b468b8a7d23377b29e, and
reverted because a dependency commit was reverted.
Richard Smith [Fri, 18 Dec 2020 05:27:11 +0000 (21:27 -0800)]
PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of
the nested-name-specifier when determining whether a qualified type is
instantiation-dependent.
Previously reverted in
25a02c3d1a688d3cd18faef96c75fa553efbbac7 due to
causing us to reject some code. It turns out that the rejected code was
ill-formed (no diagnostic required).
Richard Smith [Thu, 17 Dec 2020 22:36:26 +0000 (14:36 -0800)]
DR2064: decltype(E) is only a dependent type if E is type-dependent, not
if E is merely instantiation-dependent.
Previously reverted in
34e72a146111dd986889a0f0ec8767b2ca6b2913;
re-committed with a fix to an issue that caused name mangling to assert.
Luo, Yuanke [Mon, 18 Jan 2021 13:24:09 +0000 (21:24 +0800)]
[X86][AMX] Clear AMX lit test case.
Add nounwind attribute to avoid generating cfi instructions. Also make
global buffer 64 bytes align in lit test case.
Differential Revision: https://reviews.llvm.org/D94910
Nemanja Ivanovic [Tue, 19 Jan 2021 03:19:11 +0000 (21:19 -0600)]
[PowerPC] Sign extend comparison operand for signed atomic comparisons
As of
8dacca943af8a53a23b1caf3142d10fb4a77b645, we sign extend the atomic loaded
operand for signed subword comparisons. However, the assumption that the other
operand is correctly sign extended doesn't always hold. This patch sign extends
the other operand if it needs to be sign extended.
This is a second fix for https://bugs.llvm.org/show_bug.cgi?id=30451
Differential revision: https://reviews.llvm.org/D94058
Richard Smith [Fri, 15 Jan 2021 23:50:25 +0000 (15:50 -0800)]
PR48763: Better handling for classes that inherit a default constructor.
The C++ standard wording doesn't appear to properly handle the case
where a class inherits a default constructor from a base class. Various
properties of classes are defined in terms of the corresponding property
of the default constructor, and in this case, the class does not have a
default constructor despite being default-constructible, which the
wording doesn't handle properly.
This change implements a tentative fix for these problems, which has
also been proposed to the C++ committee: if a class would inherit a
default constructor, and does not explicitly declare one, then one is
implicitly declared.
Luo, Yuanke [Fri, 15 Jan 2021 13:57:47 +0000 (21:57 +0800)]
[X86] Fix tile spill merge issue.
This is a additional bug fix for
c5be0e0cc0. The distance for
the spill instructions is wrong in previous patch.
Differential Revision: https://reviews.llvm.org/D94772
Chen Zheng [Tue, 19 Jan 2021 02:33:31 +0000 (21:33 -0500)]
Revert "[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike."
This reverts commit
3bdf4507b66348ad78df4655a8e4f36c3fc10f3c.
Post commit comments need to be addressed first.
Juneyoung Lee [Tue, 19 Jan 2021 00:30:16 +0000 (09:30 +0900)]
Address unused variable warning
Juneyoung Lee [Tue, 19 Jan 2021 00:00:46 +0000 (09:00 +0900)]
[InstCombine,InstSimplify] Optimize select followed by and/or/xor
This patch adds `A & (A && B)` -> `A && B` (similarly for or + logical or)
Also, this patch adds `~(select C, (icmp pred X, Y), const)` -> `select C, (icmp pred' X, Y), ~const`.
Alive2 proof:
merge_and: https://alive2.llvm.org/ce/z/teMR97
merge_or: https://alive2.llvm.org/ce/z/b4yZUp
xor_and: https://alive2.llvm.org/ce/z/_-TXHi
xor_or: https://alive2.llvm.org/ce/z/2uYx_a
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D94861
Arthur O'Dwyer [Tue, 19 Jan 2021 00:05:08 +0000 (19:05 -0500)]
Regenerate the feature test macro unit-tests. NFCI.
Somehow commit
1f1250151f222ba391d05dcc173f4b6c65d05ca2 added the
right code but with the wrong whitespace.
Kelvin Li [Mon, 18 Jan 2021 23:55:58 +0000 (18:55 -0500)]
[OpenMP][Docs] Fix typos in FAQ (NFC)
Juneyoung Lee [Mon, 18 Jan 2021 04:32:31 +0000 (13:32 +0900)]
[SimplifyCFG] Update SimplifyBranchOnICmpChain to recognize select form of and/or
This patch teaches SimplifyCFG::SimplifyBranchOnICmpChain to understand select form of
(x == C1 || x == C2 || ...) / (x != C1 && x != C2 && ...) and optimize them into switch if possible.
D93065 has more context about the transition, including links to the list of optimizations being updated.
Differential Revision: https://reviews.llvm.org/D93943
Kazu Hirata [Mon, 18 Jan 2021 22:53:21 +0000 (14:53 -0800)]
[LoopInfo] Fix a typo in compareLoops
The code here is checking to see if two sets are identical.
OtherBlocksSet should point to OtherL->getBlocksSet() instead.
Differential Revision: https://reviews.llvm.org/D94926
Sanjay Patel [Mon, 18 Jan 2021 22:46:39 +0000 (17:46 -0500)]
[x86] add cast to avoid compile-time warning; NFC
Louis Dionne [Tue, 12 Jan 2021 16:53:24 +0000 (11:53 -0500)]
[libc++] NFCI: Refactor allocator_traits
The implementation had a lot of boilerplate and was more complicated than
necessary. This NFC refactoring introduces a few macros to reduce code
duplication, and uses a consistent style and formatting for the whole file.
Differential Revision: https://reviews.llvm.org/D94544
Sanjay Patel [Mon, 18 Jan 2021 21:18:57 +0000 (16:18 -0500)]
[SLP] match maxnum/minnum intrinsics as FP reduction ops
After much refactoring over the last 2 weeks to the reduction
matching code, I think this change is finally ready.
We effectively broke fmax/fmin vector reduction optimization
when we started canonicalizing to intrinsics in instcombine,
so this should restore that functionality for SLP.
There are still FMF problems here as noted in the code comments,
but we should be avoiding miscompiles on those for fmax/fmin by
restricting to full 'fast' ops (negative tests are included).
Fixing FMF propagation is a planned follow-up.
Differential Revision: https://reviews.llvm.org/D94913
Craig Topper [Mon, 18 Jan 2021 21:35:26 +0000 (13:35 -0800)]
[RISCV] Remove empty Sched instantiations from the end of InstAlias defs. NFCI
InstAliases don't need scheduling information so I'm not sure what
these lines were even doing. Especially since the records don't
have names.
Nikita Popov [Mon, 18 Jan 2021 21:14:55 +0000 (22:14 +0100)]
[PredicateInfo] Add more and/or tests (NFC)
AndreyChurbanov [Mon, 18 Jan 2021 21:05:34 +0000 (00:05 +0300)]
[OpenMP][NFC] Fix test
The test fails if memkind library is accessible.
Stella Laurenzo [Mon, 18 Jan 2021 20:23:29 +0000 (12:23 -0800)]
NFC: Document current MLIR Python ODS conventions.
* We had let the documentation get stale and catching it up prior to proposing changes.
Wim Leflere [Mon, 18 Jan 2021 20:17:28 +0000 (15:17 -0500)]
[libc++] improve feature test macro script
I've been playing a bit with the `generate_feature_test_macro_components.py` script and replaced some hardcoded values with extra code generation (generate ALL the things).
The output is the same and it makes updating the script less work for the coming 25 C++ standards (until 2 digit number overflow).
Feel free to 'veto' if you think it's overkill.
Differential Revision: https://reviews.llvm.org/D94530
Stella Laurenzo [Mon, 18 Jan 2021 19:49:06 +0000 (11:49 -0800)]
[NFC] Update some mlir python documentation.
* Development setup recommendations.
* Test updates to match what we actually do.
* Update cmake variable `PYTHON_EXECUTABLE` -> `Python3_EXECUTABLE` to match the upgrade to python3 repo wide.
Louis Dionne [Tue, 12 Jan 2021 15:56:57 +0000 (10:56 -0500)]
[libc++] Rename check-cxx-deps to cxx-test-depends for consistency
Several subprojects have targets that do the same thing, and they all
follow the same naming convention: llvm-test-depends, clang-test-depends,
lld-test-depends, etc.
This makes libc++ consistent with other LLVM projects.
Thanks to Duncan Exon Smith for noticing and suggesting the change.
Differential Revision: https://reviews.llvm.org/D94499
Craig Topper [Mon, 18 Jan 2021 19:05:11 +0000 (11:05 -0800)]
Recommit "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple scalable vector results."
This recommits
2c51bef76cbf0149101b9e7c7c658b4a58657929.
I've fixed the broken check line from when I renamed the test function.
Original commit message:
This builds on D94142 where scalable vectors are allowed in structs.
I did have to fix one scalable vector issue in the vector type
creation for these intrinsics where we used getVectorNumElements
instead of ElementCount.
Craig Topper [Mon, 18 Jan 2021 19:00:20 +0000 (11:00 -0800)]
Revert "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple scalable vector results."
This reverts commit
2c51bef76cbf0149101b9e7c7c658b4a58657929.
I seem to have messed up the check lines in the test.
Craig Topper [Mon, 18 Jan 2021 17:39:25 +0000 (09:39 -0800)]
[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple scalable vector results.
This builds on D94142 where scalable vectors are allowed in structs.
I did have to fix one scalable vector issue in the vector type
creation for these intrinsics where we used getVectorNumElements
instead of ElementCount.
Differential Revision: https://reviews.llvm.org/D94149
Adam Czachorowski [Fri, 15 Jan 2021 17:37:25 +0000 (18:37 +0100)]
[clang] Allow LifetimeExtendedTemporary to have no access specifier
The check only runs in debug mode during serialization, but
assert()-fail on:
struct S { const int& x = 7; };
in C++ mode.
Differential Revision: https://reviews.llvm.org/D94804
Kazu Hirata [Mon, 18 Jan 2021 18:16:36 +0000 (10:16 -0800)]
[llvm] Use the default value of drop_begin (NFC)
Kazu Hirata [Mon, 18 Jan 2021 18:16:34 +0000 (10:16 -0800)]
[STLExtras] Add a default value to drop_begin
This patch adds the default value of 1 to drop_begin.
In the llvm codebase, 70% of calls to drop_begin have 1 as the second
argument. The interface similar to with std::next should improve
readability.
This patch converts a couple of calls to drop_begin as examples.
Differential Revision: https://reviews.llvm.org/D94858
Kazu Hirata [Mon, 18 Jan 2021 18:16:33 +0000 (10:16 -0800)]
[llvm] Populate std::vector at construction time (NFC)
Raphael Isemann [Mon, 18 Jan 2021 18:07:51 +0000 (19:07 +0100)]
[lldb][docs] Use 'any' as the default role in LLDB's sphinx project
sphinx processes text in backticks depending on what 'role' it has (e.g.,
`:code:\`blub\`` -> role is `code`). If no role is provided, the default role is
taken which is right now using the default value of `content`. `content` only
really makes the text cursive which isn't really useful for anything right now.
Sphinx recommends using the `any` role by default [1] as that turns text in
backticks without an explicit roles into some kind of smart reference. If we did
this in LLDB, then we could just reference SB API classes by doing `\`SBValue\``
instead of typing out the rather verbose `:py:class:`/`:py:func:`/... role
before each reference. This would be especially nice when writing the SB API
docs itself as we constantly have to reference other classes.
[1] https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-any
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D94899
Florian Hahn [Mon, 18 Jan 2021 17:49:05 +0000 (17:49 +0000)]
[AArch64] Revert back to Intrinsic<> for TME instructions.
This patch reverts back to Intrinsic for the instructions for the
transactional memory extension, so nosync is not included.
Adhemerval Zanella [Fri, 15 Jan 2021 17:58:43 +0000 (17:58 +0000)]
[LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got
The commit
18aa0be36ed9 changed the default GotBaseSymInGotPlt to true
for AArch64. This is different than binutils, where
_GLOBAL_OFFSET_TABLE_ points at the start or .got.
It seems to not intefere with current relocations used by LLVM. However
as indicated by PR#40357 [1] gcc generates R_AARCH64_LD64_GOTPAGE_LO15
for -pie (in fact it also generated the relocation for -fpic).
This change is requires to correctly handle R_AARCH64_LD64_GOTPAGE_LO15
by lld from objects generated by gcc.
[1] https://bugs.llvm.org/show_bug.cgi?id=40357
Florian Hahn [Mon, 18 Jan 2021 17:18:58 +0000 (17:18 +0000)]
[AArch64] Make target intrinsics DefaultAttrIntrinsics.
DefaultAttrIntrinsics was introduced to add very common attributes to a
large set of intrinsics.
Currently the added attributes include:
nofree nosync nounwind willreturn
I think those should hold for most AArch64 target intrinsics, but
there are too many to check manually. This patch makes most AArch64 target
intrinsics DefaultAttrsIntrinsics.
Some notable exceptions I think are exclusive loads and stores as well
as the memory barrier intrinsics, for which nosync does not apply I
think.
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D94687
Michael Munday [Mon, 18 Jan 2021 17:30:19 +0000 (17:30 +0000)]
[RISCV][NFC] Increase test coverage of Zbt extension
Add Zbt (ternary) extension code generation to the select lowering
tests since it can have a significant impact on how select is
lowered.
While we are here make the neg-abs commands more consistent with
the other tests.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D94798
Sanjay Patel [Mon, 18 Jan 2021 17:24:57 +0000 (12:24 -0500)]
[SLP] add more FMF tests for fmax/fmin reductions; NFC
Florian Hahn [Thu, 14 Jan 2021 14:33:16 +0000 (14:33 +0000)]
[AArch64] Add test to check the attributes for some intrinsics.
Arjun P [Mon, 18 Jan 2021 16:32:06 +0000 (22:02 +0530)]
[MLIR] NFC: simplify PresburgerSet::isEqual
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94918
David Green [Mon, 18 Jan 2021 17:16:07 +0000 (17:16 +0000)]
[ARM] Don't handle low overhead branches in AnalyzeBranch
It turns our that the BranchFolder and IfCvt does not like unanalyzable
branches that fall-through. This means that removing the unconditional
branches from the end of tail predicated instruction can run into
asserts and verifier issues.
This effectively reverts
372eb2bbb6fb903ce76266e659dfefbaee67722b, but
adds handling to t2DoLoopEndDec which are not branches, so can be safely
skipped.
Xun Li [Mon, 18 Jan 2021 17:06:21 +0000 (09:06 -0800)]
[Coroutine] Do not CoroElide if there are musttail calls
This is to address https://bugs.llvm.org/show_bug.cgi?id=48626.
When there are musttail calls that use parameters aliasing the newly created coroutine frame, the existing implementation will fatal.
We simply cannot perform CoroElide in such cases. In theory a precise analysis can be done to check whether the parameters of the musttail call
actually alias the frame, but it's very hard to do it before the transformation happens. Also in most cases the existence of musttail call is
generated due to symmetric transfers, and in those cases alias analysis won't be able to tell that they don't alias anyway.
Differential Revision: https://reviews.llvm.org/D94834
Utkarsh Saxena [Sun, 10 Jan 2021 15:32:00 +0000 (16:32 +0100)]
[clangd] Derive new signals in CC from ASTSignals.
This patch only introduces new signals but does not use their value
in scoring a CC candidate. Usage of these signals in CC ranking in both
heiristics and ML model will be introduced in later patches.
Differential Revision: https://reviews.llvm.org/D94473
David Green [Mon, 18 Jan 2021 16:36:00 +0000 (16:36 +0000)]
[ARM] Update test target triple. NFC
Arjun P [Mon, 18 Jan 2021 15:30:21 +0000 (21:00 +0530)]
[MLIR] Support checking if two FlatAffineConstraints are equal
This patch adds support for checking if two PresburgerSets are equal. In particular, one can check if two FlatAffineConstraints are equal by constructing PrebsurgerSets from them and comparing these.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94915
Nicholas Guy [Fri, 15 Jan 2021 14:28:23 +0000 (14:28 +0000)]
Reland "[AArch64] Attempt to sink mul operands""
This relands
dda60035e9f0769c8907cdf6561489e0435c2275,
which was reverted by
dbaa6a1858a42f72b683f700d3bd7a9632f7a518
Nicholas Guy [Fri, 15 Jan 2021 14:26:51 +0000 (14:26 +0000)]
[AArch64] Further restricts when a dup(*ext) can be rearranged
In most cases, the dup(*ext) pattern can be rearranged to perform
the extension on the vector side, allowing for further vector-specific
optimisations to be made. However the initial checks for this conversion
were insufficient, allowing invalid encodings to be attempted (causing
compilation to fail).
Differential Revision: https://reviews.llvm.org/D94778
Andy Wingo [Fri, 27 Nov 2020 08:19:46 +0000 (09:19 +0100)]
[WebAssembly] MC layer writes table symbols to object files
Now that the linker handles table symbols, we can allow the frontend to
produce them.
Depends on D91870.
Differential Revision: https://reviews.llvm.org/D92215
Andy Wingo [Thu, 14 Jan 2021 09:15:56 +0000 (10:15 +0100)]
[WebAssembly] Add support for table linking to wasm-ld
This patch adds support to wasm-ld for linking multiple table references
together, in a manner similar to wasm globals. The indirect function
table is synthesized as needed.
To manage the transitional period in which the compiler doesn't yet
produce TABLE_NUMBER relocations and doesn't residualize table symbols,
the linker will detect object files which have table imports or
definitions, but no table symbols. In that case it will synthesize
symbols for the defined and imported tables.
As a change, relocatable objects are now written with table symbols,
which can cause symbol renumbering in some of the tests. If no object
file requires an indirect function table, none will be written to the
file. Note that for legacy ObjFile inputs, this test is conservative: as
we don't have relocs for each use of the indirecy function table, we
just assume that any incoming indirect function table should be
propagated to the output.
Differential Revision: https://reviews.llvm.org/D91870
Simon Pilgrim [Mon, 18 Jan 2021 15:54:05 +0000 (15:54 +0000)]
[X86][AVX] IsElementEquivalent - add matchShuffleWithUNPCK + VBROADCAST/VBROADCAST_LOAD handling
Specify LHS/RHS operands in matchShuffleWithUNPCK's calls to isTargetShuffleEquivalent, and handle VBROADCAST/VBROADCAST_LOAD matching in IsElementEquivalent
Dmitry Preobrazhensky [Mon, 18 Jan 2021 15:38:32 +0000 (18:38 +0300)]
Fix for sanitizer issue in 55c557a
Florian Hahn [Mon, 18 Jan 2021 15:18:17 +0000 (15:18 +0000)]
[LoopRotate] Precommit test for prepare-for-lto handling.
Precommit test for D94232.
Dmitry Preobrazhensky [Mon, 18 Jan 2021 12:16:46 +0000 (15:16 +0300)]
[AMDGPU][MC] Refactored parsing of dpp ctrl
Summary of changes:
- simplified code to improve maintainability;
- replaced lex() with higher level parser functions;
- improved errors handling.
Reviewers: rampitec
Differential Revision: https://reviews.llvm.org/D94777
Sanjay Patel [Mon, 18 Jan 2021 14:28:21 +0000 (09:28 -0500)]
[SLP] rename reduction query for min/max ops; NFC
This will avoid confusion once we start matching
min/max intrinsics. All of these hacks to accomodate
cmp+sel idioms should disappear once we canonicalize
to min/max intrinsics.
Sanjay Patel [Mon, 18 Jan 2021 13:57:09 +0000 (08:57 -0500)]
[SLP] reduce opcode API dependency in reduction cost calc; NFC
The icmp opcode is now hard-coded in the cost model call.
This will make it easier to eventually remove all opcode
queries for min/max patterns as we transition to intrinsics.
Djordje Todorovic [Mon, 18 Jan 2021 14:26:40 +0000 (15:26 +0100)]
[CSInfo][MIPS] Update CSInfo in delay slot filler
In MipsDelaySlotFiller, when replacing old call-branch with
the compact branch instruction, an assertion is caused by erasing
the old call with unhandled CSInfo.
The problem was reported in PR48695.
This patch fixes it, by moving call site info from the old call
instruction to its replace.
Patch by Nikola Tesic
Differential revision: https://reviews.llvm.org/D94685
Sean Fertile [Fri, 15 Jan 2021 21:36:50 +0000 (16:36 -0500)]
[PowerPC][AIX]Do not emit xxspltd mnemonic on AIX.
A bug in the system assembler can assemble the xxspltd extended
menemonic into the wrong instruction (extracting the wrong element).
Emit the full xxpermdi with all operands to work around the problem.
Differential Revision: https://reviews.llvm.org/D94419
Florian Hahn [Mon, 18 Jan 2021 13:40:21 +0000 (13:40 +0000)]
[InferAttrs] Mark some library functions as willreturn.
This patch marks some library functions as willreturn. On the first pass, I
excluded most functions that interact with streams/the filesystem.
Along with willreturn, it also adds nounwind to a set of math functions.
There probably are a few additional attributes we can add for those, but
that should be done separately.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D94684
Caroline Concatto [Mon, 4 Jan 2021 15:21:21 +0000 (15:21 +0000)]
[NFC]Migrate VectorCombine.cpp to use InstructionCost
This patch changes these functions:
vectorizeLoadInsert
isExtractExtractCheap
foldExtractedCmps
scalarizeBinopOrCmp
getShuffleExtract
foldBitcastShuf
to use the class InstructionCost when calling TTI.get<something>Cost().
This patch is part of a series of patches to use InstructionCost instead of
unsigned/int for the cost model functions.
See this thread for context:
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
See this patch for the introduction of the type:
https://reviews.llvm.org/D91174
ps.:This patch adds the test || !NewCost.isValid(), because we want to
return false when:
!NewCost.isValid && !OldCost.isValid()->the cost to transform it expensive
and
!NewCost.isValid() && OldCost.isValid()
Therefore for simplication we only add test for !NewCost.isValid()
Differential Revision: https://reviews.llvm.org/D94069
Kai Nacke [Thu, 14 Jan 2021 13:04:39 +0000 (08:04 -0500)]
[Doc] Fix example in codegen doc.
The attributes in the example are placed wrong:
They belong after the type, not after the parameter name.
Reviewed by: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D94683
Denis Antrushin [Thu, 14 Jan 2021 19:35:18 +0000 (22:35 +0300)]
[Statepoint] Handle `undef` operands in statepoint.
Currently when spilling statepoint register operands in FixupStatepoints
we do not pay attention that it might be `undef`. We just generate a
spill, which may lead to verifier error because we have a use without def.
To handle it, let FixupStateponts ignore `undef` register operands
completely and change them to some constant value when generating
stack map. Use same value as used by ISel for this purpose (0xFEFEFEFE).
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D94703
Abhina Sreeskantharajan [Mon, 18 Jan 2021 12:14:12 +0000 (07:14 -0500)]
[SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests
On z/OS, the following error message is not matched correctly in lit tests. This patch updates the CHECK expression to match successfully.
```
EDC5129I No such file or directory.
```
Reviewed By: muiez
Differential Revision: https://reviews.llvm.org/D94239
Dmitry Preobrazhensky [Mon, 18 Jan 2021 11:54:34 +0000 (14:54 +0300)]
[AMDGPU][MC][GFX10] Improved dpp8 errors handling
Reviewers: rampitec
Differential Revision: https://reviews.llvm.org/D94756
Shilei Tian [Mon, 18 Jan 2021 11:57:52 +0000 (06:57 -0500)]
Revert "[OpenMP] Added the support for hidden helper task in RTL"
This reverts commit
ed939f853da1f2266f00ea087f778fda88848f73.
Florian Hahn [Mon, 18 Jan 2021 10:34:21 +0000 (10:34 +0000)]
[VectorUtils] Do not try to add indices matching tombstone/empty values.
Keys matching the tombstone/empty special values cannot be inserted in a
DenseMap. Under some circumstances, LV tries to add members to an
interleave group that match the special values. Skip adding such
members. This is unlikely to have any impact in practice, because
interleave groups with such indices are very likely to not be
vectorized, due to gaps.
This issue has been surfaced by fuzzing, see
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11638
Tres Popp [Mon, 18 Jan 2021 11:01:27 +0000 (12:01 +0100)]
Revert "[PowerPC] support register pressure reduction in machine combiner."
This reverts commit
26a396c4ef481cb159bba631982841736a125a9c.
See https://reviews.llvm.org/D92071 for a description of the issue.
Vladislav Vinogradov [Mon, 18 Jan 2021 10:54:06 +0000 (11:54 +0100)]
[mlir] Fix cross-compilation (Linalg ODS gen)
Use cross-compilation approach for `mlir-linalg-ods-gen` application
similar to TblGen tools.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D94598