platform/upstream/llvm.git
3 years ago[SLP][NFC]Rename functions in the tests, NFC.
Alexey Bataev [Mon, 21 Jun 2021 20:37:12 +0000 (13:37 -0700)]
[SLP][NFC]Rename functions in the tests, NFC.

3 years agoRevert "[SYCL][NFC] Ensure SYCL kernel for unique-stable-name is unqualified."
Erich Keane [Mon, 21 Jun 2021 20:23:05 +0000 (13:23 -0700)]
Revert "[SYCL][NFC] Ensure SYCL kernel for unique-stable-name is unqualified."

This reverts commit 5013131875402539a249dca47c58cca7c359baf8.

This patch didn't end up being the solution to the problem.  It "fixed"
our issue but the actual correct solution is something else.  Reverting
as this ends up being unnecessary/extra noise.

3 years ago[libc++] NFC: Fix outdated comment about secrets.env
Louis Dionne [Mon, 21 Jun 2021 20:21:39 +0000 (16:21 -0400)]
[libc++] NFC: Fix outdated comment about secrets.env

That file (secrets.env) has now been removed, so the comment was
referencing something that didn't exist anymore.

3 years agoReapply [InstCombine] Don't try converting opaque pointer bitcast to GEP
Nikita Popov [Mon, 21 Jun 2021 18:35:30 +0000 (20:35 +0200)]
Reapply [InstCombine] Don't try converting opaque pointer bitcast to GEP

Reapplied without changes -- this was reverted together with an
underlying patch.

-----

Bitcasts having opaque pointer source or result type cannot be
converted into a zero-index GEP, GEP source and result types
always have the same opaque-ness.

3 years agoCreate install targets for scan-build-py.
Daniel Hwang [Mon, 21 Jun 2021 20:01:42 +0000 (13:01 -0700)]
Create install targets for scan-build-py.

A new revision identical to https://reviews.llvm.org/D101139
The parent revision of aforementioned revision seems to cause pre-merge checks to fail opaquely. Seeing if creating a new revision will work.

Reviewed By: phosek

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

3 years agoReapply [InstCombine] Extract bitcast -> gep transform
Nikita Popov [Mon, 21 Jun 2021 18:22:06 +0000 (20:22 +0200)]
Reapply [InstCombine] Extract bitcast -> gep transform

Relative to the original patch, an InstCombine test has been
added to show a previously missed pattern, and the Coroutine
test that resulted in the revert has been regenerated.

-----

Move this into a separate function, to make sure that early
returns do not accidentally skip other transforms. This previously
happened for the isSized() check, which skipped folds like
distributing a bitcast over a select.

3 years ago[InstCombine] Add test for bitcast of unsized pointer (NFC)
Nikita Popov [Mon, 21 Jun 2021 19:58:06 +0000 (21:58 +0200)]
[InstCombine] Add test for bitcast of unsized pointer (NFC)

The bitcast should get folded into the select, but currently isn't
due to an incorrect early bailout.

3 years agoAdd polynomial approximation for trigonometric sine and cosine functions
Ahmed S. Taei [Mon, 21 Jun 2021 19:46:27 +0000 (12:46 -0700)]
Add polynomial approximation for trigonometric sine and cosine functions

The approximation relays on range reduced version y \in [0, pi/2]. An input x will have
the property that sin(x) = sin(y), -sin(y), cos(y), -cos(y) depends on which quadrable x
is in, where sin(y) and cos(y) are approximated with 5th degree polynomial (of x^2).
As a result a single pattern can be used to compute approximation for both sine and cosine.

Reviewed By: ezhulenev

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

3 years ago[mlir][vector] Support distributing transfer op with permutation map
thomasraoux [Mon, 14 Jun 2021 20:25:18 +0000 (13:25 -0700)]
[mlir][vector] Support distributing transfer op with permutation map

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

3 years ago[RISCV] Remove extra character from a comment. NFC
Craig Topper [Mon, 21 Jun 2021 19:42:21 +0000 (12:42 -0700)]
[RISCV] Remove extra character from a comment. NFC

3 years ago[SYCL][NFC] Ensure SYCL kernel for unique-stable-name is unqualified.
Erich Keane [Mon, 21 Jun 2021 19:50:02 +0000 (12:50 -0700)]
[SYCL][NFC] Ensure SYCL kernel for unique-stable-name is unqualified.

Discovered in our downstream, this function that is used to get the type
of the kernel parameter type needs to be unqualified, otherwise when our
downstream uses this function in a slightly different way, the kernel
types no longer match.

3 years ago[llvm-reduce] Don't delete arguments of intrinsics
Langston Barrett [Mon, 21 Jun 2021 19:34:10 +0000 (12:34 -0700)]
[llvm-reduce] Don't delete arguments of intrinsics

The argument reduction pass shouldn't remove arguments of
intrinsics, because the resulting module is ill-formed, and so
inherently uninteresting.

Reviewed By: aeubanks

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

3 years ago[libcxx][ranges] Add `indirectly_movable` and `indirectly_movable_storable`.
zoecarver [Mon, 17 May 2021 17:30:12 +0000 (10:30 -0700)]
[libcxx][ranges] Add `indirectly_movable` and `indirectly_movable_storable`.

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

3 years agoRevert "[InstCombine] Extract bitcast -> gep transform"
Nikita Popov [Mon, 21 Jun 2021 19:31:42 +0000 (21:31 +0200)]
Revert "[InstCombine] Extract bitcast -> gep transform"

This reverts commit d9f5d7b959de36085944d4a99a73f3053f953796.
This reverts commit 5780611d7e044ef56c4214df2c236ef5e15545ab.

This causes a failure in Coroutine tests.

3 years ago[LoopUnroll] Don't modify TripCount/TripMultiple in computeUnrollCount() (NFCI)
Nikita Popov [Sat, 19 Jun 2021 08:09:12 +0000 (10:09 +0200)]
[LoopUnroll] Don't modify TripCount/TripMultiple in computeUnrollCount() (NFCI)

As these are no longer passed to UnrollLoop(), there is no need to
modify them in computeUnrollCount(). Make them non-reference parameters.

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

3 years ago[SLP]Improve vectorization of PHI instructions.
Alexey Bataev [Wed, 26 May 2021 18:56:22 +0000 (11:56 -0700)]
[SLP]Improve vectorization of PHI instructions.

Perform better analysis when trying to vectorize PHIs.
1. Do not try to vectorize vector PHIs.
2. Do deeper analysis for more profitable nodes for the vectorization.

Before we just tried to vectorize the PHIs of the same type. Patch
improves this and tries to vectorize PHIs with incoming values which
come from the same basic block, have the same and/or alternative
opcodes.

It allows to save the compile time and provides better vectorization
results in general.

Part of D57059.

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

3 years ago[InstCombine] Don't try converting opaque pointer bitcast to GEP
Nikita Popov [Mon, 21 Jun 2021 18:35:30 +0000 (20:35 +0200)]
[InstCombine] Don't try converting opaque pointer bitcast to GEP

Bitcasts having opaque pointer source or result type cannot be
converted into a zero-index GEP, GEP source and result types
always have the same opaque-ness.

3 years ago[InstCombine] Extract bitcast -> gep transform
Nikita Popov [Mon, 21 Jun 2021 18:22:06 +0000 (20:22 +0200)]
[InstCombine] Extract bitcast -> gep transform

Move this into a separate function, to make sure that early
returns do not accidentally skip other transforms. There is
already one isSized() check that could run into this issue,
thus this change is not strictly NFC.

3 years ago[llvm-profdata] Allow omission of -o for --text output
Fangrui Song [Mon, 21 Jun 2021 19:01:57 +0000 (12:01 -0700)]
[llvm-profdata] Allow omission of -o for --text output

This makes it more convenient to get a text format profile.

Add an error for printing non-text format output to a terminal for instrumentation profile.
(It cannot be portably tested. For sample profile, raw_fd_ostream is hidden deeply so it's inconvenient to add a diagnostic.)

Reviewed By: davidxl

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

3 years ago[SystemZ] Fix some typos in comments.
Jonas Paulsson [Mon, 21 Jun 2021 18:49:08 +0000 (13:49 -0500)]
[SystemZ]  Fix some typos in comments.

3 years ago[Clang][Codegen] rename no_profile fn attr no_profile_instrument_function
Nick Desaulniers [Mon, 21 Jun 2021 18:34:23 +0000 (11:34 -0700)]
[Clang][Codegen] rename no_profile fn attr no_profile_instrument_function

GCC has had this function attribute since GCC 7.1 for this purpose. I
added "no_profile" last week in D104475; rename this to
"no_profile_instrument_function" to improve compatibility with GCC.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80223#c11
Reviewed By: MaskRay, aaron.ballman

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

3 years ago[RISCV] Add isel patterns to match vmacc/vmadd/vnmsub/vnmsac from add/sub and mul.
Craig Topper [Mon, 21 Jun 2021 17:50:28 +0000 (10:50 -0700)]
[RISCV] Add isel patterns to match vmacc/vmadd/vnmsub/vnmsac from add/sub and mul.

Reviewed By: frasercrmck

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

3 years ago[InstCombine] Remove unnecessary addres space check (NFC)
Nikita Popov [Mon, 21 Jun 2021 18:11:39 +0000 (20:11 +0200)]
[InstCombine] Remove unnecessary addres space check (NFC)

It's not possible to bitcast between different address spaces,
and this is ensured by the IR verifier. As such, this bitcast to
addrspacecast canonicalization can never be hit.

3 years ago[OpaquePtr] Support opaque constant expression GEP
Nikita Popov [Mon, 21 Jun 2021 16:33:29 +0000 (18:33 +0200)]
[OpaquePtr] Support opaque constant expression GEP

Adjust assertions to use isOpaqueOrPointeeTypeMatches() and make
it return an opaque pointer result for an opaque base pointer. We
also need to enumerate the element type, as it is no longer
implicitly enumerated through the pointer type.

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

3 years agoSplit a test for ease of auto update
Philip Reames [Mon, 21 Jun 2021 18:02:17 +0000 (11:02 -0700)]
Split a test for ease of auto update

3 years agoRevert "[lldb-vscode] attempt to fix flakiness"
Walter Erquinigo [Mon, 21 Jun 2021 17:53:31 +0000 (10:53 -0700)]
Revert "[lldb-vscode] attempt to fix flakiness"
Revert "[lldb-vscode] only report long running progress events"

This reverts commit f2c009dbcfd11fd1e8941513dcf49fffe43565a1.
This reverts commit aa4685c0fb3aab5acb90be5fd3eb5ba8bf1e3211.

3 years ago[lldb] Add support for escaping zsh arguments
Raphael Isemann [Mon, 21 Jun 2021 16:21:19 +0000 (18:21 +0200)]
[lldb] Add support for escaping zsh arguments

LLDB supports having globbing regexes in the process launch arguments that will
be resolved using the user's shell. This requires that we pass the launch args
to the shell and then read back the expanded arguments using LLDB's argdumper
utility.

As the shell will not just expand the globbing regexes but all special
characters, we need to escape all non-globbing charcters such as $, &, <, >,
etc. as those otherwise are interpreted and removed in the step where we expand
the globbing characters. Also because the special characters are shell-specific,
LLDB needs to maintain a list of all the characters that need to be escaped for
each specific shell.

This patch adds the list of special characters that need to be escaped for
`zsh`. Without this patch on systems where `zsh` is the user's shell (like on
all macOS systems) having any of these special characters in your arguments or
path to the binary will cause the process launch to fail. E.g., `lldb -- ./calc
1<2` is failing without this patch. The same happens if the absolute path to
`calc` is in a directory that contains for example parentheses or other special
characters.

Reviewed By: JDevlieghere

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

3 years ago[lldb] Skip TestLimitDebugInfo for Clang<7
Raphael Isemann [Mon, 21 Jun 2021 17:38:01 +0000 (19:38 +0200)]
[lldb] Skip TestLimitDebugInfo for Clang<7

Without DW_CC_pass_by_* attributes that Clang 7 started to emit in this test
we don't properly read back the return value of the `get_*` functions and just
read bogus memory.

See also the TestReturnValue.py test.

3 years agoRemove ML inlining model artifacts.
Jacob Hegna [Mon, 14 Jun 2021 18:30:10 +0000 (18:30 +0000)]
Remove ML inlining model artifacts.

They are not conducive to being stored in git. Instead, we autogenerate
mock model artifacts for use in tests. Production models can be
specified with the cmake flag LLVM_INLINER_MODEL_PATH.

LLVM_INLINER_MODEL_PATH has two sentinel values:
 - download, which will download the most recent compatible model.
 - autogenerate, which will autogenerate a "fake" model for testing the
 model uptake infrastructure.

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

3 years agoRevert "[LoopDeletion] Handle Phis with similar inputs from different blocks"
Nathan Chancellor [Mon, 21 Jun 2021 17:18:55 +0000 (10:18 -0700)]
Revert "[LoopDeletion] Handle Phis with similar inputs from different blocks"

This reverts commit bb1dc876ebb8a2eef38d5183d00c2db1437f1c91.

This patch causes an assertion failure when building an arm64 defconfig
Linux kernel.

See https://reviews.llvm.org/D103959 for a link to the original bug
report and a reduced reproducer.

3 years ago[flang] Fold more reduction intrinsic function calls
peter klausler [Fri, 18 Jun 2021 18:24:32 +0000 (11:24 -0700)]
[flang] Fold more reduction intrinsic function calls

Refactor the recently-implemented MAXVAL/MINVAL folding so
that the parts that can be used to implement other reduction
transformational intrinsic function folding are exposed.

Use them to implement folding of IALL, IANY, IPARITY,
SUM. and PRODUCT.  Replace the folding of ALL & ANY to
use the new infrastructure and become able to handle DIM=
arguments.

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

3 years agoRevert "[mlir][NFC] Move SubTensorOp and SubTensorInsertOp to TensorDialect"
Mehdi Amini [Mon, 21 Jun 2021 16:39:24 +0000 (16:39 +0000)]
Revert "[mlir][NFC] Move SubTensorOp and SubTensorInsertOp to TensorDialect"

This reverts commit 83bf801f5f266c788f025a3efbb0c83817137c3b.

This breaks the build with -DBUILD_SHARED_LIBS=ON

3 years ago[OpaquePtr] Return opaque pointer from opaque pointer GEP
Nikita Popov [Mon, 21 Jun 2021 15:43:06 +0000 (17:43 +0200)]
[OpaquePtr] Return opaque pointer from opaque pointer GEP

For a GEP on an opaque pointer, also return an opaque pointer (or
vector of opaque pointer) result.

This requires explicitly enumerating the GEP source element type,
because it is now no longer implicitly enumerated as part of either
the source or result pointer types.

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

3 years ago[lldb] Enable Rust v0 symbol demangling
Alexander Mols [Mon, 21 Jun 2021 15:56:55 +0000 (17:56 +0200)]
[lldb] Enable Rust v0 symbol demangling

Rust's v0 name mangling scheme [1] is easy to disambiguate from other
name mangling schemes because symbols always start with `_R`. The llvm
Demangle library supports demangling the Rust v0 scheme. Use it to
demangle Rust symbols.

Added unit tests that check simple symbols. Ran LLDB built with this
patch to debug some Rust programs compiled with the v0 name mangling
scheme. Confirmed symbol names were demangled as expected.

Note: enabling the new name mangling scheme requires a nightly
toolchain:

```
$ cat main.rs
fn main() {
    println!("Hello world!");
}
$ $(rustup which --toolchain nightly rustc) -Z symbol-mangling-version=v0 main.rs -g
$ /home/asm/hacking/llvm/build/bin/lldb ./main --one-line 'b main.rs:2'
(lldb) target create "./main"
Current executable set to '/home/asm/hacking/llvm/rust/main' (x86_64).
(lldb) b main.rs:2
Breakpoint 1: where = main`main::main + 4 at main.rs:2:5, address = 0x00000000000076a4
(lldb) r
Process 948449 launched: '/home/asm/hacking/llvm/rust/main' (x86_64)
warning: (x86_64) /lib64/libgcc_s.so.1 No LZMA support found for reading .gnu_debugdata section
Process 948449 stopped
* thread #1, name = 'main', stop reason = breakpoint 1.1
    frame #0: 0x000055555555b6a4 main`main::main at main.rs:2:5
   1    fn main() {
-> 2        println!("Hello world!");
   3    }
(lldb) bt
error: need to add support for DW_TAG_base_type '()' encoded with DW_ATE = 0x7, bit_size = 0
* thread #1, name = 'main', stop reason = breakpoint 1.1
  * frame #0: 0x000055555555b6a4 main`main::main at main.rs:2:5
    frame #1: 0x000055555555b78b main`<fn() as core::ops::function::FnOnce<()>>::call_once((null)=(main`main::main at main.rs:1), (null)=<unavailable>) at function.rs:227:5
    frame #2: 0x000055555555b66e main`std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>(f=(main`main::main at main.rs:1)) at backtrace.rs:125:18
    frame #3: 0x000055555555b851 main`std::rt::lang_start::<()>::{closure#0} at rt.rs:49:18
    frame #4: 0x000055555556c9f9 main`std::rt::lang_start_internal::hc51399759a90501a [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h04259e4a34d07c2f at function.rs:259:13
    frame #5: 0x000055555556c9f2 main`std::rt::lang_start_internal::hc51399759a90501a [inlined] std::panicking::try::do_call::hb8da45704d5cfbbf at panicking.rs:401:40
    frame #6: 0x000055555556c9f2 main`std::rt::lang_start_internal::hc51399759a90501a [inlined] std::panicking::try::h4beadc19a78fec52 at panicking.rs:365:19
    frame #7: 0x000055555556c9f2 main`std::rt::lang_start_internal::hc51399759a90501a [inlined] std::panic::catch_unwind::hc58016cd36ba81a4 at panic.rs:433:14
    frame #8: 0x000055555556c9f2 main`std::rt::lang_start_internal::hc51399759a90501a at rt.rs:34:21
    frame #9: 0x000055555555b830 main`std::rt::lang_start::<()>(main=(main`main::main at main.rs:1), argc=1, argv=0x00007fffffffcb18) at rt.rs:48:5
    frame #10: 0x000055555555b6fc main`main + 28
    frame #11: 0x00007ffff73f2493 libc.so.6`__libc_start_main + 243
    frame #12: 0x000055555555b59e main`_start + 46
(lldb)
```

[1]: https://github.com/rust-lang/rust/issues/60705

Reviewed By: clayborg, teemperor

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

3 years agoRegisterCoalescer: Fix iterating through use operands.
Hendrik Greving [Fri, 18 Jun 2021 22:16:38 +0000 (15:16 -0700)]
RegisterCoalescer: Fix iterating through use operands.

Fixes a minor bug when trying to iterate through use operands when
updating debug use operands.

Extends a test to include above.

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

3 years ago[HIP] Add support functions for C++ polymorphic types
Yaxun (Sam) Liu [Fri, 18 Jun 2021 20:39:41 +0000 (16:39 -0400)]
[HIP] Add support functions for C++ polymorphic types

Add runtime functions to detect invalid calls to pure or deleted virtual
functions.

Patch by: Siu Chi Chan

Reviewed by: Yaxun Liu

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

3 years ago[libc++] Remove unused variable
Fanbo Meng [Mon, 21 Jun 2021 15:39:05 +0000 (11:39 -0400)]
[libc++] Remove unused variable

Removing  `__current` as it becomes unused-but-set after 2cf78d4ead4a2ab5375bd6087724211d04119a28.

Reviewed By: ldionne, abhina.sreeskantharajan, #libc

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

3 years ago[InstCombine] move bitmanipulation-of-select folds
Sanjay Patel [Mon, 21 Jun 2021 15:27:52 +0000 (11:27 -0400)]
[InstCombine] move bitmanipulation-of-select folds

This is no outwardly-visible-difference-intended,
but it is obviously better to have all transforms
for an intrinsic housed together since we already
have helper functions in place.

It is also potentially more efficient to zap a
simple pattern match before trying to do expensive
computeKnownBits() calls.

3 years ago[SLP][AArch64] Add SLP vectorizer regression test. NFC
Rosie Sumpter [Mon, 21 Jun 2021 13:28:35 +0000 (14:28 +0100)]
[SLP][AArch64] Add SLP vectorizer regression test. NFC

This test is for a missed SLP vectorizer opportunity, reported here
https://bugs.llvm.org/show_bug.cgi?id=44593. This is due to a cost
modelling issue with vector reduction intrinsics which will be
fixed in a future commit (see https://reviews.llvm.org/D104538).

3 years ago[OpenCL] Add support of __opencl_c_images feature macro
Anton Zabaznov [Mon, 21 Jun 2021 14:45:36 +0000 (17:45 +0300)]
[OpenCL] Add support of __opencl_c_images feature macro

Reviewed By: svenvh

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

3 years agoTry to fix clang/test/Driver/cl-include.c failure
Hans Wennborg [Mon, 21 Jun 2021 15:18:00 +0000 (17:18 +0200)]
Try to fix clang/test/Driver/cl-include.c failure

Somewhat speculative. Example failures:
https://lab.llvm.org/buildbot/#/builders/5/builds/8857/steps/9/logs/stdio
https://lab.llvm.org/buildbot/#/builders/123/builds/4621/steps/8/logs/stdio

3 years ago[omp] Fix build without ITT after D103121 changes
Vladislav Vinogradov [Mon, 21 Jun 2021 12:56:54 +0000 (15:56 +0300)]
[omp] Fix build without ITT after D103121 changes

Reviewed By: AndreyChurbanov

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

3 years ago[mlir][NFC] Move SubTensorOp and SubTensorInsertOp to TensorDialect
Matthias Springer [Mon, 21 Jun 2021 15:03:47 +0000 (00:03 +0900)]
[mlir][NFC] Move SubTensorOp and SubTensorInsertOp to TensorDialect

The main goal of this commit is to remove the dependency of Standard dialect on the Tensor dialect.

* Rename ops: SubTensorOp --> ExtractTensorOp, SubTensorInsertOp --> InsertTensorOp
* Some helper functions are (already) duplicated between the Tensor dialect and the MemRef dialect. To keep this commit smaller, this will be cleaned up in a separate commit.
* Additional dialect dependencies: Shape --> Tensor, Tensor --> Standard
* Remove dialect dependencies: Standard --> Tensor
* Move canonicalization test cases to correct dialect (Tensor/MemRef).

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

3 years ago[InstCombine] fold ctlz/cttz-of-select with 1 or more constant arms
Sanjay Patel [Mon, 21 Jun 2021 14:51:30 +0000 (10:51 -0400)]
[InstCombine] fold ctlz/cttz-of-select with 1 or more constant arms

Building on:
4c44b02d87
...and adding handling for the extra operand in these intrinsics.

This pattern is discussed in:
https://llvm.org/PR50140

3 years agoAMDGPU: Add missing tests for v_fma_mixlo
Matt Arsenault [Mon, 14 Jun 2021 18:54:34 +0000 (14:54 -0400)]
AMDGPU: Add missing tests for v_fma_mixlo

3 years ago[mlir] Remove "getNumPayloadInductionVariables".
Alexander Belyaev [Mon, 21 Jun 2021 14:28:23 +0000 (16:28 +0200)]
[mlir] Remove "getNumPayloadInductionVariables".

This method always returns 0 after
https://reviews.llvm.org/rG7cddf56d608f07b8e49f7e2eeb4a20082611adb6

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

3 years ago[AArch64][SVE] Add missing target require to test
Bradley Smith [Mon, 21 Jun 2021 14:18:25 +0000 (15:18 +0100)]
[AArch64][SVE] Add missing target require to test

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

3 years ago[FuncSpec] Add minsize test. NFC.
Sjoerd Meijer [Mon, 21 Jun 2021 14:13:40 +0000 (15:13 +0100)]
[FuncSpec] Add minsize test. NFC.

3 years ago[NFC][libomptarget] Remove redundant libelf dependency for elf_common.
Vyacheslav Zakharin [Fri, 18 Jun 2021 16:46:10 +0000 (09:46 -0700)]
[NFC][libomptarget] Remove redundant libelf dependency for elf_common.

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

3 years ago[clang-cl] Implement /external:I, /external:env, and EXTERNAL_INCLUDE support (PR36003)
Hans Wennborg [Wed, 16 Jun 2021 13:22:17 +0000 (15:22 +0200)]
[clang-cl] Implement /external:I, /external:env, and EXTERNAL_INCLUDE support (PR36003)

This patch does three things:

- Map the /external:I flag to -isystem

- Add support for the /external:env:<var> flag which reads system
  include paths from the <var> environment variable

- Pick up system include dirs EXTERNAL_INCLUDE in addition to the old
  INCLUDE environment variable.

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

3 years ago[ARM] Transform a fixed-point to floating-point conversion into a VCVT_fix
Sam Tebbs [Mon, 7 Jun 2021 12:29:38 +0000 (13:29 +0100)]
[ARM] Transform a fixed-point to floating-point conversion into a VCVT_fix

Conversion from a fixed-point number to a floating-point number is done by
multiplying the fixed-point number by 2^(-n) where n is the number of
fractional bits. Currently this is lowered to a vcvt
(integer to floating-point) then a vmul, but it can instead be lowered
directly to a vcvt (fixed-point to floating-point). This patch enables
such transformations as long as the multiplication factor is a power of 2.

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

3 years ago[NFC] Fix typo
Sebastian Neubauer [Mon, 21 Jun 2021 12:59:30 +0000 (14:59 +0200)]
[NFC] Fix typo

3 years ago[AArch64][SVE] Wire up vscale_range attribute to SVE min/max vector queries
Bradley Smith [Fri, 4 Jun 2021 14:24:35 +0000 (15:24 +0100)]
[AArch64][SVE] Wire up vscale_range attribute to SVE min/max vector queries

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

3 years ago[Sema][SVE] Properly match builtin ID when using aux target
Bradley Smith [Fri, 18 Jun 2021 12:48:13 +0000 (13:48 +0100)]
[Sema][SVE] Properly match builtin ID when using aux target

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

3 years ago[lldb][NFC] Remove redundant deleted constructors in HostInfoBase subclasses
Raphael Isemann [Mon, 21 Jun 2021 11:19:15 +0000 (13:19 +0200)]
[lldb][NFC] Remove redundant deleted constructors in HostInfoBase subclasses

HostInfoBase has a deleted dtor/ctor so there is no need to do the same for
all the classes inheriting from it.

Reviewed By: DavidSpickett, JDevlieghere

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

3 years ago[LoopIdiom] Add test case that involves adds with flags and zero exts.
Florian Hahn [Mon, 21 Jun 2021 09:49:26 +0000 (10:49 +0100)]
[LoopIdiom] Add test case that involves adds with flags and zero exts.

Test coverage to ensure D104319 does not introduce a regression here.

3 years ago[mlir][ODS] Fix copy ctor for generate Pass classes
Vladislav Vinogradov [Tue, 15 Jun 2021 15:09:31 +0000 (18:09 +0300)]
[mlir][ODS] Fix copy ctor for generate Pass classes

Redirect the copy ctor to the actual class instead of
overwriting it with `TypeID` based ctor.

This allows the final Pass classes to have extra fields and logic for their copy.

Reviewed By: lattner

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

3 years ago[NFC] Wrap entire assert-only block in LLVM_DEBUG
Jordan Rupprecht [Mon, 21 Jun 2021 11:01:09 +0000 (04:01 -0700)]
[NFC] Wrap entire assert-only block in LLVM_DEBUG

3 years ago[mlir][Linalg] Silence warnings in Release builds. NFC.
Benjamin Kramer [Mon, 21 Jun 2021 10:55:25 +0000 (12:55 +0200)]
[mlir][Linalg] Silence warnings in Release builds. NFC.

mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp:940:8: warning: unused variable 'opProducesRootRead' [-Wunused-variable]
  bool opProducesRootRead =
       ^
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp:942:8: warning: unused variable 'opProducesRootWrite' [-Wunused-variable]
  bool opProducesRootWrite =
       ^
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp:1498:11: warning: unused variable 'resultNumber' [-Wunused-variable]
  int64_t resultNumber = result.getResultNumber();
          ^
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp:1497:11: warning: unused variable 'operandNumber' [-Wunused-variable]
  int64_t operandNumber = operand.getOperandNumber();
          ^
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp:267:20: warning: unused function 'getInPlace' [-Wunused-function]
static InPlaceSpec getInPlace(Value v) {
                   ^

3 years ago[VP][NFCI] Address various clang-tidy warnings
Fraser Cormack [Mon, 21 Jun 2021 08:50:27 +0000 (09:50 +0100)]
[VP][NFCI] Address various clang-tidy warnings

Reviewed By: simoll

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

3 years ago[lldb] Assert that CommandResultObject error messages are not empty
David Spickett [Fri, 18 Jun 2021 12:17:53 +0000 (12:17 +0000)]
[lldb] Assert that CommandResultObject error messages are not empty

The intention is now that AppendError/SetError/AppendRawError only
be called with some message to show. This enforces that.

For SetError with a Status and a fallback string first assert
that the Status is a failure Status. Then it calls SetError(StringRef)
which checks the message is valid. (which could be the fallback
or the Status')

Reviewed By: dblaikie

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

3 years ago[AMDGPU] Fix linking with shared libraries
Sebastian Neubauer [Mon, 21 Jun 2021 09:11:09 +0000 (11:11 +0200)]
[AMDGPU] Fix linking with shared libraries

AMDGPULDSUtils depends on llvm::CallGraph.

3 years ago[Mem2Reg] Regenerate test checks (NFC)
Nikita Popov [Mon, 21 Jun 2021 09:05:31 +0000 (11:05 +0200)]
[Mem2Reg] Regenerate test checks (NFC)

3 years ago[mlir][NFC] Remove Standard dialect dependency on MemRef dialect
Matthias Springer [Mon, 21 Jun 2021 08:45:16 +0000 (17:45 +0900)]
[mlir][NFC] Remove Standard dialect dependency on MemRef dialect

* Remove dependency: Standard --> MemRef
* Add dependencies: GPUToNVVMTransforms --> MemRef, Linalg --> MemRef, MemRef --> Tensor
* Note: The `subtensor_insert_propagate_dest_cast` test case in MemRef/canonicalize.mlir will be moved to Tensor/canonicalize.mlir in a subsequent commit, which moves over the remaining Tensor ops from the Standard dialect to the Tensor dialect.

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

3 years ago[Mem2Reg] Use poison for unreachable cases
Nikita Popov [Mon, 21 Jun 2021 08:47:14 +0000 (10:47 +0200)]
[Mem2Reg] Use poison for unreachable cases

Use poison instead of undef for cases dealing with unreachable
code. This still leaves the more interesting case of "load from
uninitialized memory" as undef.

3 years ago[Mem2Reg] Regenerate test checks (NFC)
Nikita Popov [Mon, 21 Jun 2021 08:47:59 +0000 (10:47 +0200)]
[Mem2Reg] Regenerate test checks (NFC)

3 years ago[InstCombine] Fold icmp (select c,const,arg), null if icmp arg, null can be simplified
Juneyoung Lee [Mon, 21 Jun 2021 07:50:54 +0000 (16:50 +0900)]
[InstCombine] Fold icmp (select c,const,arg), null if icmp arg, null can be simplified

This patch folds icmp (select c,const,arg), null if icmp arg, null can be simplified.

Resolves llvm.org/pr48975.

Reviewed By: nikic, xbolva00

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

3 years ago[FuncSpec] Don't specialise functions with NoDuplicate instructions.
Sjoerd Meijer [Thu, 17 Jun 2021 13:43:02 +0000 (14:43 +0100)]
[FuncSpec] Don't specialise functions with NoDuplicate instructions.

getSpecializationCost was returning INT_MAX for a case when specialisation
shouldn't happen, but this wasn't properly checked if specialisation was
forced.

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

3 years ago[mlir][linalg] Support low padding in subtensor(pad_tensor) lowering
Matthias Springer [Mon, 21 Jun 2021 07:29:42 +0000 (16:29 +0900)]
[mlir][linalg] Support low padding in subtensor(pad_tensor) lowering

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

3 years ago[gn build] Port 208332de8abf
LLVM GN Syncbot [Mon, 21 Jun 2021 07:27:34 +0000 (07:27 +0000)]
[gn build] Port 208332de8abf

3 years ago[AMDGPU] Add Optimize VGPR LiveRange Pass.
Ruiling Song [Mon, 19 Apr 2021 02:45:41 +0000 (10:45 +0800)]
[AMDGPU] Add Optimize VGPR LiveRange Pass.

This pass aims to optimize VGPR live-range in a typical divergent if-else
control flow. For example:

def(a)
if(cond)
  use(a)
  ... // A
else
  use(a)

As AMDGPU access vgpr with respect to active-mask, we can mark `a` as
dead in region A. For details, please refer to the comments in
implementation file.

The pass is enabled by default, the frontend can disable it through
"-amdgpu-opt-vgpr-liverange=false".

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

3 years ago[mlir][Linalg] NFC - Drop unused variable definition.
Nicolas Vasilache [Mon, 21 Jun 2021 07:08:02 +0000 (07:08 +0000)]
[mlir][Linalg] NFC - Drop unused variable definition.

3 years ago[mlir][Linalg] Introduce a BufferizationAliasInfo (6/n)
Nicolas Vasilache [Wed, 16 Jun 2021 11:39:40 +0000 (11:39 +0000)]
[mlir][Linalg] Introduce a BufferizationAliasInfo (6/n)

This revision adds a BufferizationAliasInfo which maintains and updates information about which tensors will alias once bufferized, which bufferized tensors are equivalent to others and how to handle clobbers.

Bufferization greedily tries to bufferize inplace by:

1. first trying to bufferize SubTensorInsertOp inplace, in reverse order (these are deemed the most expensives).
2. then trying to bufferize all non SubTensorOp / SubTensorInsertOp, in reverse order.
3. lastly trying to bufferize all SubTensorOp in reverse order.

Reverse order is a heuristic that seems to work nicely because structured tensor codegen very often proceeds by:

1. take a subset of a tensor
2. compute on that subset
3. insert the result subset into the full tensor and yield a new tensor.

BufferizationAliasInfo + equivalence sets + clobber analysis allows bufferizing nested
subtensor/compute/subtensor_insert sequences inplace to a certain extent.
To fully realize inplace bufferization, additional container-containee analysis will be necessary and is left for a subsequent commit.

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

3 years ago[gn build] Port 80fd5fa5269c
LLVM GN Syncbot [Mon, 21 Jun 2021 06:23:08 +0000 (06:23 +0000)]
[gn build] Port 80fd5fa5269c

3 years ago[AMDGPU] Replace non-kernel function uses of LDS globals by pointers.
hsmahesha [Mon, 21 Jun 2021 05:25:23 +0000 (10:55 +0530)]
[AMDGPU] Replace non-kernel function uses of LDS globals by pointers.

The main motivation behind pointer replacement of LDS use within non-kernel
functions is - to *avoid* subsequent LDS lowering pass from directly packing
LDS (assume large LDS) into a struct type which would otherwise cause allocating
huge memory for struct instance within every kernel.

Reviewed By: rampitec

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

3 years ago[AMDGPU][Libomptarget] Remove redundant functions
Pushpinder Singh [Fri, 18 Jun 2021 09:34:08 +0000 (09:34 +0000)]
[AMDGPU][Libomptarget] Remove redundant functions

There does not seem to be any use of these functions. They just
put the value to a local which is never used again.

Reviewed By: JonChesterfield

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

3 years ago[Test] Add some tests showing room for optimization exploiting undef and UB
Max Kazantsev [Mon, 21 Jun 2021 06:11:15 +0000 (13:11 +0700)]
[Test] Add some tests showing room for optimization exploiting undef and UB

3 years ago[clangd] Type hints for C++14 return type deduction
Nathan Ridge [Mon, 7 Jun 2021 06:53:37 +0000 (02:53 -0400)]
[clangd] Type hints for C++14 return type deduction

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

3 years ago[yaml2obj] Add support for writing the long symbol name.
Esme-Yi [Mon, 21 Jun 2021 05:09:56 +0000 (05:09 +0000)]
[yaml2obj] Add support for writing the long symbol name.

Summary: This patch, as a follow-up of D95505, adds
support for writing the long symbol name by implementing
the StringTable. Only XCOFF32 is suppoted now.

Reviewed By: jhenderson, shchenz

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

3 years ago[LoopDeletion] Handle Phis with similar inputs from different blocks
Max Kazantsev [Mon, 21 Jun 2021 04:37:06 +0000 (11:37 +0700)]
[LoopDeletion] Handle Phis with similar inputs from different blocks

This patch lifts the requirement to have the only incoming live block
for Phis. There can be multiple live blocks if the same value comes to
phi from all of them.

Differential Revision: https://reviews.llvm.org/D103959
Reviewed By: nikic, lebedev.ri

3 years ago[clang] NFC: adjust indentation of statements with more than one lines
Zhouyi Zhou [Mon, 21 Jun 2021 00:54:27 +0000 (08:54 +0800)]
[clang] NFC: adjust indentation of statements with more than one lines

Hi,

I think it will be more beautiful to adjust indentation of statements with more than one lines.

In function TreeTransform<Derived>::TransformDependentScopeDeclRefExpr
the second line of statement
NestedNameSpecifierLoc QualifierLoc \newline = getDerived().TransformNestedNameSpecifierLoc(E->getQualifierLoc());
is no more indent than the first line

There is a similar case in function TreeTransform<Derived>::TransformUnresolvedMemberExpr

Also I use clang-format to fix above functions

Thanks alot

Reviewed By: pengfei

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

3 years ago[lld/mac] Make a variable more local; no behavior change
Nico Weber [Mon, 21 Jun 2021 01:59:11 +0000 (21:59 -0400)]
[lld/mac] Make a variable more local; no behavior change

The variable used to need the wider scope, but doesn't after the
reland. See LC_LINKER_OPTIONS-related discussion on
https://reviews.llvm.org/D104353 for background.

3 years ago[InstCombine] Use poison constant to represent the result of unreachable instrs
Juneyoung Lee [Sun, 20 Jun 2021 06:00:15 +0000 (15:00 +0900)]
[InstCombine] Use poison constant to represent the result of unreachable instrs

This patch updates InstCombine to use poison constant to represent the resulting value of (either semantically or syntactically) unreachable instrs, or a don't-care value of an unreachable store instruction.

This allows more aggressive folding of unused results, as shown in llvm/test/Transforms/InstCombine/getelementptr.ll .

Reviewed By: nikic

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

3 years ago[lld/mac] Test zerofill sections after __thread_bss
Nico Weber [Sun, 20 Jun 2021 23:39:09 +0000 (19:39 -0400)]
[lld/mac] Test zerofill sections after __thread_bss

Real zerofill sections go after __thread_bss, since zerofill sections
must all be at the end of their segment and __thread_bss must be right
after __thread_data.

Works fine already, but wasn't tested as far as I can tell.

Also tweak comment about zerofill sections a bit.

No behavior change.

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

3 years ago[NFC][ScalarEvolution] Clean up ExitLimit constructors.
Eli Friedman [Mon, 21 Jun 2021 00:16:28 +0000 (17:16 -0700)]
[NFC][ScalarEvolution] Clean up ExitLimit constructors.

Make all the constructors forward to one constructor.  Remove redundant
assertions.

3 years ago[IVDescriptors] Fix comment that getUnsafeAlgebraInst has been renamed to getExactFPM...
Jim Lin [Sun, 20 Jun 2021 23:56:22 +0000 (07:56 +0800)]
[IVDescriptors] Fix comment that getUnsafeAlgebraInst has been renamed to getExactFPMathInst

https://reviews.llvm.org/rG36a489d194750dc888f214240e9dec9122ca1f0e renamed the function call
in the test from getUnsafeAlgebraInst to getExactFPMathInst.

Reviewed By: spatel

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

3 years ago[lld-macho] Have inputOrder default to less than INT_MAX
Jez Ng [Sun, 20 Jun 2021 23:49:13 +0000 (19:49 -0400)]
[lld-macho] Have inputOrder default to less than INT_MAX

We make it less than INT_MAX in order not to conflict with the ordering
of zerofill sections, which must always be placed at the end of their
segment.

This is the more structural fix for the issue addressed in {D104596}.

Reviewed By: #lld-macho, thakis

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

3 years ago[ELF] Delete --no-cref which does not exist in GNU ld
Fangrui Song [Sun, 20 Jun 2021 21:28:56 +0000 (14:28 -0700)]
[ELF] Delete --no-cref which does not exist in GNU ld

Also delete the single dash form which does not appear to be used.

3 years ago[ELF][test] Add missing tests for --no-export-dynamic & --no-warn-backrefs
Fangrui Song [Sun, 20 Jun 2021 21:20:14 +0000 (14:20 -0700)]
[ELF][test] Add missing tests for --no-export-dynamic & --no-warn-backrefs

3 years ago[GCOVProfiling][test] Ensure that 'opt' drops any files in a temp directory
Dmitri Gribenko [Sun, 20 Jun 2021 20:48:35 +0000 (22:48 +0200)]
[GCOVProfiling][test] Ensure that 'opt' drops any files in a temp directory

3 years agoTry to unbreak the windows CI
Jason Molenda [Sun, 20 Jun 2021 20:12:38 +0000 (13:12 -0700)]
Try to unbreak the windows CI

MSVC and clang seem to disagree with whether I can do this.

3 years ago[TypePromotion] Prune Intrinsic includes. NFC
Craig Topper [Sun, 20 Jun 2021 02:52:52 +0000 (19:52 -0700)]
[TypePromotion] Prune Intrinsic includes. NFC

TypePromotion is meant to be a generic pass and doesn't reference
any ARM intrinsics so it shouldn't include IntrinsicsARM.h.
The other Intrinsic related headers appear to be unneeded as well.

3 years agoAdd a corefile style option to process save-core; skinny corefiles
Jason Molenda [Sun, 20 Jun 2021 19:19:50 +0000 (12:19 -0700)]
Add a corefile style option to process save-core; skinny corefiles

Add a new feature to process save-core on Darwin systems -- for
lldb to create a user process corefile with only the dirty (modified
memory) pages included.  All of the binaries that were used in the
corefile are assumed to still exist on the system for the duration
of the use of the corefile.  A new --style option to process save-core
is added, so a full corefile can be requested if portability across
systems, or across time, is needed for this corefile.

debugserver can now identify the dirty pages in a memory region
when queried with qMemoryRegionInfo, and the size of vm pages is
given in qHostInfo.

Create a new "all image infos" LC_NOTE for Mach-O which allows us
to describe all of the binaries that were loaded in the process --
load address, UUID, file path, segment load addresses, and optionally
whether code from the binary was executing on any thread.  The old
"read dyld_all_image_infos and then the in-memory Mach-O load
commands to get segment load addresses" no longer works when we
only have dirty memory.

rdar://69670807
Differential Revision: https://reviews.llvm.org/D88387

3 years ago[LoopUnroll] Use smallest exact trip count from any exit
Nikita Popov [Sat, 19 Jun 2021 07:44:28 +0000 (09:44 +0200)]
[LoopUnroll] Use smallest exact trip count from any exit

This is a more general alternative/extension to D102635. Rather than
handling the special case of "header exit with non-exiting latch",
this unrolls against the smallest exact trip count from any exit.
The latch exit is no longer treated as priviledged when it comes to
full unrolling.

The motivating case is in full-unroll-one-unpredictable-exit.ll.
Here the header exit is an IV-based exit, while the latch exit is
a data comparison. This kind of loop does not get rotated, because
the latch is already exiting, and loop rotation doesn't try to
distinguish IV-based/analyzable latches.

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

3 years ago[mlir] Fix -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build. NFC
Fangrui Song [Sun, 20 Jun 2021 18:55:00 +0000 (11:55 -0700)]
[mlir] Fix -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build. NFC

3 years ago[lld-link] Fix -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build. NFC
Fangrui Song [Sun, 20 Jun 2021 18:35:01 +0000 (11:35 -0700)]
[lld-link] Fix -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build. NFC

3 years agoFix -Wunused-variable and -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off...
Fangrui Song [Sun, 20 Jun 2021 18:09:07 +0000 (11:09 -0700)]
Fix -Wunused-variable and -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=off build. NFC

3 years ago[lldb] [Process/elf-core] Fix reading NetBSD/i386 core dumps
Michał Górny [Thu, 22 Apr 2021 17:42:52 +0000 (19:42 +0200)]
[lldb] [Process/elf-core] Fix reading NetBSD/i386 core dumps

Add support for extracting basic data from NetBSD/i386 core dumps.
FPU registers are not supported at the moment.

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

3 years ago[DSE] Remove stores in the same loop iteration
David Green [Sun, 20 Jun 2021 16:03:30 +0000 (17:03 +0100)]
[DSE] Remove stores in the same loop iteration

DSE will currently only remove stores in the same block unless they can
be guaranteed to be loop invariant. This expands that to any stores that
are in the same Loop, at the same loop level. This should still account
for where AA/MSSA will not handle aliasing between loops, but allow the
dead stores to be removed where they overlap in the same loop iteration.
It requires adding loop info to DSE, but that looks fairly harmless.

The test case this helps is from code like this, which can come up in
certain matrix operations:
  for(i=..)
    dst[i] = 0;
    for(j=..)
      dst[i] += src[i*n+j];

After LICM, this becomes:
for(i=..)
  dst[i] = 0;
  sum = 0;
  for(j=..)
    sum += src[i*n+j];
  dst[i] = sum;

The first store is dead, and with this patch is now removed.

Differntial Revision: https://reviews.llvm.org/D100464

3 years ago[InstCombine] fold ctpop-of-select with 1 or more constant arms
Sanjay Patel [Sun, 20 Jun 2021 15:26:11 +0000 (11:26 -0400)]
[InstCombine] fold ctpop-of-select with 1 or more constant arms

The general pattern is mentioned in:
https://llvm.org/PR50140
...but we need to do a bit more to handle intrinsics with extra operands
like ctlz/cttz.