platform/upstream/llvm.git
3 years ago[CVP] Add more tests for select with overdefined operand (NFC)
Nikita Popov [Sun, 4 Apr 2021 11:45:03 +0000 (13:45 +0200)]
[CVP] Add more tests for select with overdefined operand (NFC)

Also check the case where one operand isn't constant, which isn't
handled right now, because the SPF code requires both operands
to be ranges.

Move the tests to directly check ranges rather than go through an
and, to make it more obvious that this has no relation to bitmasks.

3 years ago[llvm-exegesis] Don't erroneously refuse to measure POPCNT instruction
Roman Lebedev [Sun, 4 Apr 2021 11:36:56 +0000 (14:36 +0300)]
[llvm-exegesis] Don't erroneously refuse to measure POPCNT instruction

3 years agoDon't check that std::pair is trivially copyable on FreeBSD
Dimitry Andric [Sat, 3 Apr 2021 10:20:13 +0000 (12:20 +0200)]
Don't check that std::pair is trivially copyable on FreeBSD

As FreeBSD already used libc++ before it changed its ABI, we still use
the non-trivially copyable version of std::pair, which used to be
exposed via `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`, but more recently via
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`.

Reviewed By: serge-sans-paille

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

3 years ago[mlir][NFC] Fully spell mlir types names in LoopLikeOpInterface, so it can be used...
Butygin [Sat, 3 Apr 2021 19:06:47 +0000 (22:06 +0300)]
[mlir][NFC] Fully spell mlir types names in LoopLikeOpInterface, so it can be used in ops defined outside mlir namespace

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

3 years ago[LVI] Don't bail on overdefined value in select
Nikita Popov [Sun, 4 Apr 2021 08:52:22 +0000 (10:52 +0200)]
[LVI] Don't bail on overdefined value in select

Even if one of the operands is overdefined, we may still produce
a non-overdefined result, e.g. due to a min/max operation. This
matches our handling elsewhere, e.g. for binary operators.

The slot poisoning comment refers to a much older LVI cache
implementation.

3 years ago[CVP] Add test for and of min (NFC)
Nikita Popov [Sun, 4 Apr 2021 09:05:59 +0000 (11:05 +0200)]
[CVP] Add test for and of min (NFC)

The and currently doesn't get optimized away because %a is
overdefined.

3 years agoRevert "Add support for fetching signed values from tagged pointers."
Jason Molenda [Sun, 4 Apr 2021 08:47:35 +0000 (01:47 -0700)]
Revert "Add support for fetching signed values from tagged pointers."

This reverts commit 4d9039c8dc2d1f0be1b5ee486d5a83b1614b038a.

This is causing the greendragon bots to fail most of the time when
running TestNSDictionarySynthetic.py.  Reverting until Jim has a chance
to look at this on Monday.  Running the commands from that test from
the command line, it fails 10-13% of the time on my desktop.

This is a revert of Jim's changes in https://reviews.llvm.org/D99694

3 years ago[NFC][scudo] Restore !UseQuarantine check in tests
Vitaly Buka [Sun, 4 Apr 2021 06:52:06 +0000 (23:52 -0700)]
[NFC][scudo] Restore !UseQuarantine check in tests

The check was removed in D99786 as it seems that quarantine is
irrelevant for the just created allocator. However there is internal
issues with tagged memory access.

We should be able to fix iterateOverChunks for taggin later.

3 years ago[RISCV] Don't convert fshr/fshl to target specific FSL/FSR node if shift amount is...
Craig Topper [Sun, 4 Apr 2021 06:05:34 +0000 (23:05 -0700)]
[RISCV] Don't convert fshr/fshl to target specific FSL/FSR node if shift amount is a constant.

As long as it's a constant we can directly pattern match it
without any problems. It's only when it isn't a constant that
we need to add an AND.

In theory this should allow more target independent optimizations
to remain active.

3 years ago[clang][parser] Set source ranges for GNU-style attributes
Timm Bäder [Thu, 25 Mar 2021 12:32:42 +0000 (13:32 +0100)]
[clang][parser] Set source ranges for GNU-style attributes

Set the source ranges for parsed GNU-style attributes in
ParseGNUAttributes(), the same way that ParseCXX11Attributes() does it.

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

3 years ago[InstCombine] Conditionally fold select i1 into and/or
Juneyoung Lee [Sun, 4 Apr 2021 04:35:33 +0000 (13:35 +0900)]
[InstCombine] Conditionally fold select i1 into and/or

This patch fixes llvm.org/pr49688 by conditionally folding select i1 into and/or:

```
select cond, cond2, false
->
and cond, cond2
```

This is not safe if cond2 is poison whereas cond isn’t.

Unconditionally disabling this transformation affects later pipelines that depend on and/or i1s.
To minimize its impact, this patch conservatively checks whether cond2 is an instruction that
creates a poison or its operand creates a poison.
This approach is similar to what InstSimplify's SimplifyWithOpReplaced is doing.

Reviewed By: nikic

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

3 years ago[InstSimplify] Add a test for folding comparison with a undef vector (NFC)
Juneyoung Lee [Sun, 4 Apr 2021 04:46:32 +0000 (13:46 +0900)]
[InstSimplify] Add a test for folding comparison with a undef vector (NFC)

This is to fix https://reviews.llvm.org/D93990#2666922

3 years ago[InstCombine] precommit pr49688.ll (NFC)
Juneyoung Lee [Sun, 4 Apr 2021 04:29:32 +0000 (13:29 +0900)]
[InstCombine] precommit pr49688.ll (NFC)

This is going to be fixed by D99674

3 years ago[InstCombine] Reapply update_test_checks.py to unsigned-multiply-overflow-check.ll...
Juneyoung Lee [Sun, 4 Apr 2021 04:27:42 +0000 (13:27 +0900)]
[InstCombine] Reapply update_test_checks.py to unsigned-multiply-overflow-check.ll (NFC)

3 years ago[C++20, test] Fix use of undef FileCheck variable
Thomas Preud'homme [Sat, 3 Apr 2021 10:45:59 +0000 (11:45 +0100)]
[C++20, test] Fix use of undef FileCheck variable

Commit f495de43bd5da50286da6020e508d106cfc60f57 forgot two lines when
removing checks for strong and weak equality, resulting in the use of an
undefined FileCheck variable.

Reviewed By: Quuxplusone

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

3 years agoPreprocessor conditionalize some assert-only functions to suppress -Wunused-function
David Blaikie [Sat, 3 Apr 2021 21:02:11 +0000 (14:02 -0700)]
Preprocessor conditionalize some assert-only functions to suppress -Wunused-function

3 years agoAdd void cast to suppress -Wunused-member-variable on assert-only member
David Blaikie [Sat, 3 Apr 2021 21:01:15 +0000 (14:01 -0700)]
Add void cast to suppress -Wunused-member-variable on assert-only member

3 years agoAdd workaround for false positive in -Wfree-nonheap-object
David Blaikie [Sat, 3 Apr 2021 21:00:30 +0000 (14:00 -0700)]
Add workaround for false positive in -Wfree-nonheap-object

3 years agoOpaque pointers: Migrate examples to use load with explicit type
David Blaikie [Sat, 3 Apr 2021 21:00:05 +0000 (14:00 -0700)]
Opaque pointers: Migrate examples to use load with explicit type

3 years ago[mlgo] fix build rules
Mircea Trofin [Sat, 3 Apr 2021 06:45:35 +0000 (23:45 -0700)]
[mlgo] fix build rules

This was prompted by D95727, which had the side-effect to break the
'release' mode build bot for ML-driven policies. The problem is that now
the pre-compiled object files don't get transitively carried through as
'source' anymore; that being said, the previous way of consuming them
was problematic, because it was only working for static builds; in
dynamic builds, the whole tf_xla_runtime was linked, which is
undesirable.

The alternative is to treat tf_xla_runtime as an archive, which then
leads to the desired effect.

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

3 years ago[NFC][X86] Split VPMOV* AVX2 instructions into their own sched class
Roman Lebedev [Sat, 3 Apr 2021 19:23:17 +0000 (22:23 +0300)]
[NFC][X86] Split VPMOV* AVX2 instructions into their own sched class

At least on all three Zen's, all such instructions cleanly map
into this new class with no overrides needed.

3 years ago[TableGen] Use StringRef instead of std::string to split up a string that's being...
Craig Topper [Sat, 3 Apr 2021 18:46:24 +0000 (11:46 -0700)]
[TableGen] Use StringRef instead of std::string to split up a string that's being parsed. NFCI

3 years agoSpeculative attempt to stablize a test
Philip Reames [Sat, 3 Apr 2021 16:44:28 +0000 (09:44 -0700)]
Speculative attempt to stablize a test

New pass manager and old pass manager appear to differ on whether declarations are included in SCCs.  For some reason, which you get appears to depend on build configuration.

3 years ago[lld-macho] Another attempt at fixing 32-bit builds
Jez Ng [Sat, 3 Apr 2021 15:58:23 +0000 (11:58 -0400)]
[lld-macho] Another attempt at fixing 32-bit builds

3 years ago[lld-macho] Fix build on 32-bit systems
Jez Ng [Sat, 3 Apr 2021 15:10:45 +0000 (11:10 -0400)]
[lld-macho] Fix build on 32-bit systems

Summary: Follow-up to D99633.

3 years agoRevert "[lld-link] Enable addrsig table in COFF lto"
Nico Weber [Sat, 3 Apr 2021 14:56:09 +0000 (10:56 -0400)]
Revert "[lld-link] Enable addrsig table in COFF lto"

This reverts commit eabd55b1b2c5e322c3b36cb44348f178692890c8.
Speculative, for crbug.com/1195545

3 years ago[FastISel] Remove kill tracking
Nikita Popov [Tue, 9 Mar 2021 20:04:03 +0000 (21:04 +0100)]
[FastISel] Remove kill tracking

This is a followup to D98145: As far as I know, tracking of kill
flags in FastISel is just a compile-time optimization. However,
I'm not actually seeing any compile-time regression when removing
the tracking. This probably used to be more important in the past,
before FastRA was switched to allocate instructions in reverse
order, which means that it discovers kills as a matter of course.

As such, the kill tracking doesn't really seem to serve a purpose
anymore, and just adds additional complexity and potential for
errors. This patch removes it entirely. The primary changes are
dropping the hasTrivialKill() method and removing the kill
arguments from the emitFast methods. The rest is mechanical fixup.

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

3 years agoSilence `-Wunused-private-field` warning on isIsolatedFromAbove.
Christian Sigg [Thu, 1 Apr 2021 12:52:48 +0000 (14:52 +0200)]
Silence `-Wunused-private-field` warning on isIsolatedFromAbove.

NDEBUG builds currently warn because it's only used inside an assert.

Reviewed By: mehdi_amini

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

3 years ago[InstCombine] Add load/store forwarding test with odd size (NFC)
Nikita Popov [Sat, 3 Apr 2021 13:27:46 +0000 (15:27 +0200)]
[InstCombine] Add load/store forwarding test with odd size (NFC)

Test the case where the type size doesn't equal the store size,
as suggested by bjope.

3 years ago[X86] Fold xor(truncate(xor(x,c1)),c2) -> xor(truncate(x),xor(truncate(c1),c2))
Simon Pilgrim [Sat, 3 Apr 2021 11:43:05 +0000 (12:43 +0100)]
[X86] Fold xor(truncate(xor(x,c1)),c2) -> xor(truncate(x),xor(truncate(c1),c2))

Fixes PR47603

This should probably be transferable to DAGCombine - the main limitation with the existing trunc(logicop) DAG fold is we don't know if legalization has tried to promote truncated logicops already. We might be able to peek through extensions as well.

3 years ago[X86] Add PR47603 test case
Simon Pilgrim [Sat, 3 Apr 2021 10:59:05 +0000 (11:59 +0100)]
[X86] Add PR47603 test case

3 years ago[X86][SSE] isHorizontalBinOp - use getTargetShuffleInputs helper (REAPPLIED)
Simon Pilgrim [Sat, 3 Apr 2021 10:52:31 +0000 (11:52 +0100)]
[X86][SSE] isHorizontalBinOp - use getTargetShuffleInputs helper (REAPPLIED)

Use the getTargetShuffleInputs helper for all shuffle decoding

Reapplied (after reversion in rGfa0aff6d6960) with fix+test for subvector splitting - we weren't accounting for peeking through bitcasts changing the vector element count of the shuffle sources.

3 years agoFix build rules for LLVM_WITH_Z3 after D95727
Bjorn Pettersson [Sat, 3 Apr 2021 10:25:37 +0000 (12:25 +0200)]
Fix build rules for LLVM_WITH_Z3 after D95727

Started to see build errors like this

../lib/Support/Z3Solver.cpp:19:10: fatal error: 'z3.h' file not found
#include <z3.h>
         ^~~~~~
1 error generated.

after commit 43ceb74eb1a5801662419fb66a6bf0d5414f1ec5.

The -isystem path to the Z3_INCLUDE_DIR wen't missing in the compile
commands. No idea why target_include_directories stopped working with
that commit, but using include_directories seem to work better.

3 years ago[Loads] Forward constant vector store to load of first element
Nikita Popov [Sat, 6 Mar 2021 15:10:21 +0000 (16:10 +0100)]
[Loads] Forward constant vector store to load of first element

InstCombine performs simple forwarding from stores to loads, but
currently only handles the case where the load and store have the
same size. This extends it to also handle a store of a constant
with a larger size followed by a load with a smaller size.

This is implemented through ConstantFoldLoadThroughBitcast() which
is fairly primitive (e.g. does not allow storing a large integer
and then loading a small one), but at least can forward the first
element of a vector store. Unfortunately it seems that we currently
don't have a generic helper for "read a constant value as a different
type", it's all tangled up with other logic in either
ConstantFolding or VNCoercion.

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

3 years ago[BasicAA] Don't store AATags in cache key (NFC)
Nikita Popov [Sat, 3 Apr 2021 08:53:56 +0000 (10:53 +0200)]
[BasicAA] Don't store AATags in cache key (NFC)

The AAMDNodes part of the MemoryLocation is not used by the BasicAA
cache, so don't store it. This reduces the size of each cache entry
from 112 bytes to 48 bytes.

3 years ago[BasicAA] Don't pass through AA metadata (NFCI)
Nikita Popov [Sat, 24 Oct 2020 08:39:24 +0000 (10:39 +0200)]
[BasicAA] Don't pass through AA metadata (NFCI)

BasicAA itself doesn't make use of AA metadata, but passes it
through to recursive queries and makes it part of the cache key.
Aliasing decisions that are based on AA metadata (i.e. TBAA and
ScopedAA) are based *only* on AA metadata, so checking them with
different pointer values or sizes is not useful, the result will
always be the same.

While this change is a mild compile-time improvement by itself,
the actual goal here is to reduce the size of AA cache keys in
a followup change.

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

3 years ago[PGO, test] Fix typo in FileCheck var
Thomas Preud'homme [Fri, 2 Apr 2021 23:06:55 +0000 (00:06 +0100)]
[PGO, test] Fix typo in FileCheck var

Reviewed By: xur

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

3 years ago[RISCV] Refactor conversion of B extensions to IR intrinsics a little to reduce clang...
Craig Topper [Sat, 3 Apr 2021 06:34:14 +0000 (23:34 -0700)]
[RISCV] Refactor conversion of B extensions to IR intrinsics a little to reduce clang binary size.

These all pass 1 type to getIntrinsic. So rather than assigning
IntrinsicTypes for each builtin which invokes the SmallVector
constructor, just select the intrinsic ID with a switch and
share a single assignment of IntrinsicTypes.

3 years agoAdd missing override to clang tblgen AttrEmitter
David Blaikie [Sat, 3 Apr 2021 03:47:49 +0000 (20:47 -0700)]
Add missing override to clang tblgen AttrEmitter

3 years ago[clang] NFC: remove trailing white spaces from some tests
Matheus Izvekov [Sat, 3 Apr 2021 01:10:12 +0000 (03:10 +0200)]
[clang] NFC: remove trailing white spaces from some tests

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

3 years ago[lld-macho] Fix -Wsuggest-override after D99633. NFC
Fangrui Song [Sat, 3 Apr 2021 00:04:11 +0000 (17:04 -0700)]
[lld-macho] Fix -Wsuggest-override after D99633. NFC

3 years ago[RISCV] Add signext attribute to i32 orc.b test for RV64 to match other Zbb tests.
Craig Topper [Fri, 2 Apr 2021 23:49:49 +0000 (16:49 -0700)]
[RISCV] Add signext attribute to i32 orc.b test for RV64 to match other Zbb tests.

Shows the sext.w at the end that would show up in C code. I'm thinking
orc.b would preserve sign bits from it's input, but I'm not sure.

3 years ago[gn build] hook up tsan on macOS too
Nico Weber [Fri, 2 Apr 2021 23:21:34 +0000 (19:21 -0400)]
[gn build] hook up tsan on macOS too

Mostly just works already.

3 years ago[lld-macho][nfc] Refactor in preparation for 32-bit support
Jez Ng [Fri, 2 Apr 2021 22:46:18 +0000 (18:46 -0400)]
[lld-macho][nfc] Refactor in preparation for 32-bit support

The main challenge was handling the different on-disk structures (e.g.
`mach_header` vs `mach_header_64`). I tried to strike a balance between
sprinkling `target->wordSize == 8` checks everywhere (branchy = slow, and ugly)
and templatizing everything (causes code bloat, also ugly). I think I struck a
decent balance by judicious use of type erasure.

Note that LLD-ELF has a similar architecture, though it seems to use more templating.

Linking chromium_framework takes about the same time before and after this
change:

      N           Min           Max        Median           Avg        Stddev
  x  20          4.52          4.67         4.595        4.5945   0.044423204
  +  20           4.5          4.71         4.575         4.582   0.056344803
  No difference proven at 95.0% confidence

Reviewed By: #lld-macho, oontvoo

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

3 years ago[gn build] (manually) port 4c58f333f141
Nico Weber [Fri, 2 Apr 2021 22:21:37 +0000 (18:21 -0400)]
[gn build] (manually) port 4c58f333f141

3 years agoRevert "[sanitizer] Simplify GetTls with dl_iterate_phdr"
Nico Weber [Fri, 2 Apr 2021 22:12:45 +0000 (18:12 -0400)]
Revert "[sanitizer] Simplify GetTls with dl_iterate_phdr"

This reverts commit 9be8f8b34d9b150cd1811e3556fe9d0cd735ae29.
This breaks tsan on Ubuntu 16.04:

    $ cat tiny_race.c
    #include <pthread.h>
    int Global;
    void *Thread1(void *x) {
      Global = 42;
      return x;
    }
    int main() {
      pthread_t t;
      pthread_create(&t, NULL, Thread1, NULL);
      Global = 43;
      pthread_join(t, NULL);
      return Global;
    }
    $ out/gn/bin/clang -fsanitize=thread -g -O1 tiny_race.c --sysroot ~/src/chrome/src/build/linux/debian_sid_amd64-sysroot/
    $ docker run -v $PWD:/foo ubuntu:xenial /foo/a.out
    FATAL: ThreadSanitizer CHECK failed: ../../compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp:447 "((thr_beg)) >= ((tls_addr))" (0x7fddd76beb80, 0xfffffffffffff980)
        #0 <null> <null> (a.out+0x4960b6)
        #1 <null> <null> (a.out+0x4b677f)
        #2 <null> <null> (a.out+0x49cf94)
        #3 <null> <null> (a.out+0x499bd2)
        #4 <null> <null> (a.out+0x42aaf1)
        #5 <null> <null> (libpthread.so.0+0x76b9)
        #6 <null> <null> (libc.so.6+0x1074dc)

(Get the sysroot from here: https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/500976182686961e34974ea7bdc0a21fca32be06/debian_sid_amd64_sysroot.tar.xz)

Also reverts follow-on commits:
This reverts commit 58c62fd9768594ec8dd57e8320ba2396bf8b87e5.
This reverts commit 31e541e37587100a5b21378380f54c028fda2d04.

3 years ago[CSSPGO][Test] XFAIL profile-context-tracker-debug.ll on AIX
Jinsong Ji [Fri, 2 Apr 2021 22:15:56 +0000 (22:15 +0000)]
[CSSPGO][Test] XFAIL profile-context-tracker-debug.ll on AIX

The case start to fail since https://reviews.llvm.org/D99351.

Looks like to me that the node order within Context Profile Tree depends
on the implmementation of std::hash<std::string>.

Unfortunately, the current clang implementation generate different values on
AIX (or for all big-endian systems?)

On Linux:
main: 2408804140(0x8f936f2c)
external:  896680882(0x357243b2)
externalA:  620231129(0x24f7f9d9)

On AIX:
main:  994322777(0x3b442959)
external: 3548191215(0xd37d19ef)
externalA: 1390365101(0x52df49ad)

XFAIL it first while we discuss and seek for a fix.

Reviewed By: wenlei

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

3 years ago[LLDB] Sleep for 5 second TestVSCode_launch test_progress_events
Muhammad Omair Javaid [Fri, 2 Apr 2021 22:02:39 +0000 (03:02 +0500)]
[LLDB] Sleep for 5 second TestVSCode_launch test_progress_events

This increases sleep time to 5 seconds as the test still fails
intermittently. If failure persists then we will disable/fix the
test.

3 years ago[flang] Address more MSVC build issues with reductions
peter klausler [Fri, 2 Apr 2021 18:02:26 +0000 (11:02 -0700)]
[flang] Address more MSVC build issues with reductions

Move #include <complex.h> to complex-reduction.h, where
it is needed in MSVC builds.

Exclude code that requires a native 128-bit integer type from
compilation by MSVC.

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

3 years ago[NFC][scudo] Move macro into a shared header
Vitaly Buka [Fri, 2 Apr 2021 20:51:11 +0000 (13:51 -0700)]
[NFC][scudo] Move macro into a shared header

3 years ago[NFC][scudo] Add test header int CMake file
Vitaly Buka [Fri, 2 Apr 2021 20:49:51 +0000 (13:49 -0700)]
[NFC][scudo] Add test header int CMake file

3 years ago[mlir][tosa] Add tosa.reduce_any and tosa.reduce_all linalg lowering
Rob Suderman [Fri, 2 Apr 2021 21:23:06 +0000 (14:23 -0700)]
[mlir][tosa] Add tosa.reduce_any and tosa.reduce_all linalg lowering

Added lowerings for Tosa's reduce boolean operations. This includes a fix to
maintain the output rank of reduce operations.

Reviewed By: silvas

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

3 years agoFix build bot problem with missing OMPC_novariants in switch.
Jennifer Yu [Fri, 2 Apr 2021 20:56:57 +0000 (13:56 -0700)]
Fix build bot problem with missing OMPC_novariants in switch.

3 years ago[KnownBits] Add KnownBits::haveNoCommonBitsSet helper. NFCI.
Simon Pilgrim [Fri, 2 Apr 2021 18:33:18 +0000 (19:33 +0100)]
[KnownBits] Add KnownBits::haveNoCommonBitsSet helper. NFCI.

Include exhaustive test coverage.

3 years ago[mlir] Add optional TypeConverter for materializations.
Sean Silva [Fri, 2 Apr 2021 00:44:08 +0000 (17:44 -0700)]
[mlir] Add optional TypeConverter for materializations.

`ConversionPatternRewriter::applySignatureConversion` did not have a way
to apply a signature conversion that involved materializations.

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

3 years agoUse tablegen to diagnose mutually exclusive attributes
Aaron Ballman [Fri, 2 Apr 2021 20:33:14 +0000 (16:33 -0400)]
Use tablegen to diagnose mutually exclusive attributes

Currently, when one or more attributes are mutually exclusive, the
developer adding the attribute has to manually emit diagnostics. In
practice, this is highly error prone, especially for declaration
attributes, because such checking is not trivial. Redeclarations
require you to write a "merge" function to diagnose mutually exclusive
attributes and most attributes get this wrong.

This patch introduces a table-generated way to specify that a group of
two or more attributes are mutually exclusive:

def : MutualExclusions<[Attr1, Attr2, Attr3]>;

This works for both statement and declaration attributes (but not type
attributes) and the checking is done either from the common attribute
diagnostic checking code or from within mergeDeclAttribute() when
merging redeclarations.

3 years ago[NFC][scudo] Split ScudoCombinedTest.BasicCombined
Vitaly Buka [Fri, 2 Apr 2021 02:19:38 +0000 (19:19 -0700)]
[NFC][scudo] Split ScudoCombinedTest.BasicCombined

Existing implementations took up to 30 minutues to execute on my setup.
Now it's more convenient to debug a single test.

Reviewed By: cryptoad

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

3 years ago[OPENMP5.1]Initial support for novariants clause.
Jennifer Yu [Wed, 31 Mar 2021 19:26:47 +0000 (12:26 -0700)]
[OPENMP5.1]Initial support for novariants clause.
Added basic parsing/sema/serialization support for the 'novariants' clause.

3 years ago[mlir] Emit errors when creating unregistered attributes/types when not allowed
River Riddle [Fri, 2 Apr 2021 19:45:19 +0000 (12:45 -0700)]
[mlir] Emit errors when creating unregistered attributes/types when not allowed

This was missed when verification for creating unregistered operations was added.

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

3 years ago[nfc] [llvm] Make DWARFListTableBase::findList const
Jan Kratochvil [Fri, 2 Apr 2021 19:40:58 +0000 (21:40 +0200)]
[nfc] [llvm] Make DWARFListTableBase::findList const

Reviewed By: dblaikie

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

3 years ago[OPENMP][DOCS]Update status of the supported constructs, NFC.
Mike Rice [Fri, 2 Apr 2021 19:28:33 +0000 (12:28 -0700)]
[OPENMP][DOCS]Update status of the supported constructs, NFC.

3 years agoRevert "[RISCV] Try using toupper instead of std::toupper to make the build bots...
Craig Topper [Fri, 2 Apr 2021 19:29:56 +0000 (12:29 -0700)]
Revert "[RISCV] Try using toupper instead of std::toupper to make the build bots happy."

This reverts commit 5311abc7a24e4170e5e6d06f1022da87f1413dd7.

jrtc27 included the proper header in 1bd4986e7cdc124fecbf4b4527039a9a845e61f5
while I was trying to figure out what llvm/clang usually used.

3 years ago[RISCV] Try using toupper instead of std::toupper to make the build bots happy.
Craig Topper [Fri, 2 Apr 2021 19:28:53 +0000 (12:28 -0700)]
[RISCV] Try using toupper instead of std::toupper to make the build bots happy.

3 years ago[Sema] Fix Windows build after b001d574d7d9
Jessica Clarke [Fri, 2 Apr 2021 19:27:58 +0000 (20:27 +0100)]
[Sema] Fix Windows build after b001d574d7d9

3 years ago[ms] [llvm-ml] Accept /WX to signal that warnings should be fatal.
Eric Astor [Fri, 2 Apr 2021 18:09:39 +0000 (14:09 -0400)]
[ms] [llvm-ml] Accept /WX to signal that warnings should be fatal.

Define -fatal-warnings to make warnings fatal, and accept /WX as an ML.EXE compatible alias for it.

Also make sure that if Warning() returns true, we always treat it as an error.

Reviewed By: thakis

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

3 years ago[RISCV] Add IR intrinsics for Zbc extension
Levy Hsu [Fri, 2 Apr 2021 18:42:28 +0000 (11:42 -0700)]
[RISCV] Add IR intrinsics for Zbc extension

Head files are included in a separate patch in case the name needs to be changed.

RV32 / 64:
clmul
clmulh
clmulr

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

3 years ago[mlir] Rename linalg.pooling operations to have a FOp postfix for floating point
Rob Suderman [Thu, 1 Apr 2021 23:58:01 +0000 (16:58 -0700)]
[mlir] Rename linalg.pooling operations to have a FOp postfix for floating point

Linalg pooling operations only support floating point currently but integer
variants will soon be needed. Renaming to uncluse a FOp postfix to clarify.

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

3 years agoRecommit "[RISCV] Add IR intrinsic for Zbb extension"
Levy Hsu [Fri, 2 Apr 2021 18:43:58 +0000 (11:43 -0700)]
Recommit "[RISCV] Add IR intrinsic for Zbb extension"

Forgot to amend the Author.

Original commit message:

Header files are included in a separate patch in case the name needs to be changed.

RV32 / 64:
orc.b

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

3 years agoRevert "[RISCV] Add IR intrinsic for Zbb extension"
Craig Topper [Fri, 2 Apr 2021 18:43:30 +0000 (11:43 -0700)]
Revert "[RISCV] Add IR intrinsic for Zbb extension"

This reverts commit 1808194590dd2b308bc146406425d5d52e46b7e6.

I forgot to change the author.

3 years ago[TextAPI] run clang-format on violating sections, NFC
Cyndy Ishida [Fri, 2 Apr 2021 18:42:48 +0000 (11:42 -0700)]
[TextAPI] run clang-format on violating sections, NFC

3 years ago[RISCV] Add IR intrinsic for Zbb extension
Craig Topper [Fri, 2 Apr 2021 18:15:29 +0000 (11:15 -0700)]
[RISCV] Add IR intrinsic for Zbb extension

Header files are included in a separate patch in case the name needs to be changed.

RV32 / 64:
orc.b

3 years ago[SLPVectorizer] Fix divide-by-zero after D99719
Fangrui Song [Fri, 2 Apr 2021 18:13:51 +0000 (11:13 -0700)]
[SLPVectorizer] Fix divide-by-zero after D99719

Will add a test case later.

3 years ago[ms] [llvm-ml] Fix case-sensitivity for variables and textmacros
Eric Astor [Fri, 2 Apr 2021 17:01:47 +0000 (13:01 -0400)]
[ms] [llvm-ml] Fix case-sensitivity for variables and textmacros

Make variables and text-macro references case-insensitive, to match ml.exe.

Also improve error handling for text-macro expansion.

Reviewed By: thakis

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

3 years ago[RISCV] Add IR intrinsic for Zbr extension
Levy Hsu [Fri, 2 Apr 2021 17:27:30 +0000 (10:27 -0700)]
[RISCV] Add IR intrinsic for Zbr extension

Implementation for RISC-V Zbr extension intrinsic.

Header files are included in separate patch in case the name needs to be changed

RV32 / 64:
        crc32b
        crc32h
        crc32w
        crc32cb
        crc32ch
        crc32cw

RV64 Only:
        crc32d
        crc32cd

Reviewed By: craig.topper

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

3 years ago[Hexagon, test] Fix use of undef FileCheck var
Thomas Preud'homme [Thu, 1 Apr 2021 23:54:06 +0000 (00:54 +0100)]
[Hexagon, test] Fix use of undef FileCheck var

LLVM test CodeGen/Hexagon/hwloop3.ll tries to check for the absence of a
sequence of consecutive instructions with several CHECK-NOT with one of
those directives using a variable defined in another. However CHECK-NOT
are checked independently so that is using a variable defined in a
pattern that should not occur in the input.

This commit merges the two CHECK-NOT into a single CHECK-NOT that
matches the content of two successive non-blank lines, thereby allowing
to preserve the intent of the test.

Reviewed By: bcahoon

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

3 years ago[flang] TRANSFER() intrinsic function
peter klausler [Fri, 2 Apr 2021 16:30:31 +0000 (09:30 -0700)]
[flang] TRANSFER() intrinsic function

API, implementation, and unit tests for the intrinsic
function TRANSFER.

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

3 years ago[RISCV] Improve 64-bit integer constant materialization for more cases.
Craig Topper [Fri, 2 Apr 2021 17:17:54 +0000 (10:17 -0700)]
[RISCV] Improve 64-bit integer constant materialization for more cases.

For positive constants we try shifting left to remove leading zeros
and fill the bottom bits with 1s. We then materialize that constant
shift it right.

This patch adds a new strategy to try filling the bottom bits with
zeros instead. This catches some additional cases.

3 years ago[RISCV] Add missing CHECK-EXPAND line to one case in rv64i-aliases-valid.s.
Craig Topper [Fri, 2 Apr 2021 17:16:49 +0000 (10:16 -0700)]
[RISCV] Add missing CHECK-EXPAND line to one case in rv64i-aliases-valid.s.

Use -NEXT to protect against other missing lines.

3 years ago[InstCombine] fold not+or+neg
Sanjay Patel [Fri, 2 Apr 2021 15:57:34 +0000 (11:57 -0400)]
[InstCombine] fold not+or+neg

~((-X) | Y) --> (X - 1) & (~Y)

We generally prefer 'add' over 'sub', this reduces the
dependency chain, and this looks better for codegen on
x86, ARM, and AArch64 targets.

https://llvm.org/PR45755

https://alive2.llvm.org/ce/z/cxZDSp

3 years ago[InstCombine] add tests for not+or+neg; NFC
Sanjay Patel [Fri, 2 Apr 2021 15:38:24 +0000 (11:38 -0400)]
[InstCombine] add tests for not+or+neg; NFC

https://llvm.org/PR45755

3 years ago[GVNSink] auto-generate test checks; NFC
Sanjay Patel [Thu, 1 Apr 2021 18:13:24 +0000 (14:13 -0400)]
[GVNSink] auto-generate test checks; NFC

3 years ago[SCCP] Avoid modifying AdditionalUsers while iterating over it
Dimitry Andric [Sun, 14 Mar 2021 16:41:21 +0000 (17:41 +0100)]
[SCCP] Avoid modifying AdditionalUsers while iterating over it

When run under valgrind, or with a malloc that poisons freed memory,
this can lead to segfaults or other problems.

To avoid modifying the AdditionalUsers DenseMap while still iterating,
save the instructions to be notified in a separate SmallPtrSet, and use
this to later call OperandChangedState on each instruction.

Fixes PR49582.

Reviewed By: fhahn

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

3 years ago[gn build] add build file for tsan runtime
Nico Weber [Fri, 2 Apr 2021 14:37:01 +0000 (10:37 -0400)]
[gn build] add build file for tsan runtime

Linux-only for now. Some mac bits stubbed out, but not tested.

Good enough for the tiny_race.c example at
https://clang.llvm.org/docs/ThreadSanitizer.html :

   $ out/gn/bin/clang -fsanitize=address -g -O1 tiny_race.c
   $ while true; do ./a.out || echo $? ; done

While here, also make `-fsanitize=address` work for .c files.

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

3 years ago[LV] Hoist mapping of IR operands to VPValues (NFC).
Florian Hahn [Fri, 2 Apr 2021 12:28:44 +0000 (13:28 +0100)]
[LV] Hoist mapping of IR operands to VPValues (NFC).

This patch moves mapping of IR operands to VPValues out of
tryToCreateWidenRecipe. This allows using existing VPValue operands when
widening recipes directly, which will be introduced in future patches.

3 years ago[rs4gc] Use loops instead of straightline code for attribute stripping [nfc]
Philip Reames [Fri, 2 Apr 2021 16:23:50 +0000 (09:23 -0700)]
[rs4gc] Use loops instead of straightline code for attribute stripping [nfc]

Mostly because I'm about to add more attributes and the straightline copies get much uglier.  What's currently there isn't too bad.

3 years ago[lld-macho][NFC] Remove redundant member from class Defined
Greg McGary [Fri, 2 Apr 2021 01:42:44 +0000 (18:42 -0700)]
[lld-macho][NFC] Remove redundant member from class Defined

`class Symbol` defines a data member `InputFile *file;`
`class Defined` inherits from `Symbol` and also defines a data member `InputFile *file;` for no apparent purpose.

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

3 years ago[rs4gc] Strip nofree and nosync attributes when lowering from abstract model
Philip Reames [Fri, 2 Apr 2021 16:12:24 +0000 (09:12 -0700)]
[rs4gc] Strip nofree and nosync attributes when lowering from abstract model

The safepoints being inserted exists to free memory, or coordinate with another thread to do so.  Thus, we must strip any inferred attributes and reinfer them after the lowering.

I'm not aware of any active miscompiles caused by this, but since I'm working on strengthening inference of both and leveraging them in the optimization decisions, I figured a bit of future proofing was warranted.

3 years ago[rs4gc] add tests for existing code stripping attributes from function signatures
Philip Reames [Fri, 2 Apr 2021 15:56:49 +0000 (08:56 -0700)]
[rs4gc] add tests for existing code stripping attributes from function signatures

3 years agoRemove attribute handling code for simple attributes; NFC
Aaron Ballman [Fri, 2 Apr 2021 15:33:04 +0000 (11:33 -0400)]
Remove attribute handling code for simple attributes; NFC

Attributes that set the SimpleHandler flag in Attr.td don't need to be
explicitly handled in SemaDeclAttr.cpp.

3 years ago[flang] Fix MSVC build breakage
peter klausler [Fri, 2 Apr 2021 15:26:39 +0000 (08:26 -0700)]
[flang] Fix MSVC build breakage

A recent patch exposed an assumption that "long double" is (at least)
an 80-bit floating-point type, which of course it is not in MSVC.
Also get it right for non-x87 floating-point.

3 years ago[GlobalISel] Allow different types for G_SBFX and G_UBFX operands
Brendon Cahoon [Tue, 30 Mar 2021 15:19:29 +0000 (11:19 -0400)]
[GlobalISel] Allow different types for G_SBFX and G_UBFX operands

Change the definition of G_SBFX and G_UBFX so that the lsb and width
can have different types than the src and dst operands.

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

3 years ago[LVI] Use range metadata on intrinsics
Nikita Popov [Fri, 2 Apr 2021 14:41:58 +0000 (16:41 +0200)]
[LVI] Use range metadata on intrinsics

If we don't know how to handle an intrinsic, we should still
make use of normal call range metadata.

3 years ago[CVP] Add test for !range on intrinsic (NFC)
Nikita Popov [Fri, 2 Apr 2021 14:38:38 +0000 (16:38 +0200)]
[CVP] Add test for !range on intrinsic (NFC)

3 years ago[SLP]Added a test for min/max reductions with the key store inside, NFC.
Alexey Bataev [Fri, 2 Apr 2021 14:37:40 +0000 (07:37 -0700)]
[SLP]Added a test for min/max reductions with the key store inside, NFC.

3 years ago[SLP]Fix a bug in min/max reduction, number of condition uses.
Alexey Bataev [Thu, 1 Apr 2021 18:02:34 +0000 (11:02 -0700)]
[SLP]Fix a bug in min/max reduction, number of condition uses.

The ultimate reduction node may have multiple uses, but if the ultimate
reduction is min/max reduction and based on SelectInstruction, the
condition of this select instruction must have only single use.

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

3 years agoRevert "[X86][SSE] isHorizontalBinOp - use getTargetShuffleInputs helper"
Nico Weber [Fri, 2 Apr 2021 13:54:22 +0000 (09:54 -0400)]
Revert "[X86][SSE] isHorizontalBinOp - use getTargetShuffleInputs helper"

This reverts commit 500969f1d0b1d92d7c4ccfb6bf8807de96b7e4a0.
Makes clang assert compiling avx2 code, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1195353#c4
for a standalone repro.

3 years ago[TableGen] [Docs] Add lldb-tblgen to command guide; add 4 guide stubs
Paul C. Anagnostopoulos [Tue, 30 Mar 2021 16:37:13 +0000 (12:37 -0400)]
[TableGen] [Docs] Add lldb-tblgen to command guide; add 4 guide stubs

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

3 years agoRestore 8954fd436c7 after c06a8f9caa51c
Nico Weber [Fri, 2 Apr 2021 13:19:31 +0000 (09:19 -0400)]
Restore 8954fd436c7 after c06a8f9caa51c

Else, just-built clang can't build programs that include libc++ headers
on macOS if you build via the 'all' target.

3 years ago[NFC][SVE] update sve-intrinsics-int-arith.ll under update_llc_test_checks.py
Jun Ma [Fri, 2 Apr 2021 02:10:35 +0000 (10:10 +0800)]
[NFC][SVE] update sve-intrinsics-int-arith.ll under update_llc_test_checks.py

3 years ago[AArch64][SVE] Lowering sve.dot to DOT node
Jun Ma [Thu, 1 Apr 2021 11:44:59 +0000 (19:44 +0800)]
[AArch64][SVE] Lowering sve.dot to DOT node

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