platform/upstream/llvm.git
3 years agoGlobalISel: Implement computeKnownBits for G_BSWAP and G_BITREVERSE
Matt Arsenault [Thu, 27 Aug 2020 21:55:35 +0000 (17:55 -0400)]
GlobalISel: Implement computeKnownBits for G_BSWAP and G_BITREVERSE

3 years ago[PowerPC] Handle STRICT_FSETCC(S) in more cases
Qiu Chaofan [Tue, 1 Sep 2020 16:29:12 +0000 (00:29 +0800)]
[PowerPC] Handle STRICT_FSETCC(S) in more cases

On -O0, i1 strict_fsetcc will be promoted to i32. We don't handle that
in TD patterns. This patch fills logic in PPCISelDAGToDAG to handle more
cases.

Reviewed By: uweigand

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

3 years ago[builtins] Unify the softfloat division implementation
Anatoly Trosinenko [Tue, 1 Sep 2020 16:03:29 +0000 (19:03 +0300)]
[builtins] Unify the softfloat division implementation

This patch replaces three different pre-existing implementations of
__div[sdt]f3 LibCalls with a generic one - like it is already done for
many other LibCalls.

Reviewed By: sepavloff

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

3 years ago[libc++] Improve REQUIRES for _ExtInt test on recent Clangs
Louis Dionne [Tue, 1 Sep 2020 15:13:44 +0000 (11:13 -0400)]
[libc++] Improve REQUIRES for _ExtInt test on recent Clangs

The previous REQUIRES: would cause the test to run only on Clang-11, not
even on following versions of Clang, which was mostly not the intent.

3 years ago[DAGCombiner] Fold an AND of a masked load into a zext_masked_load
Sam Tebbs [Tue, 1 Sep 2020 14:36:47 +0000 (15:36 +0100)]
[DAGCombiner] Fold an AND of a masked load into a zext_masked_load

This patch folds an AND of a masked load and build vector into a zero
extended masked load.

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

3 years ago[PowerPC] Implement instruction definitions/MC Tests for xvcvspbf16 and xvcvbf16spn
Amy Kwan [Tue, 1 Sep 2020 15:15:45 +0000 (10:15 -0500)]
[PowerPC] Implement instruction definitions/MC Tests for xvcvspbf16 and xvcvbf16spn

This patch adds the td instruction definitions of the xvcvspbf16 and xvcvbf16spn
instructions, along with their respective MC tests.

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

3 years ago[flang] Improve compile-time shape conformance checking
peter klausler [Mon, 31 Aug 2020 19:06:41 +0000 (12:06 -0700)]
[flang] Improve compile-time shape conformance checking

Conformance checking of the shapes of the operands of
array expressions can't, of course, always be done at
compilation time; but when the shapes are known and
nonconformable, we should catch the errors that we can.

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

3 years agoGlobalISel: Add combines for extend operations
Volkan Keles [Tue, 1 Sep 2020 15:50:06 +0000 (08:50 -0700)]
GlobalISel: Add combines for extend operations

https://reviews.llvm.org/D86516

3 years agoGlobalISel: Implement computeNumSignBits for G_SEXTLOAD/G_ZEXTLOAD
Matt Arsenault [Fri, 28 Aug 2020 14:52:32 +0000 (10:52 -0400)]
GlobalISel: Implement computeNumSignBits for G_SEXTLOAD/G_ZEXTLOAD

3 years agoGlobalISel: Implement computeKnownBits for G_UNMERGE_VALUES
Matt Arsenault [Thu, 27 Aug 2020 20:17:41 +0000 (16:17 -0400)]
GlobalISel: Implement computeKnownBits for G_UNMERGE_VALUES

3 years agoRevert "Reapply D70800: Fix AArch64 AAPCS frame record chain"
Paul Walker [Tue, 1 Sep 2020 14:52:59 +0000 (15:52 +0100)]
Revert "Reapply D70800: Fix AArch64 AAPCS frame record chain"

This reverts commit e9d9a612084b47fc4277523561d61e675370c854.

This patch was previously revert by 04879086b44348cad600a0a1ccbe1f7776cc3cf9
with the reapplication being done after breaking the assert used to
ensure SP is always 16-byte aligned, which is a requirement of the AAPCS.

For extra context the latest patch caused runtime failures when
building with "-march=armv8-a+sve -mllvm -aarch64-sve-vector-bits-min=256".

3 years agoGlobalISel: Artifact combine unmerge of unmerge
Matt Arsenault [Thu, 20 Aug 2020 12:55:08 +0000 (08:55 -0400)]
GlobalISel: Artifact combine unmerge of unmerge

Unmerges have the same fundamental problem as G_TRUNC, and G_TRUNC
could be implemented in terms of G_UNMERGE_VALUES. Reducing the number
of elements in unmerge results ends up producing the original unmerge
type profile, so the artifact combiner needs to eliminate the
intermediate illegal registers. This avoids infinite looping in the
legalizer in a future change.

Assuming an unmerge has each result unmerged the same way, this ends
up producing a new unmerge of the source for every definition. I'm not
sure if the artifact combiner should either insert temporary merges
here and erase the original merge, or if the combiner should look at
uses from defs rather than defs from uses for unmerges.

In a few cases this regresses from using 16-bit shifts for 8-bit
values to using 32-bit shifts, but I think these can be legalized
later (the other legalization rules don't try very hard to use 16-bit
shifts either).

3 years agoPowerPC: Switch test to generated checks
Matt Arsenault [Tue, 1 Sep 2020 14:33:49 +0000 (10:33 -0400)]
PowerPC: Switch test to generated checks

3 years agoAMDGPU: Check some offsets in test
Matt Arsenault [Mon, 31 Aug 2020 20:13:23 +0000 (16:13 -0400)]
AMDGPU: Check some offsets in test

This will make updating the checks easier in a future change.

3 years agoAMDGPU: Convert test to MIR
Matt Arsenault [Mon, 31 Aug 2020 18:13:25 +0000 (14:13 -0400)]
AMDGPU: Convert test to MIR

Currently the dbg_value ends up in the relaxed branch block. A future
commit will push the dbg_value out of this block, and I'm not sure how
to coax the IR into producing the same MIR at the relevant point.

3 years ago[SystemZ][z/OS] Fix build break in z/OS toolchain
Abhina Sreeskantharajan [Tue, 1 Sep 2020 14:40:01 +0000 (10:40 -0400)]
[SystemZ][z/OS] Fix build break in z/OS toolchain

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

3 years ago[SystemZ][z/OS] Adding initial toolchain for z/OS
Abhina Sreeskantharajan [Tue, 1 Sep 2020 14:09:02 +0000 (10:09 -0400)]
[SystemZ][z/OS] Adding initial toolchain for z/OS

This patch adds the initial toolchain for z/OS that will set some defaults. In subsequent patches, we plan to add support to use the system linker and assembler.

Reviewed By: hubert.reinterpretcast

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

3 years ago[LoopIdiomRecognizePass] Options to disable part or the entire Loop Idiom Recognize...
Anh Tuyen Tran [Tue, 1 Sep 2020 13:59:24 +0000 (13:59 +0000)]
[LoopIdiomRecognizePass] Options to disable part or the entire Loop Idiom Recognize Pass

Loop Idiom Recognize Pass (LIRP) attempts to transform loops with subscripted arrays
into memcpy/memset function calls. In some particular situation, this transformation
introduces negative impacts. For example: https://bugs.llvm.org/show_bug.cgi?id=47300

This patch will enable users to disable a particular part of the transformation, while
he/she can still enjoy the benefit brought about by the rest of LIRP. The default
behavior stays unchanged: no part of LIRP is disabled by default.

Reviewed By: etiotto (Ettore Tiotto)

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

3 years ago[NFC] Test commit, whitespace changes
Abhina Sreeskantharajan [Tue, 1 Sep 2020 13:31:28 +0000 (09:31 -0400)]
[NFC] Test commit, whitespace changes

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

3 years ago[llvm-readobj] - Remove Error.cpp,.h and drop dependencies in the code.
Georgii Rymar [Fri, 28 Aug 2020 09:18:19 +0000 (12:18 +0300)]
[llvm-readobj] - Remove Error.cpp,.h and drop dependencies in the code.

We have Error.cpp/.h which contains some code for working with error codes.
In fact we use Error/Expected<> almost everywhere already and we can get rid
of these files.

Note: a few places in the code used readobj specific error codes,
e.g. `return readobj_error::unknown_symbol`. But these codes are never really used,
i.e. the code checks the fact of a success/error call only.
So I've changes them to `return inconvertibleErrorCode()` for now.
It seems that these places probably should be converted to use `Error`/`Expected<>`.

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

3 years ago[InstCombine] adjust recip sqrt tests for better coverage; NFC
Sanjay Patel [Tue, 1 Sep 2020 13:41:43 +0000 (09:41 -0400)]
[InstCombine] adjust recip sqrt tests for better coverage; NFC

Goes with D86726

3 years agoReland [FileCheck] Move FileCheck implementation out of LLVMSupport into its own...
Raphael Isemann [Tue, 1 Sep 2020 11:21:18 +0000 (13:21 +0200)]
Reland [FileCheck] Move FileCheck implementation out of LLVMSupport into its own library

This relands e9a3d1a401b07cbf7b11695637f1b549782a26cd which was originally
missing linking LLVMSupport into LLMVFileCheck which broke the SHARED_LIBS build.

Original summary:

The actual FileCheck logic seems to be implemented in LLVMSupport. I don't see a
good reason for having FileCheck implemented there as it has a very specific use
while LLVMSupport is a dependency of pretty much every LLVM tool there is. In
fact, the only use of FileCheck I could find (outside the FileCheck tool and the
FileCheck unit test) is a single call in GISelMITest.h.

This moves the FileCheck logic to its own LLVMFileCheck library. This way only
FileCheck and the GlobalISelTests now have a dependency on this code.

Reviewed By: jhenderson

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

3 years ago[OpenMP] Fix infinite loop in Sema::isOpenMPGlobalCapturedDecl()
Yang Fan [Tue, 1 Sep 2020 12:45:23 +0000 (08:45 -0400)]
[OpenMP] Fix infinite loop in Sema::isOpenMPGlobalCapturedDecl()

Function Sema::isOpenMPGlobalCapturedDecl() has a parameter `unsigned Level`,
but use `Level >= 0` as the condition of `while`, thus cause an infinite loop.
Fix by changing the loop condition to `Level > 0`.

Reviewed By: ABataev

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

3 years ago[NFC][Asan] Format includes
Vitaly Buka [Tue, 1 Sep 2020 11:45:11 +0000 (04:45 -0700)]
[NFC][Asan] Format includes

3 years ago[llvm-dwarfdump][test] Add tests for dumping the .debug_line_str section.
Xing GUO [Tue, 1 Sep 2020 12:21:57 +0000 (20:21 +0800)]
[llvm-dwarfdump][test] Add tests for dumping the .debug_line_str section.

This patch adds tests for dumping the .debug_line_str section. The
dumper of the debug_line_str section is able to write nonprintable
strings as escaped chars while the dumper of the debug_str and
debug_str.dwo sections cannot. I will fix them and add tests for them
in a follow-up patch.

Reviewed By: jhenderson

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

3 years ago[libcxx] Link target `cxx_external_threads` to `cxx-headers` for BUILD_EXTERNAL_THREA...
David Nicuesa [Tue, 1 Sep 2020 11:41:21 +0000 (12:41 +0100)]
[libcxx] Link target `cxx_external_threads` to `cxx-headers` for BUILD_EXTERNAL_THREAD_LIBRARY

Fix compilation of libcxx when using -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY. Target `cxx_external_threads` gets linked to `cxx-headers` to include all needed headers and flags.

Reviewed By: #libc, ldionne

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

3 years ago[llvm-readobj][test] - Remove amdgpu-elf-definitions.test
Georgii Rymar [Fri, 28 Aug 2020 11:05:10 +0000 (14:05 +0300)]
[llvm-readobj][test] - Remove amdgpu-elf-definitions.test

`amdgpu-elf-definitions.test` is a file that tests
`Format`, 'OS/ABI' and 'Machine' fields printed for EM_AMDGPU.
It uses a precompiled object.

It is not needed to have it, because:
1) We already test formats in `file-header-format.test` + `llvm/unittests/Object/ELFObjectFileTest.cpp`.
2) We test 'OS/ABI' in `file-header-os-abi.test` for all possible values.
3) We test machine types in `file-header-machine-types.test`

In addition we have `amdgpu-elf-headers.test` which tests EM_AMDGPU specific flags. I.e.
it also tests the fact that llvm-readobj/elf are able to dump such objects.

This patch removes the test case and the corresponding binary.

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

3 years ago[llvm-readobj][test] - Update the comment in archive.test
Georgii Rymar [Tue, 1 Sep 2020 11:01:05 +0000 (14:01 +0300)]
[llvm-readobj][test] - Update the comment in archive.test

Addresses post commit review comment for D86771.

3 years ago[llvm-readobj/elf] - Report warnings instead of errors when dumping broken stack...
Georgii Rymar [Fri, 28 Aug 2020 13:38:18 +0000 (16:38 +0300)]
[llvm-readobj/elf] - Report warnings instead of errors when dumping broken stack sizes sections.

This replaces `reportError` calls with `reportUniqueWarning` and improves testing
for the code that is related to stack sizes dumping.

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

3 years ago[NFCI] Removed an un-used declaration got accidentally introduced in f91d18eaa946b2d2...
Sourabh Singh Tomar [Tue, 1 Sep 2020 10:26:47 +0000 (15:56 +0530)]
[NFCI] Removed an un-used declaration got accidentally introduced in f91d18eaa946b2d2ea5a9

3 years agoRevert "[lldb] Add reproducer verifier"
Raphael Isemann [Tue, 1 Sep 2020 10:21:44 +0000 (12:21 +0200)]
Revert "[lldb] Add reproducer verifier"

This reverts commit 297f69afac58fc9dc13897857a5e70131c5adc85. It broke
the Fedora 33 x86-64 bot. See the review for more info.

3 years ago[analyzer][StdLibraryFunctionsChecker] Use Optionals throughout the summary API
Gabor Marton [Tue, 25 Aug 2020 11:33:41 +0000 (13:33 +0200)]
[analyzer][StdLibraryFunctionsChecker] Use Optionals throughout the summary API

By using optionals, we no longer have to check the validity of types that we
get from a lookup. This way, the definition of the summaries have a declarative
form, there are no superflous conditions in the source code.

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

3 years ago[SVE][CodeGen] Fix TypeSize/ElementCount related warnings in sve-split-load.ll
David Sherwood [Wed, 26 Aug 2020 09:34:31 +0000 (10:34 +0100)]
[SVE][CodeGen] Fix TypeSize/ElementCount related warnings in sve-split-load.ll

I have fixed up a number of warnings resulting from TypeSize -> uint64_t
casts and calling getVectorNumElements() on scalable vector types. I
think most of the changes are fairly trivial except for those in
DAGTypeLegalizer::SplitVecRes_MLOAD I've tried to ensure we create
the MachineMemoryOperands in a sensible way for scalable vectors.

I have added a CHECK line to the following test:

  CodeGen/AArch64/sve-split-load.ll

that ensures no new warnings are added.

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

3 years agoRevert "[ARM] Register pressure with -mthumb forces register reload before each call"
David Green [Tue, 1 Sep 2020 06:39:54 +0000 (07:39 +0100)]
Revert "[ARM] Register pressure with -mthumb forces register reload before each call"

Expensive checks are failing, complaining about additional MMO operands
added to the branch.

3 years agoClassify (small unsigned bitfield) < 0 comparisons under
Richard Smith [Tue, 1 Sep 2020 06:12:06 +0000 (23:12 -0700)]
Classify (small unsigned bitfield) < 0 comparisons under
-Wtautological-unsigned-zero-compare not under
-Wtautological-value-range-compare.

3 years agoMore accurately compute the ranges of possible values for +, -, *, &, %.
Richard Smith [Tue, 11 Aug 2020 20:49:59 +0000 (13:49 -0700)]
More accurately compute the ranges of possible values for +, -, *, &, %.

Continue to heuristically pick the wider of the two operands for
narrowing conversion warnings so that some_char + 1 isn't treated as
being wider than a char, but use the more accurate computation for
tautological comparison warnings.

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

3 years ago[Test] Move IndVars test to a proper place
Max Kazantsev [Tue, 1 Sep 2020 05:17:31 +0000 (12:17 +0700)]
[Test] Move IndVars test to a proper place

3 years agoFix -Wcompound-token-split to give the same warnings under -E
Richard Smith [Tue, 1 Sep 2020 02:04:35 +0000 (19:04 -0700)]
Fix -Wcompound-token-split to give the same warnings under -E
-frewrite-includes.

Remove the special-case (and highly implausible) diagnostic for a
compound token that crosses a file boundary, and instead model that case
the same as a compound token separated by whitespace, so that file
transitions and presumed file transitions behave the same way.

3 years agoRemove -Wcompound-token-split-by-space from -Wall.
Richard Smith [Tue, 1 Sep 2020 01:03:18 +0000 (18:03 -0700)]
Remove -Wcompound-token-split-by-space from -Wall.

Use of a linebreak between the `(` and `{` in a GNU statement-expression
appears to be too common to include this warning in -Wall -- this occurs
in some Linux kernel headers, for example.

3 years ago[CMake] Use find_library for ncurses
Petr Hosek [Mon, 31 Aug 2020 22:11:39 +0000 (15:11 -0700)]
[CMake] Use find_library for ncurses

Currently it is hard to avoid having LLVM link to the system install of
ncurses, since it uses check_library_exists to find e.g. libtinfo and
not find_library or find_package.

With this change the ncurses lib is found with find_library, which also
considers CMAKE_PREFIX_PATH. This solves an issue for the spack package
manager, where we want to use the zlib installed by spack, and spack
provides the CMAKE_PREFIX_PATH for it.

This is a similar change as https://reviews.llvm.org/D79219, which just
landed in master.

Patch By: haampie

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

3 years ago[MemorySSA] Clean up single value phis.
Alina Sbirlea [Mon, 31 Aug 2020 23:56:05 +0000 (16:56 -0700)]
[MemorySSA] Clean up single value phis.

MemoryPhis with a single value are correct, but can lead to errors when
updating. Clean up single entry Phis newly added when cloning blocks.
Resolves PR46574.

3 years ago[DWARFYAML] Make the debug_str section optional.
Xing GUO [Tue, 1 Sep 2020 01:57:03 +0000 (09:57 +0800)]
[DWARFYAML] Make the debug_str section optional.

This patch makes the debug_str section optional. When the debug_str
section exists but doesn't contain anything, yaml2obj will emit a
section header for it.

Reviewed By: grimar

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

3 years ago[OpenMPOpt][NFC] Moving constants as struct static attributes
Hamilton Tobon Mosquera [Mon, 31 Aug 2020 23:37:23 +0000 (18:37 -0500)]
[OpenMPOpt][NFC] Moving constants as struct static attributes

3 years ago[mlir][openacc] Add missing attributes and operands for acc.loop
Valentin Clement [Mon, 31 Aug 2020 23:49:44 +0000 (19:49 -0400)]
[mlir][openacc] Add missing attributes and operands for acc.loop

This patch add the missing operands to the acc.loop operation. Only the device_type
information is not part of the operation for now.

Reviewed By: rriddle, kiranchandramohan

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

3 years ago[flang] Check shape conformance on initializers
peter klausler [Mon, 31 Aug 2020 18:54:48 +0000 (11:54 -0700)]
[flang] Check shape conformance on initializers

Specifically, ensure that initializers conform with their objects
according to 8.2 para 4.

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

3 years agoFix mlir-reduce to explicitly register dialects and disable the global dialect regist...
Mehdi Amini [Mon, 31 Aug 2020 22:39:39 +0000 (22:39 +0000)]
Fix mlir-reduce to explicitly register dialects and disable the global dialect registry by default

Clients who rely on the Context loading dialects from the global
registry can call `mlir::enableGlobalDialectRegistry(true);` before
creating an MLIRContext

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

3 years ago[SVE] Remove calls to VectorType::getNumElements() from llvm-stress
Christopher Tetreault [Mon, 31 Aug 2020 22:47:47 +0000 (15:47 -0700)]
[SVE] Remove calls to VectorType::getNumElements() from llvm-stress

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

3 years ago[flang] Make `TypeParamInquiry` monomorphic
peter klausler [Tue, 25 Aug 2020 16:40:20 +0000 (09:40 -0700)]
[flang] Make `TypeParamInquiry` monomorphic

Change the expression representation TypeParamInquiry from being
a class that's templatized on the integer KIND of its result into
a monomorphic representation that results in a SubscriptInteger
that can then be converted.

This is a minor simplification, but it's worth doing because
it is believed to also be a work-around for bugs in the MSVC
compiler with overload resolution that affect the expression
traversal framework.

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

3 years ago[ORC] Remove an unused variable.
Lang Hames [Mon, 31 Aug 2020 22:16:03 +0000 (15:16 -0700)]
[ORC] Remove an unused variable.

The unused Main variable was accidentally left in an earlier commit.

3 years ago[lldb] Add reproducer verifier
Jonas Devlieghere [Mon, 31 Aug 2020 22:13:49 +0000 (15:13 -0700)]
[lldb] Add reproducer verifier

Add a reproducer verifier that catches:

 - Missing or invalid home directory
 - Missing or invalid working directory
 - Missing or invalid module/symbol paths
 - Missing files from the VFS

The verifier is enabled by default during replay, but can be skipped by
passing --reproducer-no-verify.

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

3 years ago[SVE] Mark VectorType::getNumElements() deprecated
Christopher Tetreault [Mon, 31 Aug 2020 21:38:18 +0000 (14:38 -0700)]
[SVE] Mark VectorType::getNumElements() deprecated

getNumElements() is being removed from base VectorType in
order to eliminate the class of bugs in which a scalable vector
is accidentally treated like a fixed length vector. Clients of
this function should either call getElementCount(), and handle
the case where getElementCount().isScalable() is true, or they can
cast to FixedVectorType and call getNumElements() if they are
sure that the vector has fixed width.

Deprecated VectorType functions will be removed after the LLVM
12 branch.

See: http://lists.llvm.org/pipermail/llvm-dev/2020-March/139811.html

Reviewed By: fpetrogalli

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

3 years ago[analyzer][NFC] Add `override` keyword missing from D86027
Hubert Tong [Mon, 31 Aug 2020 21:57:22 +0000 (17:57 -0400)]
[analyzer][NFC] Add `override` keyword missing from D86027

Speculative fix for `-Werror,-Wsuggest-override` build failures on
the ppc64le-lld-multistage-test bot.

3 years ago[flang] Format label scope is independent of block scope
peter klausler [Mon, 31 Aug 2020 17:45:37 +0000 (10:45 -0700)]
[flang] Format label scope is independent of block scope

Compilation of the following program currently generates a warning message:

        i = 1
        if (i .eq. 0) then
          write(6, 200) i
200       format (I8)
        end if
        write(6, 200) i
      end

x.f90:6:9: Label '200' is not in scope
          write(6, 200) i
          ^^^^^^^^^^^^^^^

Whereas branch targets must conform to the Clause 11.1.2.1 program
requirement "Transfer of control to the interior of a block from
outside the block is prohibited, ...", this doesn't apply to format
statement references.

3 years ago[OpenMPOpt][HideMemTransfersLatency] Get values stored in offload arrays
Hamilton Tobon Mosquera [Mon, 31 Aug 2020 20:29:22 +0000 (15:29 -0500)]
[OpenMPOpt][HideMemTransfersLatency] Get values stored in offload arrays

getValuesInOffloadArrays goes through the offload arrays in __tgt_target_data_begin_mapper getting the values stored in them before the call is issued.

call void @__tgt_target_data_begin_mapper(arg0, arg1,
    i8** %offload_baseptrs, i8** %offload_ptrs, i64* %offload_sizes,
...)

Diferential Revision: https://reviews.llvm.org/D86300

3 years ago[mlir][PDL] Move the formats for PatternOp and RewriteOp to the declarative form.
River Riddle [Mon, 31 Aug 2020 19:34:04 +0000 (12:34 -0700)]
[mlir][PDL] Move the formats for PatternOp and RewriteOp to the declarative form.

This is possible now that the declarative assembly form supports regions.

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

3 years ago[mlir][OpFormatGen] Add initial support for regions in the custom op assembly format
River Riddle [Mon, 31 Aug 2020 19:33:55 +0000 (12:33 -0700)]
[mlir][OpFormatGen] Add initial support for regions in the custom op assembly format

This adds some initial support for regions and does not support formatting the specific arguments of a region. For now this can be achieved by using a custom directive that formats the arguments and then parses the region.

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

3 years ago[mlir][ODS] Add new SymbolNameAttr and add support for in assemblyFormat
River Riddle [Mon, 31 Aug 2020 19:33:46 +0000 (12:33 -0700)]
[mlir][ODS] Add new SymbolNameAttr and add support for in assemblyFormat

Symbol names are a special form of StringAttr that get treated specially in certain areas, such as formatting. This revision adds a special derived attr for them in ODS and adds support in the assemblyFormat for formatting them properly.

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

3 years ago[mlir][OpFormatGen] Add support for specifiy "custom" directives.
River Riddle [Mon, 31 Aug 2020 19:33:36 +0000 (12:33 -0700)]
[mlir][OpFormatGen] Add support for specifiy "custom" directives.

This revision adds support for custom directives to the declarative assembly format. This allows for users to use C++ for printing and parsing subsections of an otherwise declaratively specified format. The custom directive is structured as follows:

```
custom-directive ::= `custom` `<` UserDirective `>` `(` Params `)`
```

`user-directive` is used as a suffix when this directive is used during printing and parsing. When parsing, `parseUserDirective` will be invoked. When printing, `printUserDirective` will be invoked. The first parameter to these methods must be a reference to either the OpAsmParser, or OpAsmPrinter. The type of rest of the parameters is dependent on the `Params` specified in the assembly format.

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

3 years ago[docs] Fix indentation in FileCheck.rst
Arthur Eubanks [Mon, 31 Aug 2020 20:19:21 +0000 (13:19 -0700)]
[docs] Fix indentation in FileCheck.rst

Fixes
C:\src\llvm-project\llvm\docs\CommandGuide\FileCheck.rst:745:Bullet list ends without a blank line; unexpected unindent.

3 years ago[X86][CGP] Add gather test cases for D86371.
Craig Topper [Mon, 31 Aug 2020 19:39:50 +0000 (12:39 -0700)]
[X86][CGP] Add gather test cases for D86371.

3 years ago[IR][GVN] allow intrinsics in Instruction's isCommutative query (2nd try)
Sanjay Patel [Mon, 31 Aug 2020 19:53:01 +0000 (15:53 -0400)]
[IR][GVN] allow intrinsics in Instruction's isCommutative query (2nd try)

The 1st try was reverted because I missed an assert that
needed softening.

As discussed in D86798 / rG09652721 , we were potentially
returning a different result for whether an Instruction
is commutable depending on if we call the base class or
derived class method.

This requires relaxing asserts in GVN, but that pass
seems to be working otherwise.

NewGVN requires more work because it uses different
code paths for numbering binops and calls.

3 years ago[SVE] Remove calls to VectorType::getNumElements from InstCombine
Christopher Tetreault [Mon, 31 Aug 2020 19:17:51 +0000 (12:17 -0700)]
[SVE] Remove calls to VectorType::getNumElements from InstCombine

Reviewed By: efriedma

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

3 years ago[NFC][InstCombine] visitPHINode(): cleanup PHI CSE instruction replacement
Roman Lebedev [Mon, 31 Aug 2020 19:22:33 +0000 (22:22 +0300)]
[NFC][InstCombine] visitPHINode(): cleanup PHI CSE instruction replacement

As @nikic is pointing out in https://reviews.llvm.org/rGbf21ce7b908e#inline-4647
this must be sufficient otherwise `EliminateDuplicatePHINodes()`
would have hit issues with it already.

3 years ago[ORC] Remove a stray semicolon, silencing warnings. NFC.
Martin Storsjö [Mon, 31 Aug 2020 19:25:25 +0000 (22:25 +0300)]
[ORC] Remove a stray semicolon, silencing warnings. NFC.

3 years ago[ARM] Register pressure with -mthumb forces register reload before each call
Prathamesh Kulkarni [Mon, 31 Aug 2020 19:00:30 +0000 (20:00 +0100)]
[ARM] Register pressure with -mthumb forces register reload before each call

This patch implements the foldMemoryOperand hook in Thumb1InstrInfo,
allowing tBLXr and a spilled function address to be combined back into a
tBL. This can help with codesize at Oz, especailly in the tinycrypt
library.

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

3 years ago[LLD] [COFF] Error out if creating a DLL with too many exported symbols
Martin Storsjö [Thu, 27 Aug 2020 11:48:22 +0000 (14:48 +0300)]
[LLD] [COFF] Error out if creating a DLL with too many exported symbols

The PE/DLL format has a limit on 64k exported symbols per DLL; make
sure to check this.

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

3 years ago[X86][CGP] Pre-commit test cases for D86371.
Craig Topper [Mon, 31 Aug 2020 17:17:20 +0000 (10:17 -0700)]
[X86][CGP] Pre-commit test cases for D86371.

3 years ago[analyzer] Add bool operator modeling for unque_ptr
Nithin Vadukkumchery Rajendrakumar [Mon, 31 Aug 2020 17:25:33 +0000 (19:25 +0200)]
[analyzer] Add bool operator modeling for unque_ptr

Summary: Implemented boolean conversion operator for unique_ptr

Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun

Reviewed By: NoQ, xazax.hun

Subscribers: martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D86027

3 years ago[NFC] [DAGCombiner] Refactor bitcast folding within fabs/fneg
Qiu Chaofan [Mon, 31 Aug 2020 16:48:12 +0000 (00:48 +0800)]
[NFC] [DAGCombiner] Refactor bitcast folding within fabs/fneg

fabs and fneg share a common transformation:

(fneg (bitconvert x)) -> (bitconvert (xor x sign))
(fabs (bitconvert x)) -> (bitconvert (and x ~sign))

This patch separate the code into a single method.

Reviewed By: spatel

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

3 years ago[NFC] [DAGCombiner] Remove unnecessary negation in visitFNEG
Qiu Chaofan [Mon, 31 Aug 2020 16:35:01 +0000 (00:35 +0800)]
[NFC] [DAGCombiner] Remove unnecessary negation in visitFNEG

In visitFNEG of DAGCombiner, the folding of (fneg (fsub c, x)) is
redundant since getNegatedExpression already handles it.

3 years ago[llvm-reduce] Create returns with undef values for non-void functions.
Florian Hahn [Mon, 31 Aug 2020 15:33:46 +0000 (16:33 +0100)]
[llvm-reduce] Create returns with undef values for non-void functions.

Currently replaceBranchTerminator/removeUninterestingBBsFromSwitch
always creates `ret void` instructions if no successor is in the chunk.

This results in invalid IR for functions with non-void return types,
which makes those reductions unfeasible. Instead, create `ret ty undef`
for functions with non-void return types.

Reviewed By: lebedev.ri

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

3 years ago[PowerPC][AIX] Add test for returning a vector type. [NFC]
Sean Fertile [Mon, 31 Aug 2020 15:14:17 +0000 (11:14 -0400)]
[PowerPC][AIX] Add test for returning a vector type. [NFC]

Shows error produced when trying to return a vector, which is not
yet supported.

3 years ago[clang-tidy] Buildbot failure fix for commit rGf5fd7486d6c0
Adam Balogh [Mon, 31 Aug 2020 14:29:01 +0000 (16:29 +0200)]
[clang-tidy] Buildbot failure fix for commit rGf5fd7486d6c0

Commit `rGf5fd7486d6c0` caused a buildbot failure because exceptions are
disabled by default on one of the buildbots. This patch forcibly enables
exceptions for the affected test.

3 years ago[CodeGen] Make sure the EH cleanup for block captures is conditional when the block...
Erik Pilkington [Mon, 31 Aug 2020 13:42:34 +0000 (09:42 -0400)]
[CodeGen] Make sure the EH cleanup for block captures is conditional when the block literal is in a conditional context

Previously, clang was crashing on the attached test because the EH cleanup for
the block capture was incorrectly emitted under the assumption that the
expression wasn't conditionally evaluated. This was because before 9a52de00260,
pushLifetimeExtendedDestroy was mainly used with C++ automatic lifetime
extension, where a conditionally evaluated expression wasn't possible. Now that
we're using this path for block captures, we need to handle this case.

rdar://66250047

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

3 years agoTeach the swift calling convention about _Atomic types
Arnold Schwaighofer [Wed, 19 Aug 2020 14:13:16 +0000 (07:13 -0700)]
Teach the swift calling convention about _Atomic types

rdar://67351073

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

3 years ago[gn build] Port f5fd7486d6c
LLVM GN Syncbot [Mon, 31 Aug 2020 14:02:39 +0000 (14:02 +0000)]
[gn build] Port f5fd7486d6c

3 years ago[gn build] Port 14dd0737822
LLVM GN Syncbot [Mon, 31 Aug 2020 14:02:39 +0000 (14:02 +0000)]
[gn build] Port 14dd0737822

3 years ago[Clang-Tidy] New check `bugprone-redundant-branch-condition`
Adam Balogh [Fri, 5 Jun 2020 11:27:09 +0000 (13:27 +0200)]
[Clang-Tidy] New check `bugprone-redundant-branch-condition`

Checking the same condition again in a nested `if` usually make no sense,
except if the value of the expression could have been changed between
the two checks. Although compilers may optimize this out, such code is
suspicious: the programmer may have meant to check something else.
Therefore it is worth to find such places in the code and notify the
user about the problem.

This patch implements a basic check for this problem. Currently it
only detects redundant conditions where the condition is a variable of
integral type. It also detects the possible bug if the variable is in an
//or// or //and// logical expression in the inner if and/or the variable
is in an //and// logical expression in the outer if statement. Negated
cases are not handled yet.

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

3 years ago[clang-tidy] New check readability-prefer-member-initializer
Adam Balogh [Thu, 12 Dec 2019 16:03:16 +0000 (17:03 +0100)]
[clang-tidy] New check readability-prefer-member-initializer

Finds member initializations in the constructor body which can
be placed to the member initializers of the constructor instead.
This does not only improves the readability of the code but also
affects positively its performance. Class-member assignments
inside a control statement or following the first control
statement are ignored.

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

3 years ago[DAGCombiner] skip reciprocal divisor optimization for x/sqrt(x), better
Sanjay Patel [Mon, 31 Aug 2020 13:31:15 +0000 (09:31 -0400)]
[DAGCombiner] skip reciprocal divisor optimization for x/sqrt(x), better

I tried to fix this in:
rG716e35a0cf53
...but that patch depends on the order that we encounter the
magic "x/sqrt(x)" expression in the combiner's worklist.

This patch should improve that by waiting until we walk the
user list to decide if there's a use to skip.

The AArch64 test reveals another (existing) ordering problem
though - we may try to create an estimate for plain sqrt(x)
before we see that it is part of a 1/sqrt(x) expression.

3 years ago[AArch64] add another test for reciprocal sqrt; NFC
Sanjay Patel [Mon, 31 Aug 2020 13:13:33 +0000 (09:13 -0400)]
[AArch64] add another test for reciprocal sqrt; NFC

3 years ago[x86] add another test for reciprocal sqrt; NFC
Sanjay Patel [Mon, 31 Aug 2020 12:42:04 +0000 (08:42 -0400)]
[x86] add another test for reciprocal sqrt; NFC

The change in rG716e35a0cf53 depends on the order that
we encounter the expression x/sqrt(x), so we need to
adjust the logic to be more flexible.

3 years ago[Flang][NFC] Remove license comments from files in docs/ folder.
sameeran joshi [Mon, 31 Aug 2020 12:59:57 +0000 (18:29 +0530)]
[Flang][NFC] Remove license comments from files in docs/ folder.

Solves issue https://reviews.llvm.org/D86131#2247275

Reviewed By: hans

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

3 years ago[analyzer] Add modeling for unique_ptr move constructor
Nithin Vadukkumchery Rajendrakumar [Mon, 31 Aug 2020 09:50:39 +0000 (11:50 +0200)]
[analyzer] Add modeling for unique_ptr move constructor

Summary:
Add support for handling move contructor of std::unique_ptr.

Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun

Reviewed By: NoQ

Subscribers: martong, cfe-commits
Tags: #clang

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

3 years ago[NFCI] Silent a build warning due to an extra semi-colon
Sourabh Singh Tomar [Mon, 31 Aug 2020 12:16:46 +0000 (17:46 +0530)]
[NFCI] Silent a build warning due to an extra semi-colon

3 years ago[lldb] tab completion for class `CommandObjectTypeFormatterDelete`
Gongyu Deng [Mon, 31 Aug 2020 12:15:58 +0000 (14:15 +0200)]
[lldb] tab completion for class `CommandObjectTypeFormatterDelete`

1. Added a dedicated completion to class `CommandObjectTypeFormatterDelete`
   which can be used by these commands: `type filter/format/summary/synthetic delete`;
2. Added a related test case.

Reviewed By: teemperor

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

3 years agoFix sphinx documentation after a6a37a2fcd2a8048a75bd0d8280497ed89d73224
Alexandre Ganea [Mon, 31 Aug 2020 12:05:55 +0000 (08:05 -0400)]
Fix sphinx documentation after a6a37a2fcd2a8048a75bd0d8280497ed89d73224

3 years ago[lldb][NFC] Remove trailing whitespace in TestCompletion
Raphael Isemann [Mon, 31 Aug 2020 10:24:25 +0000 (12:24 +0200)]
[lldb][NFC] Remove trailing whitespace in TestCompletion

3 years ago[lldb] Fix TestCompletion's pid completion failing randomly
Raphael Isemann [Mon, 31 Aug 2020 09:58:26 +0000 (11:58 +0200)]
[lldb] Fix TestCompletion's pid completion failing randomly

TestCompletion is randomly failing on some bots. The error message however states
that the computed completions actually do contain the expected pid we're
looking for, so there shouldn't be any test failure.

The reason for that turns out to be that complete_from_to is actually used
for testing two different features. It can be used for testing what the
common prefix for the list of completions is and *also* for checking all the
possible completions that are returned for a command. Which one of the two
things should be checked can't be defined by a parameter to the function, but
is instead guessed by the test method instead based on the results that were
returned. If there is a common prefix in all completions, then that prefix
is searched and otherwise all completions are searched.

For TestCompletion's pid test this behaviour leads to the strange test failures.
If all the pid's that our test LLDB can see have a common prefix (e.g., it
can only see pids [123, 122, 10004, 10000] -> common prefix '1'), then
complete_from_to check that the common prefix contains our pid, which is
always fails ('1' doesn't contain '123' or any other valid pid). If there
isn't a common prefix (e.g., pids are [123, 122, 10004, 777]) then
complete_from_to will check the list of completions instead which works correctly.

This patch is fixing this by adding a simple check method that doesn't
have this behaviour and is simply searching the returned list of completions.
This should get the bots green while I'm working on a proper fix that fixes
complete_from_to.

3 years ago[llvm-readobj/elf] - Don't fail when dumping an archive with a member that can't...
Georgii Rymar [Fri, 28 Aug 2020 10:33:20 +0000 (13:33 +0300)]
[llvm-readobj/elf] - Don't fail when dumping an archive with a member that can't be recognized.

Imagine we have an archive that has 3 objects in the following order:
<valid known object>,<unknown object> and <valid known object>.

Currently llvm-readelf/obj report an error and stops dumping in the middle.
This patch changes the error reported to warning.

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

3 years agoRevert "[FileCheck] Move FileCheck implementation out of LLVMSupport into its own...
Raphael Isemann [Mon, 31 Aug 2020 09:14:09 +0000 (11:14 +0200)]
Revert "[FileCheck] Move FileCheck implementation out of LLVMSupport into its own library"

This reverts commit e9a3d1a401b07cbf7b11695637f1b549782a26cd. Seems the new
FileCheck library doesn't link on some bots. Reverting for now.

3 years ago[FileCheck] Move FileCheck implementation out of LLVMSupport into its own library
Raphael Isemann [Mon, 31 Aug 2020 09:14:09 +0000 (11:14 +0200)]
[FileCheck] Move FileCheck implementation out of LLVMSupport into its own library

The actual FileCheck logic seems to be implemented in LLVMSupport. I don't see a
good reason for having FileCheck implemented there as it has a very specific use
while LLVMSupport is a dependency of pretty much every LLVM tool there is. In
fact, the only use of FileCheck I could find (outside the FileCheck tool and the
FileCheck unit test) is a single call in GISelMITest.h.

This moves the FileCheck logic to its own LLVMFileCheck library. This way only
FileCheck and the GlobalISelTests now have a dependency on this code.

Reviewed By: jhenderson

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

3 years ago[lldb] Don't crash when LLDB can't extract the tsan report
Raphael Isemann [Mon, 31 Aug 2020 09:12:32 +0000 (11:12 +0200)]
[lldb] Don't crash when LLDB can't extract the tsan report

Right now all tsan tests are crashing on Linux. The tests were already marked as
expected failures, but since commit 20ce8affce85d added an assert that every
StopInfo needs a non-empty stop description the tests actually started crash
(which is even with an expectedFailure a failed test).

The reason for that is that we never had any stop description when hitting tsan
errors on Linux. Before the assert that just made the test fail, but now the
empty description is hitting the assert. This patch just adds a generic stop
description mentioning tsan to prevent that we hit that assert on platforms
where we don't support extracting the tsan report.

Reviewed By: friss

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

3 years ago[Test] Simplify DWARF test cases. NFC.
Xing GUO [Mon, 31 Aug 2020 06:03:02 +0000 (14:03 +0800)]
[Test] Simplify DWARF test cases. NFC.

The Length, AbbrOffset and Values fields of the debug_info section are
optional. This patch helps remove them and simplify test cases.

Reviewed By: MaskRay

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

3 years ago[Sink] Optimize/simplify sink candidate finding with nearest common dominator
Fangrui Song [Mon, 31 Aug 2020 05:51:00 +0000 (22:51 -0700)]
[Sink] Optimize/simplify sink candidate finding with nearest common dominator

For an instruction in the basic block BB, SinkingPass enumerates basic blocks
dominated by BB and BB's successors. For each enumerated basic block,
SinkingPass uses `AllUsesDominatedByBlock` to check whether the basic
block dominates all of the instruction's users. This is inefficient.

Use the nearest common dominator of all users to avoid enumerating the
candidate. The nearest common dominator may be in a parent loop which is
not beneficial. In that case, find the ancestors in the dominator tree.

In the case that the instruction has no user, with this change we will
not perform unnecessary move. This causes some amdgpu test changes.

A stage-2 x86-64 clang is a byte identical with this change.

3 years ago[Sink][test] Add nounwind test and properly test convergent
Fangrui Song [Mon, 31 Aug 2020 01:26:15 +0000 (18:26 -0700)]
[Sink][test] Add nounwind test and properly test convergent

3 years ago[InstCombine] add extra-use tests for fmul+sqrt; NFC
Venkataramanan Kumar [Sun, 30 Aug 2020 22:39:05 +0000 (18:39 -0400)]
[InstCombine] add extra-use tests for fmul+sqrt; NFC

3 years ago[GVN] add another commutable intrinsic test; NFC
Sanjay Patel [Sun, 30 Aug 2020 22:36:28 +0000 (18:36 -0400)]
[GVN] add another commutable intrinsic test; NFC

This is a reduced version of a test-suite crasher with rG25597f7

3 years agoRevert "[IR][GVN] allow intrinsics in Instruction's isCommutative query"
Sanjay Patel [Sun, 30 Aug 2020 21:02:01 +0000 (17:02 -0400)]
Revert "[IR][GVN] allow intrinsics in Instruction's isCommutative query"

This reverts commit 25597f7783e7038b8a2ee88bb49ac605b211b564.
It is causing crashing on bots such as:
http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/10523/steps/ninja-build/logs/stdio

3 years ago[DSE,MemorySSA] Skip defs without analyzable write locations.
Florian Hahn [Sun, 30 Aug 2020 20:53:31 +0000 (21:53 +0100)]
[DSE,MemorySSA] Skip defs without analyzable write locations.

Similar to other checks above, if there is no write location for a def,
it cannot be considered for elimination and can be skipped.