platform/upstream/llvm.git
3 years ago[RISCV] Check all 64-bits of the mask in SelectRORIW.
Craig Topper [Wed, 4 Nov 2020 18:15:30 +0000 (10:15 -0800)]
[RISCV] Check all 64-bits of the mask in SelectRORIW.

We need to ensure the upper 32 bits of the mask are zero.
So that the srl shifts zeroes into the lower 32 bits.

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

3 years agoSwitch from C-style comments `/* ... */` to C++ style `//` (NFC)
Mehdi Amini [Wed, 4 Nov 2020 18:08:34 +0000 (18:08 +0000)]
Switch from C-style comments `/* ... */` to C++ style `//` (NFC)

This is mostly a scripted update, it may not be perfect.

function replace() {
  FROM=$1
  TO=$2
  git grep "$FROM" $REPO_PATH |cut -f 1 -d : | sort -u | \
    while read file; do
      sed -i "s#$FROM#$TO#" $file ;
    done
}

replace '|\*===----------------------------------------------------------------------===\*|$' '//===----------------------------------------------------------------------===//'
replace '^/\* =' '//=='
replace '^/\*=' '//='
replace '^\\\*=' '//='
replace '^|\*' '//'
replace ' \*|$' ''
replace '=\*\\$' '=//'
replace '== \*/$' '===//'
replace '==\*/$' '==//'
replace '^/\*\*\(.*\)\*/$' '///\1'
replace '^/\*\(.*\)\*/$' '//\1'
replace '//============================================================================//' '//===----------------------------------------------------------------------===//'

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

3 years ago[UBSan] Cannot negate smallest negative signed integer
Christopher Tetreault [Wed, 4 Nov 2020 17:16:09 +0000 (09:16 -0800)]
[UBSan] Cannot negate smallest negative signed integer

Silence warning Undefined Behavior Sanitzer warning:
runtime error: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself

Reviewed By: paulwalker-arm

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

3 years ago[RISCV] Remove custom isel for (srl (shl val, 32), imm). Use pattern instead. NFCI
Craig Topper [Wed, 4 Nov 2020 17:59:14 +0000 (09:59 -0800)]
[RISCV] Remove custom isel for (srl (shl val, 32), imm). Use pattern instead. NFCI

We don't need custom matching, we just a need a predicate to check
the immediate is greater than 32. We can use the existing ImmSub32
to adjust the immediate.

I've also used the new predicate in the other location that used
ImmSub32. I tried to create a test case where we would break without
the greater than 32 check on that pattern, but DAG combine defeated me.
Still seemed safer to have it.

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

3 years ago[AMDGPU] Resolve pseudo registers at encoding uses
Joe Nash [Tue, 3 Nov 2020 22:26:29 +0000 (17:26 -0500)]
[AMDGPU] Resolve pseudo registers at encoding uses

Pseudo-registers allow different register encodings
between gpu generations. Make sure we resolve the
pseudo regs to real regs whenever we get their
hardware encoding.
Using the correct encodings revealed a register
bank conflict and an unnecessary write dependency.
Tests have been updated to match.

Reviewed By: rampitec

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

Change-Id: I73c154cd24aecc820993b50bebaf4df97a5710ca

3 years agoRevert "[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode...
Fangrui Song [Wed, 4 Nov 2020 17:54:04 +0000 (09:54 -0800)]
Revert "[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode::G_MUL handling with the common KnownBits::computeForMul implementation"

This reverts commit 0b8711e1af97d6c82dc9d25c12c5a06af060cc56 which broke GlobalISelTests AArch64GISelMITest.TestKnownBits

3 years ago[NewPM] Don't run before pass instrumentation on required passes
Arthur Eubanks [Sun, 1 Nov 2020 06:08:15 +0000 (23:08 -0700)]
[NewPM] Don't run before pass instrumentation on required passes

This allows those instrumentation to log when they decide to skip a
pass. This provides extra helpful info for optnone functions and also
will help with opt-bisect.

Have OptNoneInstrumentation print when it skips due to seeing optnone.

Reviewed By: asbirlea

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

3 years ago[AMDGPU] Fix iterating in SIFixSGPRCopies
Sebastian Neubauer [Thu, 29 Oct 2020 16:52:22 +0000 (17:52 +0100)]
[AMDGPU] Fix iterating in SIFixSGPRCopies

The insertion of waterfall loops splits the current basic block into
three blocks. So the basic block that we iterate over must be updated.

This failed assert(!NodePtr->isKnownSentinel()) in ilist_iterator for
divergent calls in branches before.

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

3 years ago[llvm-objcopy] Make --set-section-flags work with --add-section
Fangrui Song [Wed, 4 Nov 2020 17:39:14 +0000 (09:39 -0800)]
[llvm-objcopy] Make --set-section-flags work with --add-section

This matches behavior GNU objcopy and can simplify clang-offload-bundler
(which currently works around the issue by invoking llvm-objcopy twice).

Reviewed By: jhenderson

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

3 years ago[llvm-objcopy][MachO] Make isValidMachOCannonicalName static
Alexander Shaposhnikov [Wed, 4 Nov 2020 08:30:43 +0000 (00:30 -0800)]
[llvm-objcopy][MachO] Make isValidMachOCannonicalName static

This diff makes the function isValidMachOCannonicalName static.
NFC.

Test plan: make check-all

3 years agoAdd facilities to print/parse a pass pipeline through the C API
Mehdi Amini [Wed, 4 Nov 2020 00:08:35 +0000 (00:08 +0000)]
Add facilities to print/parse a pass pipeline through the C API

This also includes and exercise a register function for individual
passes.

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

3 years ago[KnownBits] KnownBits::computeForMul - avoid unnecessary APInt copies. NFCI.
Simon Pilgrim [Wed, 4 Nov 2020 17:15:54 +0000 (17:15 +0000)]
[KnownBits] KnownBits::computeForMul - avoid unnecessary APInt copies. NFCI.

Use const references instead.

3 years ago[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode::G_MUL handl...
Simon Pilgrim [Wed, 4 Nov 2020 17:06:19 +0000 (17:06 +0000)]
[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode::G_MUL handling with the common KnownBits::computeForMul implementation

Avoid code duplication

3 years ago[Dexter] add visual studio 2019 debugger support
Nabeel Omer [Wed, 4 Nov 2020 16:57:19 +0000 (16:57 +0000)]
[Dexter] add visual studio 2019 debugger support

Adds visual studio debugger support to dexter via option --debugger vs2019

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

Author:    Nabeel Omer <nabeel.omer@sony.com>

3 years ago[Dexter] add an optnone attribute debug experience test for loops.
Nabeel Omer [Wed, 4 Nov 2020 16:54:36 +0000 (16:54 +0000)]
[Dexter] add an optnone attribute debug experience test for loops.

adds a test that checks debugging experience in functions that are marked
__attribute__((optnone)) and have loops inside them.

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

Author:    Nabeel Omer <nabeel.omer@sony.com>

3 years ago[libc++] Remove the ability to not install the support headers
Louis Dionne [Wed, 4 Nov 2020 16:43:47 +0000 (11:43 -0500)]
[libc++] Remove the ability to not install the support headers

Those are part of the library, and shipping them just adds a tiny bit of
size to the distribution. This was originally added in b422ecc7de0b to
make it possible to match the Makefile build, which doesn't exist anymore.

The upside is build system simplification.

3 years agoRevert "Start of an llvm.coro.async implementation"
Arnold Schwaighofer [Wed, 4 Nov 2020 16:25:24 +0000 (08:25 -0800)]
Revert "Start of an llvm.coro.async implementation"

This reverts commit ea606cced0583d1dbd4c44680601d1d4e9a56e58.

This patch causes memory sanitizer failures sanitizer-x86_64-linux-fast.

3 years ago[libc++] Split off part of a test that require signals into a separate test
Louis Dionne [Wed, 4 Nov 2020 16:19:52 +0000 (11:19 -0500)]
[libc++] Split off part of a test that require signals into a separate test

This will allow running the basic test on all platforms, and the part that
requires signals on platforms that support them only.

3 years agoFix breakage in D89615 (due to cmake version 3.16.5)
Vy Nguyen [Wed, 4 Nov 2020 15:13:47 +0000 (10:13 -0500)]
Fix breakage in D89615 (due to cmake version 3.16.5)

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

3 years ago[clangd] Cleanup dependencies around RemoteIndex
Kadir Cetinkaya [Wed, 4 Nov 2020 08:48:23 +0000 (09:48 +0100)]
[clangd] Cleanup dependencies around RemoteIndex

RemoteIndexClient implementations only depends on clangdSupport for
logging functionality and has no dependence on clangDeamon itself. This clears
out that link time dependency and enables depending on it in clangDeamon itself,
so that we can have other index implementations that makes use of the
RemoteIndex.

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

3 years ago[gn build] Port d1b2a523191
LLVM GN Syncbot [Wed, 4 Nov 2020 15:36:49 +0000 (15:36 +0000)]
[gn build] Port d1b2a523191

3 years ago[clang-tidy] Add signal-handler-check for SEI CERT rule SIG30-C
Balázs Kéri [Wed, 4 Nov 2020 14:09:09 +0000 (15:09 +0100)]
[clang-tidy] Add signal-handler-check for SEI CERT rule SIG30-C

SIG30-C. Call only asynchronous-safe functions within signal handlers

First version of this check, only minimal list of functions is allowed
("strictly conforming" case), for C only.

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

3 years agoStart of an llvm.coro.async implementation
Arnold Schwaighofer [Wed, 21 Oct 2020 21:41:47 +0000 (14:41 -0700)]
Start of an llvm.coro.async implementation

This patch adds the `async` lowering of coroutines.

This will be used by the Swift frontend to lower async functions. In
contrast to the `retcon` lowering the frontend needs to be in control
over control-flow at suspend points as execution might be suspended at
these points.

This is very much work in progress and the implementation will change as
it evolves with the frontend. As such the documentation is lacking
detail as some of it might change.

rdar://70097093

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

3 years ago[ms] [llvm-ml] Enable support for MASM-style macro procedures
Eric Astor [Wed, 4 Nov 2020 15:00:51 +0000 (10:00 -0500)]
[ms] [llvm-ml] Enable support for MASM-style macro procedures

Allows the MACRO directive to define macro procedures with parameters and macro-local symbols.

Supports required and optional parameters (including default values), and matches ml64.exe for its macro-local symbol handling (up to 65536 macro-local symbols in any translation unit).

Reviewed By: thakis

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

3 years ago[lldb] Remove [US]IntValueIsValidForSize from CommandObjectMemory
Pavel Labath [Wed, 4 Nov 2020 15:25:38 +0000 (16:25 +0100)]
[lldb] Remove [US]IntValueIsValidForSize from CommandObjectMemory

Use llvm::is(U)IntN (MathExtras.h) instead.

3 years ago[lldb/Utility] Delete Scalar::[US]IntValueIsValidForSize
Pavel Labath [Wed, 4 Nov 2020 14:13:44 +0000 (15:13 +0100)]
[lldb/Utility] Delete Scalar::[US]IntValueIsValidForSize

It's unused, and the same functionality is available in llvm (is(U)IntN
in MathExtras.h).

3 years agoUse isa<> instead of dyn_cast<> to avoid unused variable warning. NFCI.
Simon Pilgrim [Wed, 4 Nov 2020 14:21:51 +0000 (14:21 +0000)]
Use isa<> instead of dyn_cast<> to avoid unused variable warning. NFCI.

3 years agoFix gcc braces warning. NFCI.
Simon Pilgrim [Wed, 4 Nov 2020 14:20:19 +0000 (14:20 +0000)]
Fix gcc braces warning. NFCI.

gcc warns that the EXPECT_TRUE macro isn't surrounded by if() {} - we already do this in other cases in the file.

3 years ago[libc++] NFCI: Refactor chrono.cpp to make it easier to support new platforms
Louis Dionne [Wed, 4 Nov 2020 15:14:13 +0000 (10:14 -0500)]
[libc++] NFCI: Refactor chrono.cpp to make it easier to support new platforms

Also simplify a few conditionals along the way for readability.

3 years agoAdd a floating-point suffix to silence warnings; NFC
Aaron Ballman [Wed, 4 Nov 2020 15:06:44 +0000 (10:06 -0500)]
Add a floating-point suffix to silence warnings; NFC

This silences about 6000 warnings about truncating from double to float
with Visual Studio.

3 years ago[compiler-rt][AIX]: Link compiler-rt profile library when -fprofile-generate is specified
etiotto [Wed, 4 Nov 2020 14:49:52 +0000 (09:49 -0500)]
[compiler-rt][AIX]: Link compiler-rt profile library when -fprofile-generate is specified

This patch enhances the clang driver to link the runtime profile
library on AIX when the -fprofile-generate option is used.

Reviewed By: phosek

Differentail Revision: https://reviews.llvm.org/D90641

3 years ago[NFC]Remove unused variable
Vy Nguyen [Wed, 4 Nov 2020 14:54:07 +0000 (09:54 -0500)]
[NFC]Remove unused variable
Accidentally committed in D89615

3 years agoDisable emulated-tls for compiler-rt+tests on Android if ELF_TLS is presence.
Vy Nguyen [Sat, 17 Oct 2020 05:57:02 +0000 (01:57 -0400)]
Disable emulated-tls for  compiler-rt+tests on Android if ELF_TLS is presence.

This is necessary for enabling LSAN on Android (D89251) because:
 - LSAN will have false negatives if run with emulated-tls.
 - Bionic ELF-TLS is not compatible with Gold (hence the need for LLD)

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

3 years ago[TableGen] Add !interleave operator to concatenate a list of values with delimiters
Paul C. Anagnostopoulos [Fri, 30 Oct 2020 15:40:42 +0000 (11:40 -0400)]
[TableGen] Add !interleave operator to concatenate a list of values with delimiters

Add a test. Use it in some TableGen files.

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

3 years ago[TableGen] [IR] Eliminate unnecessary recursive help class.
Paul C. Anagnostopoulos [Sat, 31 Oct 2020 14:40:53 +0000 (10:40 -0400)]
[TableGen] [IR] Eliminate unnecessary recursive help class.

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

3 years ago[lldb] Improve RegisterValue::GetScalarValue
Pavel Labath [Tue, 3 Nov 2020 15:15:15 +0000 (16:15 +0100)]
[lldb] Improve RegisterValue::GetScalarValue

Using Scalar::SetValueFromData, we make the code simpler, handle
big-endian systems properly, _and_ avoid type aliasing issues.

3 years ago[libc++] Remove test that is irrelevant since f1a96de1bc8d
Louis Dionne [Wed, 4 Nov 2020 13:47:48 +0000 (08:47 -0500)]
[libc++] Remove test that is irrelevant since f1a96de1bc8d

We don't want to give the impression that we allow running arbitrary
shell commands under %{exec}, which isn't the case.

3 years ago[libc++] Don't run tests in a shell in the default executor
Louis Dionne [Tue, 3 Nov 2020 19:45:52 +0000 (14:45 -0500)]
[libc++] Don't run tests in a shell in the default executor

3 years ago[InstSimplify] allow vector folds for icmp Pred (1 << X), 0x80
Sanjay Patel [Tue, 3 Nov 2020 23:32:17 +0000 (18:32 -0500)]
[InstSimplify] allow vector folds for icmp Pred (1 << X), 0x80

3 years ago[InstSimplify] add vector cmp tests; NFC
Sanjay Patel [Tue, 3 Nov 2020 22:45:07 +0000 (17:45 -0500)]
[InstSimplify] add vector cmp tests; NFC

3 years ago[Reassociate] Guard `add`-like `or` conversion into an `add` with profitability check
Roman Lebedev [Wed, 4 Nov 2020 11:33:11 +0000 (14:33 +0300)]
[Reassociate] Guard `add`-like `or` conversion into an `add` with profitability check

This is slightly better compile-time wise,
since we avoid potentially-costly knownbits analysis that will
ultimately not allow us to actually do anything with said `add`.

3 years ago[mlir][std] Add DimOp folding for dim(tensor_load(m)) -> dim(m).
Nicolas Vasilache [Wed, 4 Nov 2020 11:19:51 +0000 (11:19 +0000)]
[mlir][std] Add DimOp folding for dim(tensor_load(m)) -> dim(m).

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

3 years ago[MLIR] Support walks over regions and blocks
Frederik Gossen [Wed, 4 Nov 2020 11:02:08 +0000 (11:02 +0000)]
[MLIR] Support walks over regions and blocks

Relands
- [MLIR] Support walks over regions and blocks
         (dbae3d50f114a8ec0a7c3211e3b1b9fb6ef22dbd)
- [MLIR] Use llvm::is_one_of in walk templates
         (56299b1e58bf3720dff2fe60163739ee1554a371)

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

3 years ago[llvm-exegesis] Fix rGaf658d920e2b
Clement Courbet [Wed, 4 Nov 2020 12:22:01 +0000 (13:22 +0100)]
[llvm-exegesis] Fix rGaf658d920e2b

Add missing header.

```
../../llvm/tools/llvm-exegesis/lib/X86/Target.cpp(606,14): error: use of undeclared identifier '__readeflags'
    Eflags = __readeflags();
```

3 years ago[gn build] Port 73b6cb67dcd
LLVM GN Syncbot [Wed, 4 Nov 2020 12:00:24 +0000 (12:00 +0000)]
[gn build] Port 73b6cb67dcd

3 years ago[gn build] Port 1124bf4ab77
LLVM GN Syncbot [Wed, 4 Nov 2020 12:00:24 +0000 (12:00 +0000)]
[gn build] Port 1124bf4ab77

3 years ago[gn build] try to port 707d69ff32309b
Nico Weber [Wed, 4 Nov 2020 12:00:05 +0000 (07:00 -0500)]
[gn build] try to port 707d69ff32309b

3 years ago[VE] Add +vpu attribute
Simon Moll [Wed, 4 Nov 2020 11:41:11 +0000 (12:41 +0100)]
[VE] Add +vpu attribute

`+vpu` controls whether VEISelLowering adds any vregs.  This defaults to
`-vpu` to have scalar code generation out of the box.  We bring up
vector isel under the `+vpu` flag. Once vector isel is stable we switch
to `+vpu` and advertise vregs and vops in TTI.

Reviewed By: kaz7

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

3 years ago[SVE][CodeGen] Lower scalable integer vector reductions
Kerry McLaughlin [Wed, 4 Nov 2020 11:08:10 +0000 (11:08 +0000)]
[SVE][CodeGen] Lower scalable integer vector reductions

This patch uses the existing LowerFixedLengthReductionToSVE function to also lower
scalable vector reductions. A separate function has been added to lower VECREDUCE_AND
& VECREDUCE_OR operations with predicate types using ptest.

Lowering scalable floating-point reductions will be addressed in a follow up patch,
for now these will hit the assertion added to expandVecReduce() in TargetLowering.

Reviewed By: paulwalker-arm

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

3 years ago[mlir][SCF] Add canonicalization pattern for scf::For to eliminate yields that just...
Nicolas Vasilache [Wed, 4 Nov 2020 10:01:26 +0000 (10:01 +0000)]
[mlir][SCF] Add canonicalization pattern for scf::For to eliminate yields that just forward.

For instance:
```
func @for_yields_3(%lb : index, %ub : index, %step : index) -> (i32, i32, i32) {
  %a = call @make_i32() : () -> (i32)
  %b = call @make_i32() : () -> (i32)
  %r:3 = scf.for %i = %lb to %ub step %step iter_args(%0 = %a, %1 = %a, %2 = %b) -> (i32, i32, i32) {
    %c = call @make_i32() : () -> (i32)
    scf.yield %0, %c, %2 : i32, i32, i32
  }
  return %r#0, %r#1, %r#2 : i32, i32, i32
}
```

Canonicalizes as:
```
  func @for_yields_3(%arg0: index, %arg1: index, %arg2: index) -> (i32, i32, i32) {
    %0 = call @make_i32() : () -> i32
    %1 = call @make_i32() : () -> i32
    %2 = scf.for %arg3 = %arg0 to %arg1 step %arg2 iter_args(%arg4 = %0) -> (i32) {
      %3 = call @make_i32() : () -> i32
      scf.yield %3 : i32
    }
    return %0, %2, %1 : i32, i32, i32
  }
```

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

3 years ago[DAG] computeKnownBits - Replace ISD::MUL handling with the common KnownBits::compute...
Simon Pilgrim [Wed, 4 Nov 2020 10:59:56 +0000 (10:59 +0000)]
[DAG] computeKnownBits - Replace ISD::MUL handling with the common KnownBits::computeForMul implementation

3 years ago[libomptarget][nfc] Build amdgcn deviceRTL with nogpulib
Jon Chesterfield [Wed, 4 Nov 2020 11:28:35 +0000 (11:28 +0000)]
[libomptarget][nfc] Build amdgcn deviceRTL with nogpulib

3 years ago[AMDGPU] Set rsrc1 flags for graphics shaders
Sebastian Neubauer [Wed, 14 Oct 2020 15:14:25 +0000 (17:14 +0200)]
[AMDGPU] Set rsrc1 flags for graphics shaders

Before they were only set for compute kernels and compute shaders but
not for other shaders.

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

3 years ago[AMDGPU] Fix ieee mode default value
Sebastian Neubauer [Wed, 14 Oct 2020 12:11:47 +0000 (14:11 +0200)]
[AMDGPU] Fix ieee mode default value

Previously, the default value for ieee mode was
- on for compute kernels and compute shaders,
- off for all shaders except compute shaders.

This commit changes the default to be
- on for compute kernels,
- off for shaders.

This aligns the default value with the settings that are actually in
use.  To my knowledge, all users of shader calling conventions (mesa and
llpc) disable the ieee mode by default.

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

3 years ago[NFC][UBSAN] Replace "count 0" with FileCheck
Vitaly Buka [Wed, 4 Nov 2020 10:31:16 +0000 (02:31 -0800)]
[NFC][UBSAN] Replace "count 0" with FileCheck

Unrelated system warnings may confuse "check 0"

3 years ago[mlir] Fix failing shared libraries build
Andrzej Warzynski [Wed, 4 Nov 2020 10:30:19 +0000 (10:30 +0000)]
[mlir] Fix failing shared libraries build

Failing buildbot: http://lab.llvm.org:8011/#/builders/33/builds/478

Patch that introduced the breaking change: https://reviews.llvm.org/D90667

3 years ago[JITLink][ELF] Omit temporary labels in tests
Stefan Gränitz [Wed, 4 Nov 2020 10:02:59 +0000 (10:02 +0000)]
[JITLink][ELF] Omit temporary labels in tests

Oneshot temporary labels for declaring function size can be omitted. Follow-up from D90331.

Reviewed By: MaskRay

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

3 years ago[Clang] Add more fp128 math library function builtins
Qiu Chaofan [Wed, 4 Nov 2020 09:57:14 +0000 (17:57 +0800)]
[Clang] Add more fp128 math library function builtins

Since glibc has supported math library functions conforming IEEE 128-bit
floating point types on some platform (like ppc64le), we can fix clang's
math builtins missing this type.

Reviewed By: bkramer

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

3 years ago[llvm-exegesis][X86] Save and restore eflags.
Clement Courbet [Mon, 2 Nov 2020 13:25:14 +0000 (14:25 +0100)]
[llvm-exegesis][X86] Save and restore eflags.

This is needed to benchmark instruction that touch EFLAGS (e.g. STD: set direction flag).

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

3 years ago[clangd] Pass parameters to config apply functions
Kadir Cetinkaya [Fri, 30 Oct 2020 11:06:16 +0000 (12:06 +0100)]
[clangd] Pass parameters to config apply functions

This will enable some fragments to apply their features selectively.

Depends on D90270.

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

3 years ago[lldb] Delete Value::Vector class
Pavel Labath [Tue, 3 Nov 2020 16:22:35 +0000 (17:22 +0100)]
[lldb] Delete Value::Vector class

This class and it's surroundings contain a lot of shady code, but as far
as I can tell all of that code is unreachable (there is no code actually
setting the value to eValueTypeVector).

According to history this class was introduced in 2012 in
r167033/0665a0f09. At that time, the code seemed to serve some purpose,
and it had two entry points (in Value::SetContext and
ClangExpressionDeclMap::LookupDecl). The first entry point was deleted
in D17897 and the second one in r179842/44342735.

The stated purpose of the patch introducing this class was to fix
TestRegisters.py, and "expr $xmm0" in particular. Both of these things
function perfectly well these days without this class.

3 years ago[sanitizer] Remove ANDROID_NDK_VERSION
Vitaly Buka [Wed, 4 Nov 2020 09:14:13 +0000 (01:14 -0800)]
[sanitizer] Remove ANDROID_NDK_VERSION

3 years ago[llvm-exegesis] Fix unused variable warning.
Clement Courbet [Wed, 4 Nov 2020 09:09:07 +0000 (10:09 +0100)]
[llvm-exegesis] Fix unused variable warning.

3 years ago[ARM] Remove unused variable. NFC
David Green [Wed, 4 Nov 2020 09:00:03 +0000 (09:00 +0000)]
[ARM] Remove unused variable. NFC

3 years ago[sanitizer] Remove -Wno-non-virtual-dtor
Vitaly Buka [Tue, 3 Nov 2020 04:45:57 +0000 (20:45 -0800)]
[sanitizer] Remove -Wno-non-virtual-dtor

Warning should be fixed with d48f2d7c02743571075bb7812bb4c9e634e51ed1

3 years agoUse LLD for Android compiler-rt
Vy Nguyen [Wed, 4 Nov 2020 00:10:35 +0000 (16:10 -0800)]
Use LLD for Android compiler-rt

Reviewed By: vitalybuka

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

3 years ago[NFCI] Replace AArch64StackOffset by StackOffset.
Sander de Smalen [Tue, 3 Nov 2020 16:44:20 +0000 (16:44 +0000)]
[NFCI] Replace AArch64StackOffset by StackOffset.

This patch replaces the AArch64StackOffset class by the generic one
defined in TypeSize.h.

Reviewed By: david-arm

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

3 years agoRe-land "[llvm-exegesis] Save target state before running the benchmark."
Clement Courbet [Wed, 4 Nov 2020 07:56:27 +0000 (08:56 +0100)]
Re-land "[llvm-exegesis] Save target state before running the benchmark."

The X86 exegesis target is never executed run on non-X86 hosts, disable
X86 instrinsic code on non-X86 targets.

This reverts commit 8cfc872129a99782ab07a19171bf8eace85589ae.

3 years ago[mlir] Add a simpler lowering pattern for WhileOp representing a do-while loop
Alex Zinenko [Wed, 4 Nov 2020 08:42:32 +0000 (09:42 +0100)]
[mlir] Add a simpler lowering pattern for WhileOp representing a do-while loop

When the "after" region of a WhileOp is merely forwarding its arguments back to
the "before" region, i.e. WhileOp is a canonical do-while loop, a simpler CFG
subgraph that omits the "after" region with its extra branch operation can be
produced. Loop rotation from general "while" to "if { do-while }" is left for a
future canonicalization pattern when it becomes necessary.

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

3 years ago[mlir] Add lowering to CFG for WhileOp
Alex Zinenko [Wed, 4 Nov 2020 08:42:04 +0000 (09:42 +0100)]
[mlir] Add lowering to CFG for WhileOp

The lowering is a straightforward inlining of the "before" and "after" regions
connected by (conditional) branches. This plugs the WhileOp into the
progressive lowering scheme. Future commits may choose to target WhileOp
instead of CFG when lowering ForOp.

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

3 years ago[mlir] Add a generic while/do-while loop to the SCF dialect
Alex Zinenko [Wed, 4 Nov 2020 08:41:55 +0000 (09:41 +0100)]
[mlir] Add a generic while/do-while loop to the SCF dialect

The new construct represents a generic loop with two regions: one executed
before the loop condition is verifier and another after that. This construct
can be used to express both a "while" loop and a "do-while" loop, depending on
where the main payload is located. It is intended as an intermediate
abstraction for lowering, which will be added later. This form is relatively
easy to target from higher-level abstractions and supports transformations such
as loop rotation and LICM.

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

3 years ago[clangd] Store the containing symbol for refs
Nathan Ridge [Mon, 19 Oct 2020 05:22:21 +0000 (01:22 -0400)]
[clangd] Store the containing symbol for refs

This is needed to implement call hierarchy.

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

3 years ago[Flang][OpenMP] Add semantic checks for OpenMP copyin clause.
Praveen G [Wed, 4 Nov 2020 07:52:04 +0000 (02:52 -0500)]
[Flang][OpenMP] Add semantic checks for OpenMP copyin clause.

Add the semantic checks for the OpenMP 4.5 - 2.15.4.1 copyin clause.

Resolve OpenMPThreadprivate directive since the list of items specified
in copyin clause should be threadprivate.

Test cases : omp-copyin01.f90, omp-copyin02.f90, omp-copyin03.f90,
             omp-copyin04.f90, omp-copyin05.f90

Reviewed By: kiranchandramohan

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

3 years ago[DebugInfo] Delete unused DwarfUnit::addConstantFPValue & addConstantValue overloads...
Fangrui Song [Wed, 4 Nov 2020 08:05:57 +0000 (00:05 -0800)]
[DebugInfo] Delete unused DwarfUnit::addConstantFPValue & addConstantValue overloads. NFC

This functions appear to be unused for many years.

3 years agoRevert "Re-land "[llvm-exegesis] Save target state before running the benchmark."
Clement Courbet [Wed, 4 Nov 2020 07:48:44 +0000 (08:48 +0100)]
Revert "Re-land "[llvm-exegesis] Save target state before running the benchmark."

Still issues on some architectures.

This reverts commit fd13d7ce09af2bcad6976b8f5207874992bdd908.

3 years agoRe-land "[llvm-exegesis] Save target state before running the benchmark.
Clement Courbet [Mon, 2 Nov 2020 14:31:58 +0000 (15:31 +0100)]
Re-land "[llvm-exegesis] Save target state before running the benchmark.

Use `__builtin_ia32_fxsave64` under __GNUC__, (_fxsave64) does not exist in old versions of
gcc (pre-9.1).

This reverts commit e128f9cafca4e72b089fcd1381af5a1ec656d987.

3 years ago[mlir][Python] Return and accept OpView for all functions.
Stella Laurenzo [Mon, 2 Nov 2020 07:05:36 +0000 (23:05 -0800)]
[mlir][Python] Return and accept OpView for all functions.

* All functions that return an Operation now return an OpView.
* All functions that accept an Operation now accept an _OperationBase, which both Operation and OpView extend and can resolve to the backing Operation.
* Moves user-facing instance methods from Operation -> _OperationBase so that both can have the same API.
* Concretely, this means that if there are custom op classes defined (i.e. in Python), any iteration or creation will return the appropriate instance (i.e. if you get/create an std.addf, you will get an instance of the mlir.dialects.std.AddFOp class, getting full access to any custom API it exposes).
* Refactors all __eq__ methods after realizing the proper way to do this for _OperationBase.

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

3 years agoFix linkage error on mlirLogicalResultIsFailure.
Stella Laurenzo [Wed, 4 Nov 2020 06:45:56 +0000 (22:45 -0800)]
Fix linkage error on mlirLogicalResultIsFailure.

* For C, this needs to be inline static like the others.

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

3 years agoRevert "[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic...
Martin Storsjö [Wed, 4 Nov 2020 06:27:22 +0000 (08:27 +0200)]
Revert "[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic funnel shifts"

This reverts commit 59b22e495c15d2830f41381a327f5d6bf49ff416.

That commit broke building for ARM and AArch64, reproducible like this:

$ cat apedec-reduced.c
a;
b(e) {
  int c;
  unsigned d = f();
  c = d >> 32 - e;
  return c;
}
g() {
  int h = i();
  if (a)
    h = h << a | b(a);
  return h;
}
$ clang -target aarch64-linux-gnu -w -c -O3 apedec-reduced.c
clang: ../lib/Transforms/InstCombine/InstructionCombining.cpp:3656: bool llvm::InstCombinerImpl::run(): Assertion `DT.dominates(BB, UserParent) && "Dominance relation broken?"' failed.

Same thing for e.g. an armv7-linux-gnueabihf target.

3 years agoEnable -Werror-implicit-function-declaration by default (NFC)
Mehdi Amini [Wed, 4 Nov 2020 00:06:28 +0000 (00:06 +0000)]
Enable -Werror-implicit-function-declaration by default (NFC)

This is useful in C source files where it is easy for a typo to be
silently assumed by the compiler to be an implicit declaration.

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

3 years agoSwitch the CallbackOstream wrapper in the MLIR C API to an Unbuffered stream
Mehdi Amini [Tue, 3 Nov 2020 23:46:42 +0000 (23:46 +0000)]
Switch the CallbackOstream wrapper in the MLIR C API to an Unbuffered stream

This delegate the control of the buffering to the user of the API. This
seems like a safer option as messages are immediately propagated to the
user, which may lead to less surprising behavior during debugging for
instance.
In terms of performance, a user can add a buffered stream on the other
side of the callback.

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

3 years agoAdd a basic C API for the MLIR PassManager as well as a basic TableGen backend for...
Mehdi Amini [Tue, 3 Nov 2020 21:38:34 +0000 (21:38 +0000)]
Add a basic C API for the MLIR PassManager as well as a basic TableGen backend for creating passes

This is exposing the basic functionalities (create, nest, addPass, run) of
the PassManager through the C API in the new header: `include/mlir-c/Pass.h`.

In order to exercise it in the unit-test, a basic TableGen backend is
also provided to generate a simple C wrapper around the pass
constructor. It is used to expose the libTransforms passes to the C API.

Reviewed By: stellaraccident, ftynse

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

3 years agoPort print-must-be-executed-contexts and print-mustexecute to NPM
Arthur Eubanks [Tue, 27 Oct 2020 02:57:39 +0000 (19:57 -0700)]
Port print-must-be-executed-contexts and print-mustexecute to NPM

Reviewed By: asbirlea

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

3 years ago[RISCV] Add fshl with immediate tests for Zbt extension. NFC
Craig Topper [Wed, 4 Nov 2020 04:57:53 +0000 (20:57 -0800)]
[RISCV] Add fshl with immediate tests for Zbt extension. NFC

We should be able to map this to fsri with adjustment of the
immediate.

3 years ago[StackColoring] Conservatively merge catch point of V for catch(V)
Xiang1 Zhang [Tue, 3 Nov 2020 01:12:35 +0000 (09:12 +0800)]
[StackColoring] Conservatively merge catch point of V for catch(V)

Reviewed By: thanm, clin1

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

4 years ago[MachineInstr] Add support for instructions with multiple memory operands.
Michael Liao [Mon, 12 Oct 2020 14:01:40 +0000 (10:01 -0400)]
[MachineInstr] Add support for instructions with multiple memory operands.

- Basically iterate each pair of memory operands from both instructions
  and return true if any of them may alias.
- The exception are memory instructions without any memory operand. They
  may touch everything and could alias to any memory instruction.

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

4 years ago[clangd][NFC] Make Located::operator->() use pointer sematics
Nathan James [Wed, 4 Nov 2020 01:36:13 +0000 (01:36 +0000)]
[clangd][NFC] Make Located::operator->() use pointer sematics

This enables using the arrow operator to access members of the contained item.
```lang=c++
Located<std::string> X;
const char* CStr = X->c_str();
```
This is inline with how classes like `Optional` handle the arrow operator.

Reviewed By: kadircet

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

4 years ago[NFC] Use [MC]Register in register allocation
Gaurav Jain [Tue, 3 Nov 2020 04:07:58 +0000 (20:07 -0800)]
[NFC] Use [MC]Register in register allocation

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

4 years ago[AArch64][GlobalISel] Add combine for G_EXTRACT_VECTOR_ELT to allow selection of...
Amara Emerson [Tue, 3 Nov 2020 19:17:31 +0000 (11:17 -0800)]
[AArch64][GlobalISel] Add combine for G_EXTRACT_VECTOR_ELT to allow selection of pairwise FADD.

For the <2 x float> case, instead of adding another combine or legalization to
get it into a <4 x float> form, I'm just adding a GISel specific selection
pattern to cover it.

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

4 years ago[MLIR] Check for duplicate entries in attribute dictionary during custom parsing
Rahul Joshi [Tue, 3 Nov 2020 22:31:23 +0000 (14:31 -0800)]
[MLIR] Check for duplicate entries in attribute dictionary during custom parsing

- Verify that attributes parsed using a custom parser do not have duplicates.
- If there are duplicated in the attribute dictionary in the input, they get caught during the
  dictionary parsing.
- This check verifies that there is no duplication between the parsed dictionary and any
  attributes that might be added by the custom parser (or when the custom parsing code
  adds duplicate attributes).
- Fixes https://bugs.llvm.org/show_bug.cgi?id=48025

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

4 years ago[flang] Dodge gcc 8.2.0 build problem (NFC)
peter klausler [Tue, 3 Nov 2020 18:45:01 +0000 (10:45 -0800)]
[flang] Dodge gcc 8.2.0 build problem (NFC)

Add explicit member initializers to the declarations of
some constexpr values added in a recent patch to avoid an
apparent problem with gcc 8.2.0 with default initializers.

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

4 years ago[MLIR] Move eraseArguments and eraseResults to FunctionLike
mikeurbach [Thu, 22 Oct 2020 17:39:39 +0000 (11:39 -0600)]
[MLIR] Move eraseArguments and eraseResults to FunctionLike

Previously, they were only defined for `FuncOp`.

To support this, `FunctionLike` needs a way to get an updated type
from the concrete operation. This adds a new hook for that purpose,
called `getTypeWithoutArgsAndResults`.

For now, `FunctionLike` continues to assume the type is
`FunctionType`, and concrete operations that use another type can hide
the `getType`, `setType`, and `getTypeWithoutArgsAndResults` methods.

Reviewed By: rriddle

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

4 years ago[libc][NFC][Obvious] Use the new macro to declare special constants in tests.
Siva Chandra Reddy [Sun, 1 Nov 2020 05:28:44 +0000 (22:28 -0700)]
[libc][NFC][Obvious] Use the new macro to declare special constants in tests.

4 years ago[WebAssembly] Don't fold frame offset for global addresses
Julien Jorge [Mon, 2 Nov 2020 01:29:26 +0000 (17:29 -0800)]
[WebAssembly] Don't fold frame offset for global addresses

When machine instructions are in the form of
```
%0 = CONST_I32 @str
%1 = ADD_I32 %stack.0, %0
%2 = LOAD 0, 0, %1
```

In the `ADD_I32` instruction, it is possible to fold it if `%0` is a
`CONST_I32` from an immediate number. But in this case it is a global
address, so we shouldn't do that. But we haven't checked if the operand
of `ADD` is an immediate so far. This fixes the problem. (The case
applies the same for `ADD_I64` and `CONST_I64` instructions.)

Fixes https://bugs.llvm.org/show_bug.cgi?id=47944.

Patch by Julien Jorge (jjorge@quarkslab.com)

Reviewed By: dschuff

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

4 years ago[mlir][vector] Make linalg FillOp vectorization use Transfer op
Thomas Raoux [Tue, 3 Nov 2020 22:35:26 +0000 (14:35 -0800)]
[mlir][vector] Make linalg FillOp vectorization use Transfer op

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

4 years ago[ARM] remove cost-kind predicate for most math op costs
Sanjay Patel [Tue, 3 Nov 2020 22:06:21 +0000 (17:06 -0500)]
[ARM] remove cost-kind predicate for most math op costs

This is based on the same idea that I am using for the basic model implementation
and what I have partly already done for x86: throughput cost is number of
instructions/uops, so size/blended costs are identical except in special cases
(for example, fdiv or other known-expensive machine instructions or things like
MVE that may require cracking into >1 uop)).

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

4 years agoRemove extra comma after macro, fix GCC warning (NFC)
Mehdi Amini [Tue, 3 Nov 2020 22:21:39 +0000 (22:21 +0000)]
Remove extra comma after macro, fix GCC warning (NFC)

4 years ago[MLIR] NFC : Move OpenMP dialect include to translation
Kiran Chandramohan [Tue, 3 Nov 2020 17:42:05 +0000 (17:42 +0000)]
[MLIR] NFC : Move OpenMP dialect include to translation

The OpenMP dialect include is only needed for translation
and is not required in LLVM dialect.

Reviewed By: ftynse

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

4 years agoWhen re-checking an already-substituted template argument, don't lose
Richard Smith [Tue, 3 Nov 2020 22:02:56 +0000 (14:02 -0800)]
When re-checking an already-substituted template argument, don't lose
the reference-ness of the parameter's type.

4 years agoUndo Revert "Ignore template instantiations if not in AsIs mode"
Matt Morehouse [Tue, 3 Nov 2020 21:59:01 +0000 (13:59 -0800)]
Undo Revert "Ignore template instantiations if not in AsIs mode"

MaskRay already fixed the ASan bug.