platform/upstream/llvm.git
3 years ago[libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD
Alex Richardson [Tue, 19 Jan 2021 13:02:29 +0000 (13:02 +0000)]
[libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD

Commit 5e416ba943b7c737deb8eca62756f7b4fa925845 (D71522) updated the
__config header but didn't change test_macros.h.
This fixes libcxx/language.support/has_timespec_get.compile.pass.cpp on
FreeBSD12/13.

Reviewed By: #libc, dim, ldionne

Differential Revision: https://reviews.llvm.org/D94292

3 years ago[LoopRotate] Calls not lowered to calls should not block rotation.
Florian Hahn [Tue, 19 Jan 2021 14:34:55 +0000 (14:34 +0000)]
[LoopRotate] Calls not lowered to calls should not block rotation.

83daa49758a1 made loop-rotate more conservative in the presence of
function calls in the prepare-for-lto stage. The code did not properly
account for calls that are no actual function calls, like calls to
intrinsics. This patch updates the code to ensure only calls that are
lowered to actual calls are considered inline candidates.

3 years ago[Flang][OpenMP] Add semantic checks for OpenMP Workshare Construct
Praveen [Tue, 19 Jan 2021 12:58:44 +0000 (18:28 +0530)]
[Flang][OpenMP] Add semantic checks for OpenMP Workshare Construct

Add Semantic checks for OpenMP 4.5 - 2.7.4 Workshare Construct.

 - The structured block in a workshare construct may consist of only
   scalar or array assignments, forall or where statements,
   forall, where, atomic, critical or parallel constructs.

 - All array assignments, scalar assignments, and masked array
   assignments must be intrinsic assignments.

 - The construct must not contain any user defined function calls unless
   the function is ELEMENTAL.

Test cases : omp-workshare03.f90, omp-workshare04.f90, omp-workshare05.f90

Resolve test cases (omp-workshare01.f90 and omp-workshare02.f90) marked as XFAIL

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D93091

3 years ago[X86] Regenerate fmin/fmax reduction tests
Simon Pilgrim [Tue, 19 Jan 2021 14:28:30 +0000 (14:28 +0000)]
[X86] Regenerate fmin/fmax reduction tests

Add missing check-prefixes + v1f32 tests

3 years ago[lldb] Fix two documentation typos
Raphael Isemann [Tue, 19 Jan 2021 14:25:15 +0000 (15:25 +0100)]
[lldb] Fix two documentation typos

3 years ago[mlir][spirv] Define spv.GLSL.Fma and add lowerings
Lei Zhang [Tue, 19 Jan 2021 14:13:44 +0000 (09:13 -0500)]
[mlir][spirv] Define spv.GLSL.Fma and add lowerings

Also changes some rewriter.create + rewriter.replaceOp calls
into rewriter.replaceOpWithNewOp calls.

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D94965

3 years agoAArch64: add apple-a14 as a CPU
Tim Northover [Thu, 14 Jan 2021 09:09:54 +0000 (09:09 +0000)]
AArch64: add apple-a14 as a CPU

This CPU supports all v8.5a features except BTI, and so identifies as v8.5a to
Clang. A bit weird, but the best way for things like xnu to detect the new
features it cares about.

3 years ago[mlir][Affine] Revisit and simplify composeAffineMapAndOperands.
Nicolas Vasilache [Tue, 19 Jan 2021 13:48:08 +0000 (13:48 +0000)]
[mlir][Affine] Revisit and simplify composeAffineMapAndOperands.

In prehistorical times, AffineApplyOp was allowed to produce multiple values.
This allowed the creation of intricate SSA use-def chains.
AffineApplyNormalizer was originally introduced as a means of reusing the AffineMap::compose method to write SSA use-def chains.
Unfortunately, symbols that were produced by an AffineApplyOp needed to be promoted to dims and reordered for the mathematical composition to be valid.

Since then, single result AffineApplyOp became the law of the land but the original assumptions were not revisited.

This revision revisits these assumptions and retires AffineApplyNormalizer.

Differential Revision: https://reviews.llvm.org/D94920

3 years ago[ThinLTO] Also prune Thin-* files from the ThinLTO cache
Hans Wennborg [Tue, 19 Jan 2021 12:41:41 +0000 (13:41 +0100)]
[ThinLTO] Also prune Thin-* files from the ThinLTO cache

Such files (Thin-%%%%%%.tmp.o) are supposed to be deleted immediately
after they're used (either by renaming or deletion). However, we've seen
instances on Windows where this doesn't happen, probably due to the
filesystem being flaky. This is effectively a resource leak which has
prevented us from using the ThinLTO cache on Windows.

Since those temporary files are in the thinlto cache directory which we
prune periodically anyway, allowing them to be pruned too seems like a
tidy way to solve the problem.

Differential revision: https://reviews.llvm.org/D94962

3 years ago[llvm/Orc] Fix ExecutionEngine module build breakage
Med Ismail Bennani [Tue, 19 Jan 2021 13:31:25 +0000 (14:31 +0100)]
[llvm/Orc] Fix ExecutionEngine module build breakage

This patch updates the llvm module map to reflect changes made in
`24672ddea3c97fd1eca3e905b23c0116d7759ab8` and fixes the module builds
(`-DLLVM_ENABLE_MODULES=On`).

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[flang][driver] Add standard macro predefinitions for compiler version
Faris Rehman [Tue, 19 Jan 2021 13:15:53 +0000 (13:15 +0000)]
[flang][driver] Add standard macro predefinitions for compiler version

Add the following standard predefinitions that f18 supports:
  * `__flang__`,
  * `__flang_major__`,
  * `__flang_minor__`,
  * `__flang_patchlevel__`

Summary of changes:
- Populate Fortran::parser::Options#predefinitions with the default
  supported predefinitions

Differential Revision: https://reviews.llvm.org/D94516

3 years ago[OpenMP] libomp: cleanup parsing of OMP_ALLOCATOR env variable.
AndreyChurbanov [Tue, 19 Jan 2021 13:21:22 +0000 (16:21 +0300)]
[OpenMP] libomp: cleanup parsing of OMP_ALLOCATOR env variable.

Differential Revision: https://reviews.llvm.org/D94932

3 years ago[DebugInfo][dexter] Tweak dexter test for merged values
OCHyams [Tue, 19 Jan 2021 12:31:55 +0000 (12:31 +0000)]
[DebugInfo][dexter] Tweak dexter test for merged values

Tweak dexter-tests/memvars/inline-escaping-function.c added in D94761
(b7e516202eb6) by adding a 'param' use after the merge point. The test XFAILS
with and without this change, but without it the test looks very similar to
memvars/unused-merged-value.c. The test now demonstrates the problem more
clearly.

3 years ago[flang][driver] Add support for fixed form detection
Faris Rehman [Mon, 4 Jan 2021 16:49:33 +0000 (16:49 +0000)]
[flang][driver] Add support for fixed form detection

Currently the new flang driver always runs in free form mode. This patch
adds support for fixed form mode detection based on the file extensions.

Like `f18`, `flang-new` will treat files ending with ".f", ".F" and
".ff" as fixed form. Additionally, ".for", ".FOR", ".fpp" and ".FPP"
file extensions are recognised as fixed form files. This is consistent
with gfortran [1]. In summary, files with the following extensions are
treated as fixed-form:
  * ".f", ".F", ".ff", ".for", ".FOR", ".fpp", ".FPP"

For consistency with flang/test/lit.cfg.py and f18, this patch also adds
support for the following file extensions:
  * ".ff", ".FOR", ".for", ".ff90", ".fpp", ".FPP"
This is added in flang/lib/Frontend/FrontendOptions.cpp. Additionally,
the following extensions are included:
  * ".f03", ".F03", ".f08", ".F08"
This is for compatibility with gfortran [1] and other popular Fortran
compilers [2].

NOTE: internally Flang will only differentiate between fixed and free
form files. Currently Flang does not support switching between language
standards, so in this regard file extensions are irrelevant. More
specifically, both `file.f03` and `file.f18` are represented with
`Language::Fortran` (as opposed to e.g. `Language::Fortran03`).

Summary of changes:
- Set Fortran::parser::Options::sFixedForm according to the file type
- Add isFixedFormSuffix and isFreeFormSuffix helper functions to
  FrontendTool/Utils.h
- Change FrontendOptions::GetInputKindForExtension to support the missing
  file extensions that f18 supports and some additional ones
- FrontendActionTest.cpp is updated to make sure that the test input is
  treated as free-form

[1] https://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-and-GCC.html
[2] https://github.com/llvm/llvm-project/blob/master/flang/docs/OptionComparison.md#notes

Differential Revision: https://reviews.llvm.org/D94228

3 years ago[clang] Check for nullptr when instantiating late attrs
Adam Czachorowski [Mon, 18 Jan 2021 22:16:05 +0000 (23:16 +0100)]
[clang] Check for nullptr when instantiating late attrs

This was already done in SemaTemplateInstantiateDecl.cpp, but not in
SemaTemplateInstantiate.cpp.

Anecdotally I've seen some clangd crashes where coredumps point to this
being a problem, but I cannot reproduce this so far.

Differential Revision: https://reviews.llvm.org/D94933

3 years ago[mlir] Clarify docs around LLVM dialect-compatible types
Alex Zinenko [Tue, 19 Jan 2021 12:42:16 +0000 (13:42 +0100)]
[mlir] Clarify docs around LLVM dialect-compatible types

Explicitly mention that there is exactly one MLIR type that corresponds
to a given LLVM IR type.

3 years ago[SystemZ][z/OS] Fix No such file or directory expression error
Abhina Sreeskantharajan [Tue, 19 Jan 2021 12:25:21 +0000 (07:25 -0500)]
[SystemZ][z/OS] Fix No such file or directory expression error

On z/OS, the following error message is not matched correctly in lit tests. This patch updates the CHECK expression to match the end period successfully.
```
EDC5129I No such file or directory.
```

Differential Revision: https://reviews.llvm.org/D94239

3 years ago[AArch64][SVE]Add cost model for vector reduce for scalable vector
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

3 years ago[DebugInfo][dexter] Add dexter tests for merged values
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(&parama);
      return 0;
    }

    int main() {
      return fun(5, 20);
    }

1. parama is escaped by esc(&parama) 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

3 years ago[flang][driver] Add support for `-I` in the new driver
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

3 years ago[mlir] Add `complex.abs`, `complex.div` and `complex.mul` to ComplexOps.
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

3 years ago[X86][SSE] combineVectorSignBitsTruncation - fold trunc(srl(x,c)) -> packss(sra(x,c))
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.

3 years agoRevert 5238e7b302 "[InstCombine] Replace one-use select operand based on condition"
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

3 years ago[AMDGPU] Simplify AMDGPUInstPrinter::printExpSrcN. NFC.
Jay Foad [Tue, 19 Jan 2021 10:26:19 +0000 (10:26 +0000)]
[AMDGPU] Simplify AMDGPUInstPrinter::printExpSrcN. NFC.

Change-Id: Idd7f47647bc0faa3ad6f61f44728c0f20540ec00

3 years ago[LoopRotate] Add PrepareForLTO stage, avoid rotating with inline cands.
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

3 years ago[LLDB] Test SVE dynamic resize with multiple threads
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

3 years ago[LLDB] Add support to resize SVE registers at run-time
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

3 years ago[lldb] Re-enable TestPlatformProcessConnect on macos
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.

3 years ago[ARM][MachineOutliner] Add stack fixup feature
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

3 years ago[lldb] Fix crash in "help memory read"
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

3 years ago[RISCV] Add scalable-vector integer extension patterns
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

3 years ago[llvm] Prevent infinite loop in InstCombine of select statements
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

3 years ago[lit] Harmonize lit and llvm versionning
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

3 years ago[ORC] Move LookupRequest from OrcShared to Orc.
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.

3 years ago[llvm][nvptx] add atomicity to counter in ISelLowering
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

3 years ago[NFC] Make remaining cost functions in LoopVectorize.cpp use InstructionCost
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

3 years ago[X86][AMX] Fix the typo.
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

3 years ago[clang][cli] Parse Lang and CodeGen options separately
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

3 years ago[WebAssembly] Change prefix on data segment flags to WASM_DATA_SEGMENT
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

3 years ago[WebAssembly] call_indirect issues table number relocs
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

3 years ago[clang][driver][NFC][obvious] Remove obsolete unistd.h include
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.

3 years ago[libc][NFC] remove dependency on non standard ssize_t
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

3 years ago[libc][NFC] Remove dead code
Guillaume Chatelet [Tue, 19 Jan 2021 08:11:37 +0000 (08:11 +0000)]
[libc][NFC] Remove dead code

3 years ago[libc++] [P0935] [C++20] Eradicating unnecessarily explicit default constructors...
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

3 years ago[RISCV] Add intrinsics for vector AMO operations
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

3 years ago[NFC][AIX][XCOFF] Fix compile warning on strncpy
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

3 years ago[libc][NFC][Obvious] Add a missing dep.
Siva Chandra [Tue, 19 Jan 2021 05:59:12 +0000 (21:59 -0800)]
[libc][NFC][Obvious] Add a missing dep.

3 years agoFix a few GCC compiler warnings (NFC)
Mehdi Amini [Tue, 19 Jan 2021 05:59:15 +0000 (05:59 +0000)]
Fix a few GCC compiler warnings (NFC)

3 years ago[libc][NFC] Use ASSERT_EQ instead of EXPECT_EQ in fenv/exception_status_test
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

3 years ago[ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.
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).

3 years ago[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.
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

3 years agoFollowing up on PR48517, fix handling of template arguments that refer
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.

3 years agoPR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of
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).

3 years agoDR2064: decltype(E) is only a dependent type if E is type-dependent, not
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.

3 years ago[X86][AMX] Clear AMX lit test case.
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

3 years ago[PowerPC] Sign extend comparison operand for signed atomic comparisons
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

3 years agoPR48763: Better handling for classes that inherit a default constructor.
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.

3 years ago[X86] Fix tile spill merge issue.
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

3 years agoRevert "[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike."
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.

3 years agoAddress unused variable warning
Juneyoung Lee [Tue, 19 Jan 2021 00:30:16 +0000 (09:30 +0900)]
Address unused variable warning

3 years ago[InstCombine,InstSimplify] Optimize select followed by and/or/xor
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

3 years agoRegenerate the feature test macro unit-tests. NFCI.
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.

3 years ago[OpenMP][Docs] Fix typos in FAQ (NFC)
Kelvin Li [Mon, 18 Jan 2021 23:55:58 +0000 (18:55 -0500)]
[OpenMP][Docs] Fix typos in FAQ (NFC)

3 years ago[SimplifyCFG] Update SimplifyBranchOnICmpChain to recognize select form of and/or
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

3 years ago[LoopInfo] Fix a typo in compareLoops
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

3 years ago[x86] add cast to avoid compile-time warning; NFC
Sanjay Patel [Mon, 18 Jan 2021 22:46:39 +0000 (17:46 -0500)]
[x86] add cast to avoid compile-time warning; NFC

3 years ago[libc++] NFCI: Refactor allocator_traits
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

3 years ago[SLP] match maxnum/minnum intrinsics as FP reduction ops
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

3 years ago[RISCV] Remove empty Sched instantiations from the end of InstAlias defs. NFCI
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.

3 years ago[PredicateInfo] Add more and/or tests (NFC)
Nikita Popov [Mon, 18 Jan 2021 21:14:55 +0000 (22:14 +0100)]
[PredicateInfo] Add more and/or tests (NFC)

3 years ago[OpenMP][NFC] Fix test
AndreyChurbanov [Mon, 18 Jan 2021 21:05:34 +0000 (00:05 +0300)]
[OpenMP][NFC] Fix test

The test fails if memkind library is accessible.

3 years agoNFC: Document current MLIR Python ODS conventions.
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.

3 years ago[libc++] improve feature test macro script
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

3 years ago[NFC] Update some mlir python documentation.
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.

3 years ago[libc++] Rename check-cxx-deps to cxx-test-depends for consistency
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

3 years agoRecommit "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with...
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.

3 years agoRevert "[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with...
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.

3 years ago[RISCV] Add a test of vector sadd.overflow to demonstrate intrinsics with multiple...
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

3 years ago[clang] Allow LifetimeExtendedTemporary to have no access specifier
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

3 years ago[llvm] Use the default value of drop_begin (NFC)
Kazu Hirata [Mon, 18 Jan 2021 18:16:36 +0000 (10:16 -0800)]
[llvm] Use the default value of drop_begin (NFC)

3 years ago[STLExtras] Add a default value to drop_begin
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

3 years ago[llvm] Populate std::vector at construction time (NFC)
Kazu Hirata [Mon, 18 Jan 2021 18:16:33 +0000 (10:16 -0800)]
[llvm] Populate std::vector at construction time (NFC)

3 years ago[lldb][docs] Use 'any' as the default role in LLDB's sphinx project
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

3 years ago[AArch64] Revert back to Intrinsic<> for TME instructions.
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.

3 years ago[LLD][ELF][AArch64] Set _GLOBAL_OFFSET_TABLE_ at the start of .got
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

3 years ago[AArch64] Make target intrinsics DefaultAttrIntrinsics.
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

3 years ago[RISCV][NFC] Increase test coverage of Zbt extension
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

3 years ago[SLP] add more FMF tests for fmax/fmin reductions; NFC
Sanjay Patel [Mon, 18 Jan 2021 17:24:57 +0000 (12:24 -0500)]
[SLP] add more FMF tests for fmax/fmin reductions; NFC

3 years ago[AArch64] Add test to check the attributes for some intrinsics.
Florian Hahn [Thu, 14 Jan 2021 14:33:16 +0000 (14:33 +0000)]
[AArch64] Add test to check the attributes for some intrinsics.

3 years ago[MLIR] NFC: simplify PresburgerSet::isEqual
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

3 years ago[ARM] Don't handle low overhead branches in AnalyzeBranch
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.

3 years ago[Coroutine] Do not CoroElide if there are musttail calls
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

3 years ago[clangd] Derive new signals in CC from ASTSignals.
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

3 years ago[ARM] Update test target triple. NFC
David Green [Mon, 18 Jan 2021 16:36:00 +0000 (16:36 +0000)]
[ARM] Update test target triple. NFC

3 years ago[MLIR] Support checking if two FlatAffineConstraints are equal
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

3 years agoReland "[AArch64] Attempt to sink mul operands""
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

3 years ago[AArch64] Further restricts when a dup(*ext) can be rearranged
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

3 years ago[WebAssembly] MC layer writes table symbols to object files
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

3 years ago[WebAssembly] Add support for table linking to wasm-ld
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

3 years ago[X86][AVX] IsElementEquivalent - add matchShuffleWithUNPCK + VBROADCAST/VBROADCAST_LO...
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