platform/upstream/llvm.git
3 years ago[AMDGPU] Tweak VOP3_INTERP16 profile
Jay Foad [Fri, 14 May 2021 12:38:47 +0000 (13:38 +0100)]
[AMDGPU] Tweak VOP3_INTERP16 profile

Set the output register class based on the output type, instead of
hard-coding VGPR_32. I think this is more correct. It doesn't make any
difference at the moment because we use the same class for 16- and
32-bit results, but it might in future if we make more use of true
16-bit register classes.

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

3 years ago[RISCV][NFC] Correct alignment in scatter/gather tests
Fraser Cormack [Mon, 17 May 2021 14:10:54 +0000 (15:10 +0100)]
[RISCV][NFC] Correct alignment in scatter/gather tests

This lays the groundwork for changes to alignment in D102493 to be more
apparent.

3 years ago[APInt][NFC] Fix typo vlalue->value
Andy Yankovsky [Mon, 17 May 2021 13:11:19 +0000 (15:11 +0200)]
[APInt][NFC] Fix typo vlalue->value

Reviewed By: fhahn

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

3 years ago[clang-tidy] Fix altera-struct-pack-align crash for struct fields with incomplete...
Georgy Komarov [Sun, 16 May 2021 05:27:46 +0000 (08:27 +0300)]
[clang-tidy] Fix altera-struct-pack-align crash for struct fields with incomplete type

We can only use ASTContext::getTypeInfo for complete types.

This fixes bugzilla issue 50313.

Reviewed By: aaron.ballman

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

3 years ago[mlir] Improve TransferOp verifier: broadcasts are in_bounds
Matthias Springer [Mon, 17 May 2021 13:26:48 +0000 (22:26 +0900)]
[mlir] Improve TransferOp verifier: broadcasts are in_bounds

Broadcast dimensions of vector transfer ops are always in-bounds. This is consistent with the fact that the starting position of a transfer is always in-bounds.

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

3 years ago[mlir] fix misformatted documentation for memref convention
Alex Zinenko [Mon, 17 May 2021 13:33:20 +0000 (15:33 +0200)]
[mlir] fix misformatted documentation for memref convention

The code-block ending marker was missing.

3 years agoSilence "Undefined or garbage value returned to caller" static analysis warning....
Simon Pilgrim [Mon, 17 May 2021 13:08:27 +0000 (14:08 +0100)]
Silence "Undefined or garbage value returned to caller" static analysis warning. NFCI.

3 years ago[AArch64] Lower bitreverse in ISel
Irina Dobrescu [Mon, 17 May 2021 11:59:03 +0000 (12:59 +0100)]
[AArch64] Lower bitreverse in ISel

Adding lowering support for bitreverse.

Previously, lowering bitreverse would expand it into a series of other instructions. This patch makes it so this produces a single rbit instruction instead.

Reviewed By: dmgreen

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

3 years ago[DebugInfo] Fix DWARF expressions for __block vars that are not on the heap
Raphael Isemann [Mon, 17 May 2021 12:02:48 +0000 (14:02 +0200)]
[DebugInfo] Fix DWARF expressions for __block vars that are not on the heap

`__block` variables used to be always stored on the head instead of stack.
D51564 allowed `__block` variables to the stored on the stack like normal
variablesif they not captured by any escaping block, but the debug-info
generation code wasn't made aware of it so we still unconditionally emit DWARF
expressions pointing to the heap.

This patch makes CGDebugInfo use the `EscapingByref` introduced in D51564 that
tracks whether the `__block` variable is actually on the heap. If it's stored on
the stack instead we just use the debug info we would generate for normal
variables instead.

Reviewed By: ahatanak, aprantl

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

3 years ago[mlir][memref] Mark memref.buffer_cast as NoSideEffect
Stephan Herhut [Mon, 17 May 2021 12:01:13 +0000 (14:01 +0200)]
[mlir][memref] Mark memref.buffer_cast as NoSideEffect

This brings it in line with the bultin unrealized_conversion_cast,
which memref.buffer_cast is a specialized version of.

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

3 years agoPut back the trailing commas on TYPED_TEST_SUITE
Benjamin Kramer [Mon, 17 May 2021 12:12:11 +0000 (14:12 +0200)]
Put back the trailing commas on TYPED_TEST_SUITE

This avoids a -pedantic warning:
warning: ISO C++11 requires at least one argument for the "..." in a variadic macro

See also https://github.com/google/googletest/issues/2271

3 years ago[InstCombine] isFreeToInvert(): constant expressions aren't free to invert (PR50370)
Roman Lebedev [Mon, 17 May 2021 11:53:53 +0000 (14:53 +0300)]
[InstCombine] isFreeToInvert(): constant expressions aren't free to invert (PR50370)

This fixes https://bugs.llvm.org/show_bug.cgi?id=50370,
which reports a yet another endless combine loop,
this one regressed from 554b1bced325a8d860ad00bd59020d66d01c95f8,
which fixed yet another endless combine loop (PR50308)

This code had fallen into the very typical pitfall of forgetting
that constant expressions exist, and they aren't free to invert,
because the `not` won't be absorbed by the "constant",
but will remain a (constant) expression...

3 years ago[X86] Regenerate cmov.ll tests
Simon Pilgrim [Mon, 17 May 2021 11:47:54 +0000 (12:47 +0100)]
[X86] Regenerate cmov.ll tests

3 years ago[debuginfo-tests] Fix environment variable used to specify LLDB
James Henderson [Thu, 6 May 2021 08:44:36 +0000 (09:44 +0100)]
[debuginfo-tests] Fix environment variable used to specify LLDB

Currently, if the user specifies the environment variable 'CLANG', tests
will attempt to use the value as a path to the clang executable.
Previously, lldb could also be specified via the CLANG environment
variable, but this was almost certainly a bug, because that meant both
clang and lldb would have the same path. This patch changes the
environment variable for lldb to 'LLDB'.

Reviewed by: thopre, teemperor

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

3 years agoRevert "[mlir] Add folder for complex.ReOp and complex.ImOp."
Adrian Kuegel [Mon, 17 May 2021 11:48:54 +0000 (13:48 +0200)]
Revert "[mlir] Add folder for complex.ReOp and complex.ImOp."

This reverts commit 6b49834d652ba70fc24eaea1c37330639d697de5.

Some tests fail.

3 years agoClean up uses of gmock Invoke in an attempt to make it work with GCC 6.2. NFCI.
Benjamin Kramer [Mon, 17 May 2021 11:48:09 +0000 (13:48 +0200)]
Clean up uses of gmock Invoke in an attempt to make it work with GCC 6.2. NFCI.

3 years ago[OpenCL] Fix reinterpret_cast of vectors
Ole Strohm [Mon, 17 May 2021 11:02:54 +0000 (12:02 +0100)]
[OpenCL] Fix reinterpret_cast of vectors

Fixes issues with vectors in reinterpret_cast in C++ for OpenCL
and adds tests to make sure they both pass without errors and
generate the correct code.

Fixes: PR47977

Reviewed By: Anastasia

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

3 years ago[PowerPC] Add patterns for vselect of v1i128
Nemanja Ivanovic [Mon, 17 May 2021 11:36:36 +0000 (06:36 -0500)]
[PowerPC] Add patterns for vselect of v1i128

These patterns are missing even though the underlying instruction
doesn't really care about the type. Added these patterns to resolve
https://bugs.llvm.org/show_bug.cgi?id=50084

3 years ago[mlir] Add folder for complex.ReOp and complex.ImOp.
Adrian Kuegel [Mon, 17 May 2021 11:21:24 +0000 (13:21 +0200)]
[mlir] Add folder for complex.ReOp and complex.ImOp.

Now that complex constants are supported, we can also fold.

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

3 years agoRevert "[clang][deps] Support inferred modules"
Jan Svoboda [Mon, 17 May 2021 11:23:05 +0000 (13:23 +0200)]
Revert "[clang][deps] Support inferred modules"

This reverts commit 1d9e8e13

Something is off with handling Windows paths: http://45.33.8.238/win/38908/step_7.txt
Most likely introduced in https://reviews.llvm.org/D102491

3 years ago[Test] Auto-generate checks in a test (prepring to update)
Max Kazantsev [Mon, 17 May 2021 11:25:59 +0000 (18:25 +0700)]
[Test] Auto-generate checks in a test (prepring to update)

3 years ago[OpenCL] Drop pragma handling for extension types/decls.
Anastasia Stulova [Mon, 17 May 2021 10:58:32 +0000 (11:58 +0100)]
[OpenCL] Drop pragma handling for extension types/decls.

Drop non-conformant extension pragma implementation as
it does not properly disable anything and therefore
enabling non-disabled logic has no meaning.

This simplifies clang code and user interface to the extension
functionality. With this patch extension pragma 'begin'/'end'
and 'enable'/'disable' are only accepted for backward
compatibility and no longer have any default behavior.

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

3 years ago[PowerPC] Do not emit dssall on AIX
Nemanja Ivanovic [Mon, 17 May 2021 11:05:36 +0000 (06:05 -0500)]
[PowerPC] Do not emit dssall on AIX

This instruction is a nop on all server cores (certainly on all
cores that AIX supports) so it is fine to emit a nop instead of it.
In fact, that is exactly what XL emits. So we emit a nop on AIX
and we leave the codegen as is on other platforms since there may
indeed be cores out there for which this actually does some prefetching.

3 years ago[clang][deps] Specify Python 3 in shebang
Jan Svoboda [Mon, 17 May 2021 11:02:25 +0000 (13:02 +0200)]
[clang][deps] Specify Python 3 in shebang

Some build bots don't like plain `python` in the shebang: https://lab.llvm.org/buildbot/#/builders/139/builds/4147.

3 years ago[gn build] reformat all gn files
Nico Weber [Mon, 17 May 2021 10:59:43 +0000 (06:59 -0400)]
[gn build] reformat all gn files

$ git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format

3 years ago[gn build] Add build file for msan runtime
Nico Weber [Sat, 15 May 2021 03:07:09 +0000 (23:07 -0400)]
[gn build] Add build file for msan runtime

Works for the examples on
https://clang.llvm.org/docs/MemorySanitizer.html

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

3 years agoX86: support Swift Async context
Tim Northover [Tue, 12 Jan 2021 13:12:40 +0000 (13:12 +0000)]
X86: support Swift Async context

This adds support to the X86 backend for the newly committed swiftasync
function parameter. If such a (pointer) parameter is present it gets stored
into an augmented frame record (populated in IR, but generally containing
enhanced backtrace for coroutines using lots of tail calls back and forth).

The context frame is identical to AArch64 (primarily so that unwinders etc
don't get extra complexity). Specfically, the new frame record is [AsyncCtx,
%rbp, ReturnAddr], and its presence is signalled by bit 60 of the stored %rbp
being set to 1. %rbp still points to the frame pointer in memory for backwards
compatibility (only partial on x86, but OTOH the weird AsyncCtx before the rest
of the record is because of x86).

3 years agoAArch64: mark x22 livein if it's an async context that gets stored.
Tim Northover [Mon, 17 May 2021 10:34:16 +0000 (11:34 +0100)]
AArch64: mark x22 livein if it's an async context that gets stored.

This fixes a crash with expensive checks enabled (the verifier was not happy).

3 years ago[clangd][QueryDriver] Dont check for existence of driver
Kadir Cetinkaya [Thu, 13 May 2021 18:56:04 +0000 (20:56 +0200)]
[clangd][QueryDriver] Dont check for existence of driver

Execute implementations already checks for permissions and existence
and returns relevant errors as necessary, so instead of printing our own errors,
we just print theirs.

This also fixes a case in windows where the driver might be missing the `.exe`
suffix. Previously, clangd would reject such a driver because sys::fs::exists is
strict, whereas the underlying Execute implementation would check with `.exe`
suffix too.

Fixes https://github.com/clangd/clangd/issues/93

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

3 years ago[Test] Fix test to make the transform for which is was added legal
Max Kazantsev [Mon, 17 May 2021 10:13:49 +0000 (17:13 +0700)]
[Test] Fix test to make the transform for which is was added legal

%limit in these tests is supposed to be positive.

3 years agoAdd `mlirModuleFromOperation` to C API
Adam Paszke [Mon, 17 May 2021 10:14:02 +0000 (10:14 +0000)]
Add `mlirModuleFromOperation` to C API

At the moment `MlirModule`s can be converted to `MlirOperation`s, but not
the other way around (at least not without going around the C API). This
makes it impossible to e.g. run passes over a `ModuleOp` created through
`mlirOperationCreate`.

Reviewed By: nicolasvasilache, mehdi_amini

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

3 years ago[TargetLowering] prepareUREMEqFold/prepareSREMEqFold - account for non legal shift...
Simon Pilgrim [Mon, 17 May 2021 10:03:12 +0000 (11:03 +0100)]
[TargetLowering] prepareUREMEqFold/prepareSREMEqFold - account for non legal shift types

Ensure we tell getShiftAmountTy that we're working with pre-legalized types to prevent cases where the (legalized) shift type can no longer handle the (non-legalized) type width.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34366

3 years agoRevert "tsan: mark sigwait as blocking"
Florian Hahn [Mon, 17 May 2021 09:57:59 +0000 (10:57 +0100)]
Revert "tsan: mark sigwait as blocking"

This reverts commit 5dad3d1ba9ad01152be21e94cfbbfb31659ea3e1.

The added test (signal_block2.cpp) does not terminate on some Darwin
configurations and is causing Green Dragon bots to fail. First
failure of the test started in
    http://green.lab.llvm.org/green/job/clang-stage1-RA/20767/

3 years agoIR/AArch64/X86: add "swifttailcc" calling convention.
Tim Northover [Thu, 19 Nov 2020 12:32:50 +0000 (12:32 +0000)]
IR/AArch64/X86: add "swifttailcc" calling convention.

Swift's new concurrency features are going to require guaranteed tail calls so
that they don't consume excessive amounts of stack space. This would normally
mean "tailcc", but there are also Swift-specific ABI desires that don't
naturally go along with "tailcc" so this adds another calling convention that's
the combination of "swiftcc" and "tailcc".

Support is added for AArch64 and X86 for now.

3 years ago[clang][deps] Support inferred modules
Michael Spencer [Mon, 17 May 2021 08:41:44 +0000 (10:41 +0200)]
[clang][deps] Support inferred modules

This patch adds support for inferred modules to the dependency scanner.

Effectively a cherry-pick of https://github.com/apple/llvm-project/pull/699 authored by @Bigcheese with libclang and other changes omitted.

Contains following changes:

1. [Clang][ScanDeps] Ignore __inferred_module.map dependency.
  * This shows up with inferred modules, but it doesn't exist on disk, so don't report it as a dependency.

2. [Clang][ScanDeps] Use the module map a module was inferred from for inferred modules.

Also includes a smoke test that uses clang-scan-deps output to perform an explicit build. There's no intention to duplicate whatever `test/Modules` contains, just to verify the produced command-line does "work" (with very loose definition of work).

Split from D100934.

Reviewed By: dexonsmith

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

3 years ago[WIP][mlir] Resolve memref dependency in canonicalize pass.
Julian Gross [Fri, 7 May 2021 10:38:12 +0000 (12:38 +0200)]
[WIP][mlir] Resolve memref dependency in canonicalize pass.

Splitting the memref dialect lead to an introduction of several dependencies
to avoid compilation issues. The canonicalize pass also depends on the
memref dialect, but it shouldn't. This patch resolves the dependencies
and the unintuitive includes are removed. However, the dependency moves
to the constructor of the std dialect.

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

3 years ago[mlir][linalg] Remove template parameter from loop lowering.
Tobias Gysi [Mon, 17 May 2021 08:50:15 +0000 (08:50 +0000)]
[mlir][linalg] Remove template parameter from loop lowering.

Replace the templated linalgLowerOpToLoops method by three specialized methods linalgOpToLoops, LinalgOpToParallelLoops, and linalgOpToAffineLoops.

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

3 years ago[AArch64] Lower fpto*i.sat intrinsics.
Jacob Bramley [Tue, 27 Apr 2021 09:12:11 +0000 (10:12 +0100)]
[AArch64] Lower fpto*i.sat intrinsics.

AArch64's fctv* instructions implement the saturating behaviour that the
fpto*i.sat intrinsics require, in cases where the destination width
matches the saturation width. Lowering them removes a lot of unnecessary
generated code.

Only scalar lowerings are supported for now.

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

3 years ago[lldb] Let dotest check for the `cassert` header instead of `algorithm` for libc...
Raphael Isemann [Mon, 17 May 2021 09:02:36 +0000 (11:02 +0200)]
[lldb] Let dotest check for the `cassert` header instead of `algorithm` for libc++ check

This is just a dotest check to see if we can compile a simple program that uses
libc++. Right now we are parsing the rather big `algorithm` header in the test
program, but the test really just checks whether we can find *any* libc++
headers and link against some libc++ SO. Using the much smaller `cassert` header
for checking whether we can find libc++ headers speeds up this check by a bit.

After some incredibly unscientific performance testing this saves a few seconds
when running the test suite on Linux (on macOS we hardcoded that libc++ is
always there, so this check won't be used there and we don't save any time).

Reviewed By: jankratochvil

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

3 years ago[clangd] Set FileSystem for tweaks in Check tool.
Utkarsh Saxena [Fri, 14 May 2021 18:22:09 +0000 (20:22 +0200)]
[clangd] Set FileSystem for tweaks in Check tool.

Tweaks like DefineOutline depend on FS to be set at `apply()` time.
After https://reviews.llvm.org/D93978, tweaks run from Check tool lost
access to FS. This makes the available to apply() once again.

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

3 years ago[lldb][NFC] Specify guidelines for API tests
Raphael Isemann [Mon, 17 May 2021 08:32:45 +0000 (10:32 +0200)]
[lldb][NFC] Specify guidelines for API tests

This patch specifies a few guidelines that our API tests should follow.

The motivations for this are twofold:

1. API tests have unexpected pitfalls that especially new contributors run into
when writing tests. To prevent the frustration of letting people figure those
pitfalls out by trial-and-error, let's just document them briefly in one place.

2. It prevents some arguing about what is the right way to write tests. I really
like to have fast and reliable API test suite, but I also don't want to be the
bogeyman that has to insist in every review that the test should be rewritten to
not launch a process for no good reason. It's much easier to just point to a
policy document.

I omitted some guidelines that I think could be controversial (e.g., the whole
"should assert message describe failure or success").

Reviewed By: shafik

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

3 years ago[clang][modules] Build inferred modules
Michael Spencer [Mon, 17 May 2021 07:40:29 +0000 (09:40 +0200)]
[clang][modules] Build inferred modules

This patch enables explicitly building inferred modules.

Effectively a cherry-pick of https://github.com/apple/llvm-project/pull/699 authored by @Bigcheese with libclang and dependency scanner changes omitted.

Contains the following changes:

1. [Clang] Fix the header paths in clang::Module for inferred modules.
  * The UmbrellaAsWritten and NameAsWritten fields in clang::Module are a lie for framework modules. For those they actually are the path to the header or umbrella relative to the clang::Module::Directory.
  * The exception to this case is for inferred modules. Here it actually is the name as written, because we print out the module and read it back in when implicitly building modules. This causes a problem when explicitly building an inferred module, as we skip the printing out step.
  * In order to fix this issue this patch adds a new field for the path we want to use in getInputBufferForModule. It also makes NameAsWritten actually be the name written in the module map file (or that would be, in the case of an inferred module).

2. [Clang] Allow explicitly building an inferred module.
  * Building the actual module still fails, but make sure it fails for the right reason.

Split from D100934.

Reviewed By: dexonsmith

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

3 years agoRevert "[NFC][LSAN] Limit the number of concurrent threads is the test"
Florian Hahn [Mon, 17 May 2021 08:29:49 +0000 (09:29 +0100)]
Revert "[NFC][LSAN] Limit the number of concurrent threads is the test"

This reverts commit 2a73b7bd8cf7620fc0e478ac838b07ee6649dd8a.

This appears to be causing the following failures on GreenDragon:
  LeakSanitizer-AddressSanitizer-x86_64 :: TestCases/many_threads_detach.cpp
  LeakSanitizer-Standalone-x86_64 :: TestCases/many_threads_detach.cpp

First failure:
    http://green.lab.llvm.org/green/job/clang-stage1-RA/20754/

Still failing in latest build:
    http://green.lab.llvm.org/green/job/clang-stage1-RA/20928/

3 years ago[DAGCombiner] Relax an assertion to an early return
Fraser Cormack [Thu, 13 May 2021 11:18:36 +0000 (12:18 +0100)]
[DAGCombiner] Relax an assertion to an early return

The select-of-constants transform was asserting that its constant vector
inputs did not implicitly truncate their input without that as an
explicit precondition to the function. This patch relaxes that assertion
into an early return to skip the optimization.

Reviewed By: RKSimon

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

3 years ago[libcxx] NFC. Add missed articles to _LIPCPP_ASSERT messages in <list>
Kristina Bessonova [Sat, 15 May 2021 11:15:56 +0000 (13:15 +0200)]
[libcxx] NFC. Add missed articles to _LIPCPP_ASSERT messages in <list>

3 years ago[dexter] Remove requirement for a condition in DexLimitSteps
OCHyams [Mon, 17 May 2021 08:07:46 +0000 (09:07 +0100)]
[dexter] Remove requirement for a condition in DexLimitSteps

Currently the DexLimitSteps command requires at least one condition. This patch
lets users elide the condition to specify that the breakpoint range should
always be activated when the leading line is stepped on. This patch also
updates the terminology used in the `ConditionalController` class from the
terms 'conditional' and 'unconditional' to 'leading' and 'trailing' when
referring to the breakpoints in the DexLimitSteps range because the leading
breakpoint can now be unconditional.

Reviewed By: chrisjackson

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

3 years ago[dexter] Remove unnecessary double check on conditional breakpoints
OCHyams [Mon, 17 May 2021 07:57:43 +0000 (08:57 +0100)]
[dexter] Remove unnecessary double check on conditional breakpoints

Remove the `ConditionalController._conditional_met` method. This was missed in
the recent ConditionalController refactor (D98699). We don't need to check that
the conditions for a conditional breakpoint have been met because
`DebuggerBase.get_triggered_breakpoint_ids` returns the set of ids for
breakpoints which have been triggered.

To get the "triggered breakpoints" from lldb we use `GetStopReasonDataCount`
and `GetStopReasonDataAtIndex`. It seems that these functions count all
breakpoints associated with the location which lldb has stopped at, regardless
of their condition. i.e. Even if we have two breakpoints at the same source
location that have mutually exclusive conditions, both will be found this way
when either condition is true. To get around this, we store a map of breakpoint
{id: condition} `_breakpoint_conditions` and evaluate the conditions of the
triggered breakpoints to filter the set down to those which are unconditional
or have a condition which evaluates to true.

Essentially we are just moving the condition double check from a general
debugger controller into the lldb specific wrapper. This tidy up will help make
upcoming patches simpler.

Reviewed By: chrisjackson

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

3 years ago[LLD][MinGW] Add --fatal-warnings and --no-fatal-warnings flags
Mateusz Mikuła [Mon, 17 May 2021 07:39:59 +0000 (10:39 +0300)]
[LLD][MinGW] Add --fatal-warnings and --no-fatal-warnings flags

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

3 years ago[clang] NFC: Remove CompilerInstance::getInvocationPtr
Jan Svoboda [Mon, 17 May 2021 07:29:42 +0000 (09:29 +0200)]
[clang] NFC: Remove CompilerInstance::getInvocationPtr

This member function was introduced in 0a92e09c ([clang][deps] Generate the full command-line for modules) in order to keep the CompilerInvocation object alive after CompilerInstance goes out of scope. However, d3fb4b90 ([clang][deps] NFC: Report modules' context hash) removes that use-case, making this function dead.

3 years ago[PowerPC] add a testcase for reverse memory op; nfc
Chen Zheng [Mon, 17 May 2021 07:12:16 +0000 (03:12 -0400)]
[PowerPC] add a testcase for reverse memory op; nfc

3 years ago[clang][deps] NFC: Report modules' context hash
Jan Svoboda [Mon, 17 May 2021 07:16:25 +0000 (09:16 +0200)]
[clang][deps] NFC: Report modules' context hash

This patch eagerly constructs and modifies CompilerInvocation of modular dependencies in order to report the correct context hash instead of the hash of the original translation unit.

No functionality change here, since we currently don't modify CompilerInvocation in a way that affects the context hash.

Depends on D102473.

Reviewed By: dexonsmith

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

3 years ago[clang][deps] NFC: Stop assuming the TU's context hash
Jan Svoboda [Mon, 17 May 2021 06:50:49 +0000 (08:50 +0200)]
[clang][deps] NFC: Stop assuming the TU's context hash

The context hash of modular dependencies can be different from the context hash of the original translation unit if we modify their `CompilerInvocation`s.

Stop assuming the TU's context hash everywhere.

No functionality change here, since we're still currently using the unmodified TU CompilerInvocation to compute the context hash.

Reviewed By: dexonsmith

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

3 years agoAdd support for complex constants to MLIR core.
Adrian Kuegel [Fri, 14 May 2021 11:00:38 +0000 (13:00 +0200)]
Add support for complex constants to MLIR core.

BEGIN_PUBLIC
Add support for complex constants to MLIR core.
END_PUBLIC

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

3 years ago[mlir] Lower permutation maps on TransferWriteOps
Matthias Springer [Mon, 17 May 2021 06:30:07 +0000 (15:30 +0900)]
[mlir] Lower permutation maps on TransferWriteOps

Add TransferWritePermutationLowering, which replaces permutation maps of TransferWriteOps with vector.transpose.

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

3 years ago[mlir] Fix in_bounds attr handling in TransferReadPermutationLowering
Matthias Springer [Mon, 17 May 2021 06:26:26 +0000 (15:26 +0900)]
[mlir] Fix in_bounds attr handling in TransferReadPermutationLowering

The in_bounds attribute should also be transposed.

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

3 years ago[CSSPGO] Update pseudo probe distribution factor based on inline context.
Hongtao Yu [Thu, 13 May 2021 18:06:44 +0000 (11:06 -0700)]
[CSSPGO] Update pseudo probe distribution factor based on inline context.

With prelink inlining, pseudo probes with same ID can come from different inline contexts. Such probes should not share samples and their factors should be fixed up separately.

I'm seeing 0.3% speedup for SPEC2017 overall. Benchmark 631.deepsjeng_s benefits the most, about 4%.

Reviewed By: wenlei, wmi

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

3 years agoRevert "[TargetLowering] Only inspect attributes in the arguments for ArgListEntry"
Arthur Eubanks [Mon, 17 May 2021 05:02:10 +0000 (22:02 -0700)]
Revert "[TargetLowering] Only inspect attributes in the arguments for ArgListEntry"

This reverts commit 16748bd2fb1fe10d7d097961f1988327338f3f9f.

Causes https://crbug.com/1209013

3 years agoRevert "[NFC] Use ArgListEntry indirect types more in ISel lowering"
Arthur Eubanks [Mon, 17 May 2021 05:00:54 +0000 (22:00 -0700)]
Revert "[NFC] Use ArgListEntry indirect types more in ISel lowering"

This reverts commit 85af8a8c1b574faa0d5d57d189ae051debdfada8.

3 years ago[SelectionDAG] Make fast and linearize visible by clang -pre-RA-sched
Pan, Tao [Mon, 17 May 2021 03:22:47 +0000 (11:22 +0800)]
[SelectionDAG] Make fast and linearize visible by clang -pre-RA-sched

ScheduleDAGFast.cpp is compiled to object file, but the ScheduleDAGFast
object file isn't linked into clang executable file as no symbol is
referred by outside. Add calling to createXxx of ScheduleDAGFast.cpp,
then the ScheduleDAGFast object file will be linked into clang
executable file. The static RegisterScheduler will register scheduler
fast and linearize at clang boot time.

Reviewed By: pengfei

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

3 years ago[RISCV] Optimize or/xor with immediate in the zbs extension
Ben Shi [Mon, 17 May 2021 02:59:52 +0000 (10:59 +0800)]
[RISCV] Optimize or/xor with immediate in the zbs extension

Reviewed By: craig.topper

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

3 years ago[NFC][sanitizer] Fix 'macro redefined' warning in test
Vitaly Buka [Mon, 17 May 2021 01:59:19 +0000 (18:59 -0700)]
[NFC][sanitizer] Fix 'macro redefined' warning in test

3 years ago[RISCV][test] Add new tests of or/xor in the zbs extension
Ben Shi [Mon, 17 May 2021 01:47:23 +0000 (09:47 +0800)]
[RISCV][test] Add new tests of or/xor in the zbs extension

Reviewed By: MaskRay

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

3 years ago[lld][X86] Restore gotEntrySize.
Harald van Dijk [Sun, 16 May 2021 23:13:00 +0000 (00:13 +0100)]
[lld][X86] Restore gotEntrySize.

D62727 removed GotEntrySize and GotPltEntrySize with a comment that they
are always equal to wordsize(), but that is not entirely true: X32 has a
word size of 4, but needs 8-byte GOT entries. This restores gotEntrySize
for both, adjusted for current naming conventions, but defaults it to
config->wordsize to keep things simple for architectures other than
x86_64.

This partially reverts D62727.

Reviewed By: MaskRay

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

3 years agoFix some deprecated copy ops in google mock
David Blaikie [Sun, 16 May 2021 22:58:40 +0000 (15:58 -0700)]
Fix some deprecated copy ops in google mock

3 years ago[RISCV] Replace AddiPair ComplexPattern with a PatLeaf. NFC
Craig Topper [Sun, 16 May 2021 19:17:47 +0000 (12:17 -0700)]
[RISCV] Replace AddiPair ComplexPattern with a PatLeaf. NFC

The ComplexPattern is looking for an immediate in a certain range
that has a single use. This can be handled with a PatLeaf since
we aren't matching multiple patterns or checking any complicated
relationships between nodes.

This shrinks the isel table a little bit since tablegen no longer
has to generate patterns with commuted operands. With the PatLeaf,
tablegen can see we're matching an immediate which should always
be on the right hand side of add.

Reviewed By: benshi001

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

3 years ago[test] Improve CodeGen/*/semantic-interposition-asm.ll
Fangrui Song [Sun, 16 May 2021 18:17:09 +0000 (11:17 -0700)]
[test] Improve CodeGen/*/semantic-interposition-asm.ll

3 years ago[BPF] add support for 32 bit registers in inline asm
Alessandro Decina [Sun, 16 May 2021 16:32:36 +0000 (09:32 -0700)]
[BPF] add support for 32 bit registers in inline asm

Add "w" constraint type which allows selecting 32 bit registers.
32 bit registers were added in https://reviews.llvm.org/rGca31c3bb3ff149850b664838fbbc7d40ce571879.

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

3 years agoRecommit "[Clang,Driver] Add -fveclib=Darwin_libsystem_m support."
Florian Hahn [Sun, 16 May 2021 11:03:36 +0000 (12:03 +0100)]
Recommit "[Clang,Driver] Add -fveclib=Darwin_libsystem_m support."

Recommit D102489, with the test case requiring the AArch64 backend.

This reverts the revert 59b419adc6e608db8d7c31efcc37f34c0b57b7d0.

3 years ago[clang] Fix ternary operator in the second for loop statement
Danila Kutenin [Fri, 14 May 2021 23:56:48 +0000 (16:56 -0700)]
[clang] Fix ternary operator in the second for loop statement

Fix ternary operator in for loop argument, it was by mistake not set as CanBeForRangeDecl and led to incorrect codegen. It fixes https://bugs.llvm.org/show_bug.cgi?id=50038. I don't have commit rights. Danila Kutenin. kutdanila@yandex.ru

Reviewed By: rsmith

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

3 years ago[JITLink] Fix symbol comparator in LinkGraph::dump.
Lang Hames [Sun, 16 May 2021 17:09:35 +0000 (10:09 -0700)]
[JITLink] Fix symbol comparator in LinkGraph::dump.

The existing implementation did not provide a strict weak ordering.

3 years ago[CPG][ARM] Optimize towards branch on zero in codegenprepare
David Green [Sun, 16 May 2021 16:54:06 +0000 (17:54 +0100)]
[CPG][ARM] Optimize towards branch on zero in codegenprepare

This adds a simple fold into codegenprepare that converts comparison of
branches towards comparison with zero if possible. For example:
  %c = icmp ult %x, 8
  br %c, bla, blb
  %tc = lshr %x, 3
becomes
  %tc = lshr %x, 3
  %c = icmp eq %tc, 0
  br %c, bla, blb

As a first order approximation, this can reduce the number of
instructions needed to perform the branch as the shift is (often) needed
anyway. At the moment this does not effect very much, as llvm tends to
prefer the opposite form. But it can protect against regressions from
commits like rG9423f78240a2.

Simple cases of Add and Sub are added along with Shift, equally as the
comparison to zero can often be folded with cpsr flags.

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

3 years agoRevert "Do actual DCE in LoopUnroll (try 2)"
Philip Reames [Sun, 16 May 2021 16:29:25 +0000 (09:29 -0700)]
Revert "Do actual DCE in LoopUnroll (try 2)"

This reverts commit 653fa0b46ae34c06495b542414b704b30381cd02.

Reported to trigger pr50354.  Reverting until investigated.

3 years ago[ARM] Extra branch on zero tests. NFC
David Green [Sun, 16 May 2021 16:22:52 +0000 (17:22 +0100)]
[ARM] Extra branch on zero tests. NFC

3 years ago[Utils] Fix indentation error in utils/wciia.py
Kai Luo [Sun, 16 May 2021 14:34:09 +0000 (22:34 +0800)]
[Utils] Fix indentation error in utils/wciia.py

Running this script gives
```
"llvm-project/llvm/./utils/wciia.py", line 56
    if word == "N:":
TabError: inconsistent use of tabs and spaces in indentation
```
Under emacs' whitespace-mode, it shows
```
for·line·in·code_owners_file:$
····for·word·in·line.split():$
»       if·word·==·"N:":$
»       »       name·=·line[2:].strip()$
»       »       if·code_owner:$
»       »       »       process_code_owner(code_owner)$
»       »       »       code_owner·=·{}$
```
I use `yapf` to format this script directly and it's running correctly.

3 years ago[CaptureTracking] Simplify reachability check (NFCI)
Nikita Popov [Sun, 16 May 2021 14:04:10 +0000 (16:04 +0200)]
[CaptureTracking] Simplify reachability check (NFCI)

This code was re-implementing the same-BB case of
isPotentiallyReachable(). Historically, this was done because
CaptureTracking used additional caching for local dominance
queries. Now that it is no longer needed, the code is effectively
the same as isPotentiallyReachable().

The only difference are extra checks for invoke/phis. These are
misleading checks related to dominance in the value availability
sense that are not relevant for control reachability. The invoke
check was correct but redundant in that invokes are always
terminators, so `I` could never come before the invoke. The phi
check is a matter of interpretation (should an earlier phi node be
considered reachable from a later phi node in the same block?)
but ultimately doesn't matter because phis don't capture anyway.

3 years agoReapply [CaptureTracking] Do not check domination
Nikita Popov [Sun, 16 May 2021 08:40:02 +0000 (10:40 +0200)]
Reapply [CaptureTracking] Do not check domination

Reapply after adjusting the synchronized.m test case, where the
TODO is now resolved. The pointer is only captured on the exception
handling path.

-----

For the CapturesBefore tracker, it is sufficient to check that
I can not reach BeforeHere. This does not necessarily require
that BeforeHere dominates I, it can also occur if the capture
happens on an entirely disjoint path.

This change was previously accepted in D90688, but had to be
reverted due to large compile-time impact in some cases: It
increases the number of reachability queries that are performed.

After recent changes, the compile-time impact is largely mitigated,
so I'm reapplying this patch. The remaining compile-time impact
is largely proportional to changes in code-size.

3 years ago[Matrix] Fix some newpm check lines, which fail on some bots. (2)
Florian Hahn [Sun, 16 May 2021 13:11:09 +0000 (14:11 +0100)]
[Matrix] Fix some newpm check lines, which fail on some bots. (2)

3 years ago[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB combines...
Simon Pilgrim [Sun, 16 May 2021 09:53:04 +0000 (10:53 +0100)]
[X86][SSE] Pull out combineToHorizontalAddSub helper from inside (F)ADD/SUB combines (REAPPLIED). NFCI.

The intention is to be able to run this from additional locations (such as shuffle combining) in the future.

Reapplies rGb95a103808ac (after reversion at rGc012a388a15b), with SSE3/SSSE3 typo fix, test added at rG0afb10de1449.

3 years ago[Matrix] Fix some newpm check lines, which fail on some bots.
Florian Hahn [Sun, 16 May 2021 12:47:40 +0000 (13:47 +0100)]
[Matrix] Fix some newpm check lines, which fail on some bots.

3 years ago[Matrix] Extend test to also check new PM pipeline.
Florian Hahn [Sun, 16 May 2021 12:08:51 +0000 (13:08 +0100)]
[Matrix] Extend test to also check new PM pipeline.

3 years ago[PhaseOrdering] Add test for insert/extract code for matrixes.
Florian Hahn [Sun, 16 May 2021 10:45:30 +0000 (11:45 +0100)]
[PhaseOrdering] Add test for insert/extract code for matrixes.

3 years ago[VectorCombine] Add tests with and & urem guaranteeing idx is valid.
Florian Hahn [Sun, 16 May 2021 10:12:55 +0000 (11:12 +0100)]
[VectorCombine] Add tests with and & urem guaranteeing idx is valid.

3 years ago[NFC][X86][Costmodel] Add tests for load/store with i1 element type
Roman Lebedev [Sun, 16 May 2021 10:58:07 +0000 (13:58 +0300)]
[NFC][X86][Costmodel] Add tests for load/store with i1 element type

3 years agoRevert "[CaptureTracking] Do not check domination"
Nikita Popov [Sun, 16 May 2021 09:04:45 +0000 (11:04 +0200)]
Revert "[CaptureTracking] Do not check domination"

This reverts commit 6b8b43e7af3074124e3c9e429e1fb08165799be4.

This causes clang test to fail (CodeGenObjC/synchronized.m).
Revert until I can figure out whether that's an expected change.

3 years ago[CaptureTracking] Do not check domination
Nikita Popov [Sun, 16 May 2021 08:40:02 +0000 (10:40 +0200)]
[CaptureTracking] Do not check domination

For the CapturesBefore tracker, it is sufficient to check that
I can not reach BeforeHere. This does not necessarily require
that BeforeHere dominates I, it can also occur if the capture
happens on an entirely disjoint path.

This change was previously accepted in D90688, but had to be
reverted due to large compile-time impact in some cases: It
increases the number of reachability queries that are performed.

After recent changes, the compile-time impact is largely mitigated,
so I'm reapplying this patch. The remaining compile-time impact
is largely proportional to changes in code-size.

3 years ago[MemCpyOpt] Add test for unreachable capture (NFC)
Nikita Popov [Sun, 16 May 2021 08:35:30 +0000 (10:35 +0200)]
[MemCpyOpt] Add test for unreachable capture (NFC)

This is based on the test from D90688, without the argmemonly
attribute. The argmemonly attribute would guaranteed no modref
by itself and the question of captures would not arise in the
first place.

3 years ago[MLIR][PYTHON] Provide opt level for ExecutionEngine Python binding
Uday Bondhugula [Wed, 5 May 2021 02:44:31 +0000 (08:14 +0530)]
[MLIR][PYTHON] Provide opt level for ExecutionEngine Python binding

Provide an option to specify optimization level when creating an
ExecutionEngine via the MLIR JIT Python binding. Not only is the
specified optimization level used for code generation, but all LLVM
optimization passes at the optimization level are also run prior to
machine code generation (akin to the mlir-cpu-runner tool).

Default opt level continues to remain at level two (-O2).

Contributions in part from Prashant Kumar <prashantk@polymagelabs.com>
as well.

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

3 years ago[Matrix] Implement static cast for matrix types
Saurabh Jha [Sun, 9 May 2021 07:17:10 +0000 (08:17 +0100)]
[Matrix] Implement static cast for matrix types

This patch implements static casts for matrix types. This patch finishes all the work needed for https://bugs.llvm.org/show_bug.cgi?id=47141

Reviewed By: fhahn

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

3 years ago[MLIR][NFC] Fix clang-tidy warnings in IntegerSet.h
Uday Bondhugula [Sun, 16 May 2021 06:55:25 +0000 (12:25 +0530)]
[MLIR][NFC] Fix clang-tidy warnings in IntegerSet.h

Fix clang-tidy warnings and some comments in IntegerSet.h. NFC.

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

3 years ago[AIX][compiler-rt] Build and install standalone libatomic
Kai Luo [Sun, 16 May 2021 05:03:10 +0000 (05:03 +0000)]
[AIX][compiler-rt] Build and install standalone libatomic

On AIX, we have to ship `libatomic.a` for compatibility. First, a new `clang_rt.atomic` is added. Second, use added cmake modules for AIX, we are able to build a compatible libatomic.a for AIX. The second step can't be perfectly implemented with cmake now since AIX's archive approach is kinda unique, i.e., archiving shared libraries into a static archive file.

Reviewed By: jsji

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

3 years ago[AIX][AsmPrinter] Print Global Variable in comments
Jinsong Ji [Sun, 16 May 2021 03:04:44 +0000 (03:04 +0000)]
[AIX][AsmPrinter] Print Global Variable in comments

The default AsmPrinter print GV in comments,
AIX should do so too.

This also fix LLVM :: CodeGen/Generic/inline-asm-mem-clobber.ll.

Reviewed By: hubert.reinterpretcast

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

3 years ago[AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as
Hubert Tong [Sun, 16 May 2021 02:38:42 +0000 (22:38 -0400)]
[AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as

This patch replaces the `powerpc64` token with the `system-aix` one in
the UNSUPPORTED line of a test. The `powerpc64` token was originally
added temporarily in 71a0609a2b53.

If AIX uses integrated-as by default and it works both for 32-bit and
64-bit objects, then the issues encountered so far (see comments in
D96033) would be mostly solved.

As it is, marking the test as expected-to-fail (as opposed to
unsupported) on AIX might cause more trouble in the form of 32-bit
versus 64-bit differences. I am not aware of other situations where LIT
tests are dependent on whether the LLVM build is 64-bit or 32-bit.

Reviewed By: jsji

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

3 years ago[Demangle][Rust] Parse trait definitions
Tomasz Miąsko [Sat, 15 May 2021 21:33:24 +0000 (23:33 +0200)]
[Demangle][Rust] Parse trait definitions

Part of https://reviews.llvm.org/D102549

3 years ago[Demangle][Rust] Parse trait implementations
Tomasz Miąsko [Sat, 15 May 2021 21:25:24 +0000 (23:25 +0200)]
[Demangle][Rust] Parse trait implementations

Part of https://reviews.llvm.org/D102549

3 years ago[Demangle][Rust] Parse inherent implementations
Tomasz Miąsko [Sat, 15 May 2021 21:24:16 +0000 (23:24 +0200)]
[Demangle][Rust] Parse inherent implementations

Part of https://reviews.llvm.org/D102549

3 years ago[Attributor] Call site specific AAValueSimplification and AAIsDead.
Kuter Dinel [Sat, 15 May 2021 16:28:50 +0000 (16:28 +0000)]
[Attributor] Call site specific AAValueSimplification and AAIsDead.

This patch makes it possible to do call site specific deductions
for AAValueSimplification and AAIsDead.

Reviewed By: jdoerfert

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

3 years ago[X86] Remove unused check-prefixes
Simon Pilgrim [Sat, 15 May 2021 21:04:49 +0000 (22:04 +0100)]
[X86] Remove unused check-prefixes

3 years ago[CaptureTracking] Only check reachability for capture candidates
Nikita Popov [Sat, 15 May 2021 17:05:08 +0000 (19:05 +0200)]
[CaptureTracking] Only check reachability for capture candidates

Reachability queries are very expensive, and currently performed
for each instruction we look at, even though most of them will
not lead to a capture and are thus ultimately irrelevant. It is
more efficient to walk a few unnecessary instructions than to
perform unnecessary reachability queries.

Theoretically, this may produce worse results, because the additional
instructions considered may cause us to hit the use count limit
earlier. In practice, this does not appear to be a problem, e.g.
on test-suite O3 we report only one more captured-before with this
change, with no resulting codegen differences.

This makes PointerMayBeCapturedBefore() significantly cheaper in
practice, hopefully allowing it to be used in more places.

3 years ago[X86][SSE] Add SSE3 coverage to PHADD/SUB generation tests
Simon Pilgrim [Sat, 15 May 2021 20:25:34 +0000 (21:25 +0100)]
[X86][SSE] Add SSE3 coverage to PHADD/SUB generation tests

This would have caught the regression identified in rGc012a388a15b.

3 years agoNFC. Refactored DIPrinter for support embedded source.
Alex Orlov [Sat, 15 May 2021 19:01:12 +0000 (23:01 +0400)]
NFC. Refactored DIPrinter for support embedded source.

This patch introduces source loading and pruning functions.
It will allow to use the DWARF embedded source and use the same code for JSON printout.
No functional changes.

Reviewed By: dblaikie

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