platform/upstream/llvm.git
4 years ago[Sema] Let getters assert that trailing return type exists, NFCI
Aaron Puchert [Wed, 28 Oct 2020 22:29:41 +0000 (23:29 +0100)]
[Sema] Let getters assert that trailing return type exists, NFCI

This was requested in the review of D90129.

4 years agoBetter source location for -Wignored-qualifiers on trailing return types
Aaron Puchert [Wed, 28 Oct 2020 22:23:09 +0000 (23:23 +0100)]
Better source location for -Wignored-qualifiers on trailing return types

We collect the source location of a trailing return type in the parser,
improving the location for regular functions and providing a location
for lambdas, where previously there was none.

Fixes PR47732.

Reviewed By: aaron.ballman

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

4 years ago[llvm-install-name-tool] Quote passed rpath args in error messages
Keith Smiley [Wed, 28 Oct 2020 21:56:03 +0000 (14:56 -0700)]
[llvm-install-name-tool] Quote passed rpath args in error messages

This diff refactors error reporting to make it more clear
what arguments were passed to llvm-install-name-tool.

Test plan: make check-all

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

4 years agoC API: support scalable vectors
Craig Disselkoen [Wed, 28 Oct 2020 20:48:22 +0000 (16:48 -0400)]
C API: support scalable vectors

This adds support for scalable vector types in the C API and in
llvm-c-test, and also adds a test to ensure that llvm-c-test can properly
roundtrip operations involving scalable vectors.

While creating this diff, I discovered that the C API cannot properly roundtrip
_constant expressions_ involving shufflevector / scalable vectors, but that
seems to be a separate enough issue that I plan to address it in a future diff
(unless reviewers feel it should be addressed here).

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

4 years ago[GWP-ASan] Abstract the thread local variables access
Kostya Kortchinsky [Mon, 26 Oct 2020 21:54:22 +0000 (14:54 -0700)]
[GWP-ASan] Abstract the thread local variables access

In a similar fashion to D87420 for Scudo, this CL introduces a way to
get thread local variables via a platform-specific reserved TLS slot,
since Fuchsia doesn't support ELF TLS from the libc itself.

If needing to use this, a platform will have to define
`GWP_ASAN_HAS_PLATFORM_TLS_SLOT` and provide `gwp_asan_platform_tls_slot.h`
which will define a `uint64_t *getPlatformGwpAsanTlsSlot()` function
that will return the TLS word of storage.

I snuck in a couple of cleanup items as well, moving some static
functions to anonymous namespace for consistency.

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

4 years ago[AMDGPU] Allow some modifiers on VOP3B instructions
Jay Foad [Tue, 27 Oct 2020 12:29:11 +0000 (12:29 +0000)]
[AMDGPU] Allow some modifiers on VOP3B instructions

V_DIV_SCALE_F32/F64 are VOP3B encoded so they can't use the ABS src
modifier, but they can still use NEG and the usual output modifiers.

This partially reverts 3b99f12a4e6f "AMDGPU: Remove modifiers from v_div_scale_*".

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

4 years ago[InstCombine] Do not introduce bitcasts for swifterror arguments.
Florian Hahn [Wed, 28 Oct 2020 21:49:33 +0000 (21:49 +0000)]
[InstCombine] Do not introduce bitcasts for swifterror arguments.

The following constraints hold for swifterror values:

    A swifterror value (either the parameter or the alloca) can only
    be loaded and stored from, or used as a swifterror argument.

This patch updates instcombine to not try to convert a bitcast of a
function into a bitcast of a swifterror argument.

Reviewed By: rjmccall

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

4 years ago[AMDGPU] Fix double space in disassembly of SDWA instructions with vcc
Jay Foad [Wed, 28 Oct 2020 16:00:59 +0000 (16:00 +0000)]
[AMDGPU] Fix double space in disassembly of SDWA instructions with vcc

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

4 years ago[TableGen] Treat reg as isolated in reg$foo (but not in ${foo}reg)
Jay Foad [Wed, 28 Oct 2020 16:12:21 +0000 (16:12 +0000)]
[TableGen] Treat reg as isolated in reg$foo (but not in ${foo}reg)

D9844 fixed a problem where the ss suffix in the AsmString "cmp${cc}ss"
was recognised as the X86 SS register, by only recognising a token as a
register name if it is "isolated", i.e. surrounded by separator
characters.

In the AMDGPU backend there are many operands like $clamp which expand
to an optional string " clamp" including the preceding space, so we want
to have AsmStrings including sequences like "vcc$clamp" where vcc is a
register name.

This patch relaxes the rules for an isolated token, to say that it's OK
if the token is immediately followed by a '$'.

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

4 years ago[AArch64] Improve lowering of insert_vector_elt with 0.0 consts.
Florian Hahn [Wed, 28 Oct 2020 21:20:52 +0000 (21:20 +0000)]
[AArch64] Improve lowering of insert_vector_elt with 0.0 consts.

When moving +0.0 into a float vector, we can use to vi*gpr variants of
INS.

Reviewed By: efriedma

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

4 years ago[AMDGPU] Fix inserting combined s_nop in bundles
Austin Kerbow [Wed, 28 Oct 2020 19:22:23 +0000 (12:22 -0700)]
[AMDGPU] Fix inserting combined s_nop in bundles

Reviewed By: rampitec

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

4 years ago[Deref] Use maximum trip count instead of exact trip count
Philip Reames [Wed, 28 Oct 2020 21:29:03 +0000 (14:29 -0700)]
[Deref] Use maximum trip count instead of exact trip count

When trying to prove that a memory access touches only dereferenceable memory across all iterations of a loop, use the maximum exit count rather than an exact one.  In many cases we can't prove exact exit counts whereas we can prove an upper bound.

The test included is for a single exit loop with a min(C,V) exit count, but the true motivation is support for multiple exits loops.  It's just really hard to write a test case for multiple exits because the vectorizer (the primary user of this API), bails far before this.  For multiple exits, this allows a mix of analyzeable and unanalyzable exits when only analyzeable exits are needed to prove deref.

4 years agoPR48002: Fix injection of elaborated-type-specifiers within local
Richard Smith [Wed, 28 Oct 2020 21:27:38 +0000 (14:27 -0700)]
PR48002: Fix injection of elaborated-type-specifiers within local
classes into the enclosing block scope.

We weren't properly detecting whether the name would be injected into a
block scope in the case where it was lexically declared in a local
class.

4 years ago[mlir] Properly handle recursive bufferization for scf.for/scf.if
Sean Silva [Mon, 26 Oct 2020 23:46:54 +0000 (16:46 -0700)]
[mlir] Properly handle recursive bufferization for scf.for/scf.if

This fixes a subtle issue, described in the comment starting with
"Clone the op without the regions and inline the regions from the old op",
which prevented this conversion from working on non-trivial examples.

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

4 years ago[libc++] Re-apply the switch-based std::variant implementation
Michael Park [Mon, 26 Oct 2020 16:34:22 +0000 (12:34 -0400)]
[libc++] Re-apply the switch-based std::variant implementation

This commit is a mass re-application of the following commits:

  7d15ece79c16dc3237fc514ff56a69e3d58fbd39
  e0ec7a02064968c7df11713689107148b4efb993
  02197f7e50b938f8167b17b89bdf7c55feff4339
  a175a96517c5d9dc05ba13a6481b1b031a53a22f

Those were temporarily reverted in 057028ed391f8, and never re-applied.
Re-committed by @ldionne (author edited for credit).

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

4 years ago[llvm-lit] Improve the error message when make_paths_relative() fails
Louis Dionne [Thu, 22 Oct 2020 20:34:19 +0000 (16:34 -0400)]
[llvm-lit] Improve the error message when make_paths_relative() fails

Previously, if make_paths_relative() failed due to some reason, it would
happily keep going and set the ${out_pathlist} to the standard output
of the command, which would be the empty string if the command failed.

This can lead to issues that are difficult to diagnose, since the calling
code will usually try to keep going with a variable that was set to the
empty string.

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

4 years ago[gn build] Port 23ed570af1c
LLVM GN Syncbot [Wed, 28 Oct 2020 20:46:36 +0000 (20:46 +0000)]
[gn build] Port 23ed570af1c

4 years ago[mlir] Use OpBuilderDAG for MemRefReinterpretCastOp.
Alexander Belyaev [Wed, 28 Oct 2020 20:40:17 +0000 (21:40 +0100)]
[mlir] Use OpBuilderDAG for MemRefReinterpretCastOp.

4 years agoSplit out llvm/Support/FileSystem/UniqueID.h and clang/Basic/FileEntry.h, NFC
Duncan P. N. Exon Smith [Fri, 16 Oct 2020 20:37:14 +0000 (16:37 -0400)]
Split out llvm/Support/FileSystem/UniqueID.h and clang/Basic/FileEntry.h, NFC

Split `FileEntry` and `FileEntryRef` out into a new file
`clang/Basic/FileEntry.h`. This allows current users of a
forward-declared `FileEntry` to transition to `FileEntryRef` without
adding more includers of `FileManager.h`.

Also split `UniqueID` out to llvm/Support/FileSystem/UniqueID.h, so
`FileEntry.h` doesn't need to include all of `FileSystem.h` for just
that type.

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

4 years ago[MemLoc] Adjust memccpy support in MemoryLocation::getForArgument
Dávid Bolvanský [Wed, 28 Oct 2020 20:23:13 +0000 (21:23 +0100)]
[MemLoc]  Adjust memccpy support in MemoryLocation::getForArgument

Use LocationSize::upperBound instead of precise since we only know an upper bound on the number of bytes read/written.

Reviewed By: fhahn

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

4 years ago[mlir] Convert memref_reshape to memref_reinterpret_cast.
Alexander Belyaev [Wed, 28 Oct 2020 20:08:58 +0000 (21:08 +0100)]
[mlir] Convert memref_reshape to memref_reinterpret_cast.

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

4 years ago[DebugInfo] Expose Fortran array debug info attributes through DIBuilder.
Adrian Prantl [Wed, 28 Oct 2020 19:26:44 +0000 (12:26 -0700)]
[DebugInfo] Expose Fortran array debug info attributes through DIBuilder.

The support of a few debug info attributes specifically for Fortran
arrays have been added to LLVM recently, but there's no way to take
advantage of them through DIBuilder. This patch extends
DIBuilder::createArrayType to enable the settings of those attributes.

Patch by Chih-Ping Chen!

Differential Review: https://reviews.llvm.org/D90323

4 years ago[DebugInfo] Support for DW_TAG_generic_subrange
Alok Kumar Sharma [Wed, 28 Oct 2020 14:24:39 +0000 (19:54 +0530)]
[DebugInfo] Support for DW_TAG_generic_subrange

This is needed to support fortran assumed rank arrays which
have runtime rank.

  Summary:
Fortran assumed rank arrays have dynamic rank. DWARF TAG
DW_TAG_generic_subrange is needed to support that.

  Testing:
unit test cases added (hand-written)
check llvm
check debug-info

Reviewed By: aprantl

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

4 years ago[test] Make bt_order_by_weight in switch.ll more robust
Arthur Eubanks [Tue, 27 Oct 2020 22:47:59 +0000 (15:47 -0700)]
[test] Make bt_order_by_weight in switch.ll more robust

    Branch weights are not represented internally linearly with the value in
    the IR. In its current state the test happened to pass, but the branch
    weights for 0,3,6 and 2,5,8,9 were not actually equal.

    $ opt -passes='print<branch-prob>'

    shows that the sum of the branch probabilities going to bb0 and bb2 were not the same.

    Printing analysis results of BPI for function 'bt_order_by_weight':
    ---- Branch Probabilities ----
      edge entry -> bb0 probability is 0x00000003 / 0x80000000 = 0.00%
      edge entry -> bb2 probability is 0x00000004 / 0x80000000 = 0.00%

    with this change:

    Printing analysis results of BPI for function 'bt_order_by_weight':
    ---- Branch Probabilities ----
      edge entry -> bb0 probability is 0x00000004 / 0x80000000 = 0.00%
      edge entry -> bb2 probability is 0x00000004 / 0x80000000 = 0.00%

Reviewed By: hans

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

4 years ago[Clang][OpenMP] Added the support for target data nowait
Shilei Tian [Wed, 28 Oct 2020 19:53:20 +0000 (15:53 -0400)]
[Clang][OpenMP] Added the support for target data nowait

Previously we added support for target nowait, but target data nowait
has not been supported yet. In this patch, target data nowait will also be
wrapped into a task.

Reviewed By: jdoerfert

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

4 years ago[AArch64] Use DUP for BUILD_VECTOR with few different elements.
Florian Hahn [Wed, 28 Oct 2020 19:48:20 +0000 (19:48 +0000)]
[AArch64] Use DUP for BUILD_VECTOR with few different elements.

If most elements of BUILD_VECTOR are the same, with a few different
elements, it is better to use DUP  for the common elements and
INSERT_VECTOR_ELT for the different elements.

Currently this transform is guarded quite restrictively to only trigger
in clearly beneficial cases.

With D90176, the lowering for patterns originating from code like
` float32x4_t y = {a,a,a,0};` (common in 3D apps) are lowered even
better (unnecessary fmov is removed).

Reviewed By: efriedma

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

4 years ago[libc++] Fix a few warnings
YAMAMOTO Takashi [Wed, 28 Oct 2020 19:40:16 +0000 (15:40 -0400)]
[libc++] Fix a few warnings

Found during a NuttX porting effort.
But these changes are not directly relevant to NuttX.

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

4 years ago[NFC][ThinLTO] Change command line passing to EmbedBitcodeInModule
Mircea Trofin [Wed, 28 Oct 2020 19:08:26 +0000 (12:08 -0700)]
[NFC][ThinLTO] Change command line passing to EmbedBitcodeInModule

Changing to pass by ref - less null checks to worry about.

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

4 years ago[GISel]: Few InsertVecElt combines
Aditya Nandakumar [Wed, 28 Oct 2020 19:13:35 +0000 (12:13 -0700)]
[GISel]: Few InsertVecElt combines

https://reviews.llvm.org/D88060

This adds the following combines
1) build_vector formation from insert_vec_elts
2) insert_vec_elts (build_vector) -> build_vector

4 years ago[libc++] Refactor tests to remove uses of std::rand()
Louis Dionne [Wed, 28 Oct 2020 19:04:39 +0000 (15:04 -0400)]
[libc++] Refactor tests to remove uses of std::rand()

This allows running these tests on systems that do not support std::rand().

4 years ago[clangd] Go-to-definition from non-renaming alias is unambiguous.
Sam McCall [Mon, 12 Oct 2020 14:07:15 +0000 (16:07 +0200)]
[clangd] Go-to-definition from non-renaming alias is unambiguous.

It's not helpful to show the alias itself as an option.
This fixes a regression accepted in f24649b77d856157c64841457dcc4f70530d607c.

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

4 years ago[NFC] Use Register in RegisterPressure APIs
Mircea Trofin [Tue, 27 Oct 2020 21:30:18 +0000 (14:30 -0700)]
[NFC] Use Register in RegisterPressure APIs

Some related changes as well.

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

4 years ago[openmp][openacc] Check for duplicate clauses for directive
Valentin Clement [Wed, 28 Oct 2020 19:11:47 +0000 (15:11 -0400)]
[openmp][openacc] Check for duplicate clauses for directive

Check for duplicate clauses associated with directive. Clauses can appear only once
in the 4 lists associated with each directive (allowedClauses, allowedOnceClauses,
allowedExclusiveClauses, requiredClauses). Duplicates were already present (removed with this
patch) or were introduce in new patches by mistake (D89861).

Reviewed By: kiranchandramohan

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

4 years ago[SLP][Test] Precommit test case for PR47629. NFC.
Anton Afanasyev [Wed, 28 Oct 2020 19:07:43 +0000 (22:07 +0300)]
[SLP][Test] Precommit test case for PR47629. NFC.

4 years ago[lldb] Delete lldb/utils/test
Vedant Kumar [Wed, 28 Oct 2020 18:50:52 +0000 (11:50 -0700)]
[lldb] Delete lldb/utils/test

These utilities aren't useful any more -- delete them as a cleanup.

Discussion:
http://lists.llvm.org/pipermail/lldb-dev/2020-October/016536.html

4 years ago[DebugInfo] Shorten legacy [s|z]ext dwarf expressions
Vedant Kumar [Wed, 21 Oct 2020 16:22:13 +0000 (09:22 -0700)]
[DebugInfo] Shorten legacy [s|z]ext dwarf expressions

Take advantage of the emitConstu helper to emit slightly shorter dwarf
expressions to implement legacy [s|z]ext operations.

4 years ago[DebugInfo] Fix legacy ZExt emission when FromBits >= 64 (PR47927)
Vedant Kumar [Wed, 21 Oct 2020 00:08:07 +0000 (17:08 -0700)]
[DebugInfo] Fix legacy ZExt emission when FromBits >= 64 (PR47927)

Fix an out-of-bounds shift in emitLegacyZExt by using a slightly more
complicated dwarf expression to create the zext mask.

This addresses a UBSan diagnostic seen when compiling compiler-rt
(llvm.org/PR47927).

rdar://70307714

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

4 years ago[mlir] NFC: fix trivial typos
Kazuaki Ishizaki [Wed, 28 Oct 2020 19:03:15 +0000 (04:03 +0900)]
[mlir] NFC: fix trivial typos
fix typos in comments and documents

Reviewed By: jpienaar

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

4 years ago[NFC][TSAN] Logs to debug test script on bot
Vitaly Buka [Wed, 28 Oct 2020 18:39:01 +0000 (11:39 -0700)]
[NFC][TSAN] Logs to debug test script on bot

4 years ago[CostModel][x86] remove cost-kind predicate for intrinsic costs
Sanjay Patel [Wed, 28 Oct 2020 18:31:13 +0000 (14:31 -0400)]
[CostModel][x86] remove cost-kind predicate for intrinsic costs

We model cost as number of instructions / uops, so it does not
make sense to treat size/blended costs any differently than
throughput.

4 years ago[clang][ToolChains] explicitly return LangOptions::StackProtectorMode
Nick Desaulniers [Wed, 28 Oct 2020 18:13:14 +0000 (11:13 -0700)]
[clang][ToolChains] explicitly return LangOptions::StackProtectorMode

Make the virtual method Toolchain::GetDefaultStackProtectorLevel()
return an explict enum value rather than an integral constant. This
makes the code subjectively easier to read, and should help prevent bugs
that may (or may never) arise from changing the enum values. Previously,
these were just kept in sync via a comment, which is brittle. The trade
off is including a additional header in a few new places. It is not
necessary, but in my opinion helps the readability.

Split off from https://reviews.llvm.org/D90194 to help cut down on lines
changed in code review.

Reviewed By: phosek

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

4 years ago[Clang][PowerPC] Add __vector_pair and __vector_quad types
Baptiste Saleil [Wed, 28 Oct 2020 18:14:48 +0000 (13:14 -0500)]
[Clang][PowerPC] Add __vector_pair and __vector_quad types

Define the __vector_pair and __vector_quad types that are used to manipulate
the new accumulator registers introduced by MMA on PowerPC. Because these two
types are specific to PowerPC, they are defined in a separate new file so it
will be easier to add other PowerPC specific types if we need to in the future.

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

4 years ago[CostModel] remove cost-kind predicate for funnel shift costs
Sanjay Patel [Wed, 28 Oct 2020 17:23:22 +0000 (13:23 -0400)]
[CostModel] remove cost-kind predicate for funnel shift costs

Completing the series of FIXME removals for special-case intrinsics:
50dfa19cc799
f2c25c70791d
c963bde0152a
01ea93d85d6e

This one looks quite different than the others. The size/blended
cost is still potentially very far off from the throughput cost,
but this is hopefully not worse on the whole. It looks like the
underlying costs for the expanded shift/logic have their own
cost-kind limitations. Also, we are not asking the target if
it has a legal funnel shift op, so we just assume that the
intrinsic gets expanded.

4 years ago[clangd] Don't offer to expand auto in structured binding declarations.
Sam McCall [Mon, 19 Oct 2020 14:29:04 +0000 (16:29 +0200)]
[clangd] Don't offer to expand auto in structured binding declarations.

auto must be used for the code to parse.

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

4 years agoAdd a `mlirModuleGetBody()` accessor to the C API and bind it in Python
Mehdi Amini [Wed, 28 Oct 2020 05:57:17 +0000 (05:57 +0000)]
Add a `mlirModuleGetBody()` accessor to the C API and bind it in Python

Getting the body of a Module is a common need which justifies a
dedicated accessor instead of forcing users to go through the
region->blocks->front unwrapping manually.

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

4 years ago[llvm-mc] Drop unneeded dependency on CodeGen
Fangrui Song [Wed, 28 Oct 2020 17:52:58 +0000 (10:52 -0700)]
[llvm-mc] Drop unneeded dependency on CodeGen

Spot by Craig Topper.

4 years ago[AVR][clang] Pass the address of the data section to the linker for ATmega328
Dylan McKay [Wed, 28 Oct 2020 16:44:01 +0000 (05:44 +1300)]
[AVR][clang] Pass the address of the data section to the linker for ATmega328

This patch modifies the Clang AVR toolchain so that it always passes
the '-Tdata=0x800100' to the linker for ATmega328 devices. This matches
AVR-GCC behaviour, and also corresponds to the address of the start of
the data section in data space according to the ATmega328 datasheet.

Without this, clang does not produce a valid ATmega328 binary.

When targeting all non-ATmega328 chips, a warning will be emitted due to
the fact that proper handling for the chips data section address is
not yet implemented.

I've held off adding other microcontrollers for now, mostly because the
AVR toolchain logic is smeared across LLVM core TableGen files, and two Clang
libraries. The 'family detection' logic is also only implemented for
ATmega328 at the moment, for similar reasons.

In the future, I aim to write an RFC to llvm-dev to find a better way
for LLVM to expose target-specific details such as these to compiler
frontends.

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

4 years ago[debuginfo-tests][dexter] add requires lldb to two tests
Tom Weaver [Wed, 28 Oct 2020 17:33:29 +0000 (17:33 +0000)]
[debuginfo-tests][dexter] add requires lldb to two tests

both deferred_globals.cpp namespace.cpp require lldb in order to run and will
fail if it's not available.

add the required lines to the top of the tests.

4 years ago[clangd] Fix a null dereference in tests.
Kadir Cetinkaya [Wed, 28 Oct 2020 16:32:29 +0000 (17:32 +0100)]
[clangd] Fix a null dereference in tests.

4 years ago[WebAssembly] Fix incorrectly named target builtin
Thomas Lively [Wed, 28 Oct 2020 17:22:43 +0000 (10:22 -0700)]
[WebAssembly] Fix incorrectly named target builtin

Rename __builtin_wasm_q15mulr_saturate_s_i8x16 to
__builtin_wasm_q15mulr_saturate_s_i16x8, fixing the implied lane interpretation
of the result.

4 years ago[AMDGPU] Use -strict-whitespace for GFX8 and GFX9 disassembler tests
Jay Foad [Wed, 28 Oct 2020 17:15:02 +0000 (17:15 +0000)]
[AMDGPU] Use -strict-whitespace for GFX8 and GFX9 disassembler tests

4 years ago[WebAssembly] Clang-format builtins generation (NFC)
Heejin Ahn [Wed, 28 Oct 2020 10:34:31 +0000 (03:34 -0700)]
[WebAssembly] Clang-format builtins generation (NFC)

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

4 years ago[WebAssembly] Prototype extending multiplication SIMD instructions
Thomas Lively [Wed, 28 Oct 2020 16:38:59 +0000 (09:38 -0700)]
[WebAssembly] Prototype extending multiplication SIMD instructions

As proposed in https://github.com/WebAssembly/simd/pull/376. This commit
implements new builtin functions and intrinsics for these instructions, but does
not yet add them to wasm_simd128.h because they have not yet been merged to the
proposal. These are the first instructions with opcodes greater than 0xff, so
this commit updates the MC layer and disassembler to handle that correctly.

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

4 years ago[TableGen] [AMDGPU] Add !sub operator for subtraction
Paul C. Anagnostopoulos [Fri, 23 Oct 2020 21:02:39 +0000 (17:02 -0400)]
[TableGen] [AMDGPU] Add !sub operator for subtraction

Use it in the AMDGPU target to eliminate !add(value1, !mul(value2, -1))

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

4 years agoRegAlloc: Clear isSSA
Matt Arsenault [Fri, 23 Oct 2020 19:45:43 +0000 (15:45 -0400)]
RegAlloc: Clear isSSA

The MIR parser may infer SSA, so -run-pass=regallocgreedy would hit a
verifier error after multiple vreg defs are added.

4 years ago[AMDGPU] Precommit tests for D89388 and D89399, NFC
Sebastian Neubauer [Wed, 28 Oct 2020 15:50:40 +0000 (16:50 +0100)]
[AMDGPU] Precommit tests for D89388 and D89399, NFC

4 years ago[ELF] -r: don't crash when a non-SHF_LINK_ORDER orphan is added before a SHF_LINK_ORD...
Fangrui Song [Tue, 27 Oct 2020 16:30:10 +0000 (09:30 -0700)]
[ELF] -r: don't crash when a non-SHF_LINK_ORDER orphan is added before a SHF_LINK_ORDER orphan

Fixes https://github.com/ClangBuiltLinux/linux/issues/1186

If a non-SHF_LINK_ORDER orphan is added first, `firstIsec->flags & SHF_LINK_ORDER`
will be zero and we currently assert when calling `getLinkOrderDep`.

Reviewed By: grimar

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

4 years ago[X86] Fix cpu name typos
Simon Pilgrim [Wed, 28 Oct 2020 15:50:32 +0000 (15:50 +0000)]
[X86] Fix cpu name typos

As discussed on PR26418 rGea84dc9500df incorrectly set the knl cpuname to tremont (and missed out the tremont cpuname entirely).

4 years ago[clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations
Nathan James [Wed, 28 Oct 2020 15:49:50 +0000 (15:49 +0000)]
[clang-tidy][NFC] IdentifierNaming: Remove unnecessary string allocations

Remove the need to heap allocate a string for each style option lookup while reading or writing options.p

Reviewed By: aaron.ballman

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

4 years agoFix Wdocumentation unknown parameter warnings. NFCI.
Simon Pilgrim [Wed, 28 Oct 2020 15:46:49 +0000 (15:46 +0000)]
Fix Wdocumentation unknown parameter warnings. NFCI.

This seems to due to a bad merge by rG156e8b37024a

4 years ago[compiler-rt][SystemZ] Skip fuzzer/full-coverage.test
Ulrich Weigand [Wed, 28 Oct 2020 13:19:36 +0000 (14:19 +0100)]
[compiler-rt][SystemZ] Skip fuzzer/full-coverage.test

This test is currently marked as XFAIL on s390x, but it is randomly
passing, causing build bot issues.  Setting as UNSUPPORTED for now.

4 years ago[Syntax] Add missing default constructor for ConstChildIterator
Simon Pilgrim [Wed, 28 Oct 2020 15:38:18 +0000 (15:38 +0000)]
[Syntax] Add missing default constructor for ConstChildIterator

MSVC was complaining as it couldn't see the Base::ChildIteratorBase default constructor.

4 years ago[AArch64] Extend vector insertion test cases.
Florian Hahn [Wed, 28 Oct 2020 14:54:12 +0000 (14:54 +0000)]
[AArch64] Extend vector insertion test cases.

Also re-generate the check lines using update_llc_test_checks.py.

4 years ago[AMDGPU] Use -strict-whitespace for GFX10 disassembler tests
Jay Foad [Wed, 28 Oct 2020 14:51:47 +0000 (14:51 +0000)]
[AMDGPU] Use -strict-whitespace for GFX10 disassembler tests

This is in preparation for fixing some spurious double spaces in the
disassembly.

4 years ago[NFC][IntrRefLDV] Improve the Value printing
Djordje Todorovic [Wed, 28 Oct 2020 14:18:14 +0000 (07:18 -0700)]
[NFC][IntrRefLDV] Improve the Value printing

Basically, this just improves the dump of the Value stored within a location.

If the defining instruction number is zero, it means it is "live-in".

Before the patch:

ESI --> bb 0 inst 0 loc ESI
After:

ESI --> Value{bb: 0, inst: live-in, loc: ESI}
This is an NFC.

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

4 years ago[libomptarget][nvptx] Undef, weak shared variables
JonChesterfield [Wed, 28 Oct 2020 14:22:27 +0000 (14:22 +0000)]
[libomptarget][nvptx] Undef, weak shared variables

[libomptarget][nvptx] Undef, weak shared variables

Shared variables on nvptx, and LDS on amdgcn, are uninitialized at
the start of kernel execution. Therefore create the variables with
undef instead of zeros, motivated in part by the amdgcn back end
rejecting LDS+initializer.

Common is zero initialized, which seems incompatible with shared. Thus
change them to weak, following the direction of
https://reviews.llvm.org/rG7b3eabdcd215

Reviewed By: jdoerfert

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

4 years ago[debuginfo-tests][dexter] Add two new debug experience tests
Nabeel Omer [Wed, 28 Oct 2020 14:21:40 +0000 (14:21 +0000)]
[debuginfo-tests][dexter] Add two new debug experience tests

deferred_globals.cpp: Verify that debug information for a local variable does
not hide a global definition that has the same name

namespace.cpp: Ensure that the debug information for a global variable
includes namespace information.

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

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

4 years ago[yamls2obj][test] - Make the Archives/regular.yaml test stricter.
Georgii Rymar [Wed, 28 Oct 2020 14:04:08 +0000 (17:04 +0300)]
[yamls2obj][test] - Make the Archives/regular.yaml test stricter.

In rG6d656c9691d4 I had to relax the check from

`CONTENT: 21 3c 61 72 63 68 3e 0a 12{{$}}`

to

`CONTENT: 21 3c 61 72 63 68 3e 0a 12`

to fix the FreeBSD bot quickly: http://lab.llvm.org:8011/#/builders/28/builds/547

It turns out that "od" prints a trailing white space on FreeBSD, that is
why EOL mark ({{$}}) can't be used. But we still want to check the output size.

This patch adds a check of output size with "wc -c", similar to how it is done
below in the same test. This restores the original strictness.

4 years ago[libc++] Move the #error message for no localization to <locale.h>
Louis Dionne [Wed, 28 Oct 2020 13:26:56 +0000 (09:26 -0400)]
[libc++] Move the #error message for no localization to <locale.h>

<locale.h> is lower level than <__locale>, so that's where we want the
error to live for systems that don't provide localization support.

4 years ago[libc++] Remove <clocale> from some system_error tests
Louis Dionne [Wed, 28 Oct 2020 13:24:51 +0000 (09:24 -0400)]
[libc++] Remove <clocale> from some system_error tests

The explicit call to `std::setlocale(LC_ALL, "C")` isn't required, since
the Standard already says the equivalent of this call is performed on
program startup.

4 years ago[obj2yaml][test] - Replace llvm-ar with yaml2obj in Archives/regular.yaml to fix BB.
Georgii Rymar [Wed, 28 Oct 2020 13:42:38 +0000 (16:42 +0300)]
[obj2yaml][test] - Replace llvm-ar with yaml2obj in Archives/regular.yaml to fix BB.

Seems that llvm-ar has a different behavior on MAC and BB fails: http://45.33.8.238/mac/22696/log.txt

This replaces llvm-ar with yaml2obj.

4 years ago[TableGen] Command description file requires a hyphen in document title.
Paul C. Anagnostopoulos [Wed, 28 Oct 2020 13:30:10 +0000 (09:30 -0400)]
[TableGen] Command description file requires a hyphen in document title.

4 years ago[yaml2obj][test] - Try to fix Archives/regular.yaml to fix BB.
Georgii Rymar [Wed, 28 Oct 2020 13:17:46 +0000 (16:17 +0300)]
[yaml2obj][test] - Try to fix Archives/regular.yaml to fix BB.

It was added in D89949.

FreeBSD bot fails: http://lab.llvm.org:8011/#/builders/28/builds/547

4 years ago[gn build] Port 23c8da25ef7
LLVM GN Syncbot [Wed, 28 Oct 2020 13:16:58 +0000 (13:16 +0000)]
[gn build] Port 23c8da25ef7

4 years agoMLIR: add SinOp Lowering to __nv_sinf and __nv_sin
Qingyi Liu [Wed, 28 Oct 2020 13:06:45 +0000 (14:06 +0100)]
MLIR: add SinOp Lowering to __nv_sinf and __nv_sin

Added lowering rule from `SinOp` to `__nv_sinf` and `__nv_sin`

Reviewed By: ftynse

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

4 years ago[llvm-reduce] Add reduction for aliases.
Florian Hahn [Wed, 28 Oct 2020 13:06:42 +0000 (13:06 +0000)]
[llvm-reduce] Add reduction for aliases.

This patch adds a new reduction pass that tries to remove aliases.
It runs early, as most of those likely can be removed up-front in
practice.

This substantially improves llvm-reduce for IR generated by the swift
compiler, which can generate a lot of aliases which lead to lots of
invalid reductions.

Reviewed By: lebedev.ri

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

4 years ago[TableGen] Update xxx-tblgen command document.
Paul C. Anagnostopoulos [Sat, 24 Oct 2020 15:08:22 +0000 (11:08 -0400)]
[TableGen] Update xxx-tblgen command document.

Add a few cross-references among TableGen documents.

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

Add cross-references between TableGen documents.

4 years ago[openmp] Use front() instead of *begin() to not hide bugs when CurTypes is empty.
Benjamin Kramer [Wed, 28 Oct 2020 12:55:43 +0000 (13:55 +0100)]
[openmp] Use front() instead of *begin() to not hide bugs when CurTypes is empty.

4 years agoRevert "[OpenMP] Add Passing in Original Declaration Names To Mapper API"
Benjamin Kramer [Wed, 28 Oct 2020 12:54:00 +0000 (13:54 +0100)]
Revert "[OpenMP] Add Passing in Original Declaration Names To Mapper API"

This reverts commit d981c7b7581efc3ef378709042100e75da0185a0 and
a87d7b3d448a16e416d1980b9d6aea99e4c9900b. Test fails under msan.

4 years ago[llvm-objdump] - Restore Inputs/libbogus11.a input to fix BB.
Georgii Rymar [Wed, 28 Oct 2020 12:56:34 +0000 (15:56 +0300)]
[llvm-objdump] - Restore Inputs/libbogus11.a input to fix BB.

The libbogus11.a archive was removed by D90013.
But it is used by another test: llvm-objdump\MachO\disassemble-g-dsym.test

BB failture:
http://lab.llvm.org:8011/#/builders/109/builds/1450

4 years ago[AMDGPU] Omit needless string concatenations. NFC.
Jay Foad [Wed, 28 Oct 2020 12:56:42 +0000 (12:56 +0000)]
[AMDGPU] Omit needless string concatenations. NFC.

4 years ago[llvm-objdump] - Rewrite malformed-archives.test to use YAML descriptions.
Georgii Rymar [Fri, 23 Oct 2020 06:38:20 +0000 (09:38 +0300)]
[llvm-objdump] - Rewrite malformed-archives.test to use YAML descriptions.

Currently the test uses 14 precompiled binaries. With the functionality
implemented in D89949, it is possible to remove them and use YAMLs instead.

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

4 years ago[gn build] Port 47369e194a4
LLVM GN Syncbot [Wed, 28 Oct 2020 12:31:40 +0000 (12:31 +0000)]
[gn build] Port 47369e194a4

4 years ago[mlir] NFC: small fixes to LinalgTilingOptions API
Lei Zhang [Wed, 28 Oct 2020 12:28:51 +0000 (08:28 -0400)]
[mlir] NFC: small fixes to LinalgTilingOptions API

This commit changes to use plain values instead of references.
We need to copy it anyway. References forbid using temporary
values generated from expressions.

Reviewed By: nicolasvasilache

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

4 years ago[yaml2obj][obj2yaml] - Teach tools to work with regular archives.
Georgii Rymar [Tue, 20 Oct 2020 12:12:28 +0000 (15:12 +0300)]
[yaml2obj][obj2yaml] - Teach tools to work with regular archives.

This teaches obj2yaml to dump valid regular (not thin) archives.
This also teaches yaml2obj to recognize archives YAML descriptions,
what allows to craft all different kinds of archives (valid and broken ones).

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

4 years ago[DAG] Move canFoldInAddressingMode before foldBinOpIntoSelect. NFC.
Simon Pilgrim [Wed, 28 Oct 2020 12:02:50 +0000 (12:02 +0000)]
[DAG] Move canFoldInAddressingMode before foldBinOpIntoSelect. NFC.

Reduces the diff in D90113.

4 years ago[X86] Regenerate bool-vector tests. NFCI.
Simon Pilgrim [Wed, 28 Oct 2020 11:38:15 +0000 (11:38 +0000)]
[X86] Regenerate bool-vector tests. NFCI.

Merge prefixes where possible, use 'X86' instead of 'X32' (which we try to only use for gnux32 triple tests).

4 years ago[llvm-reduce] Extend test to also use special globals.
Florian Hahn [Wed, 28 Oct 2020 12:03:46 +0000 (12:03 +0000)]
[llvm-reduce] Extend test to also use special globals.

4 years ago[x86 testing] NFC: remove a few needless vector popcnt tests
David Zarzycki [Wed, 28 Oct 2020 11:44:54 +0000 (07:44 -0400)]
[x86 testing] NFC: remove a few needless vector popcnt tests

The removed tests are handled by optimization passes before code gen and
therefore are just a distraction when making code gen changes that may
(as a side effect) reimplement earlier optimization work as a side effect.

Specifically, the following tests where removed:

ult_0_v* -> false
ult_1_v* -> x == 0
ugt_0_v* -> x != 0

ult_{size-of-element-plus-one}_v* -> true
ugt_{size-of-element}_v*          -> false

ult_{size-of-element}_v*           -> x != mask
ugt_{size-of-element-minus-one}_v* -> x == mask

4 years agoReturn "[IndVars] Remove monotonic checks with unknown exit count"
Max Kazantsev [Wed, 28 Oct 2020 10:37:20 +0000 (17:37 +0700)]
Return "[IndVars] Remove monotonic checks with unknown exit count"

This reverts commit e038b60d9169733367393f733058f0ff23c28d3f.
This reverts commit a0d84d80315d0c725b5efcd889928bad1171ba56.

This revert was a mistake. The reason of the failures was
"Use uint64_t for branch weights instead of uint32_t"

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

4 years ago[Syntax] Add iterators over children of syntax trees.
Sam McCall [Fri, 23 Oct 2020 10:23:29 +0000 (12:23 +0200)]
[Syntax] Add iterators over children of syntax trees.

This gives us slightly nicer syntax (foreach) for idioms currently expressed
as a loop, and the option to use range algorithms where it makes sense
(e.g. llvm::all_of et al encapsulate the needed flow control in a useful way).

It's also a building block for iteration over filtered views (e.g. iterate over
all Stmt children, with the right type):
for (const Statement &S : filter<Statement>(N.children()))
  ...

I realize the recent direction has been mostly towards strongly-typed
node-specific facilities, but I think it's important we have convenient
generic facilities too.

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

4 years ago[yaml2obj] - Support the "Offset" key for the .dynsym section.
Georgii Rymar [Tue, 27 Oct 2020 11:38:02 +0000 (14:38 +0300)]
[yaml2obj] - Support the "Offset" key for the .dynsym section.

Our "implicit" sections are handled separately from regular ones.
It turns out that the "Offset" key is not handled properly for them.

Perhaps we can generalize handling in one place, but before doing that I'd like
to add support and test cases for each implicit section.
(I need this particular single change to unblock another patch that is already on review,
and I guess doing it independently for each section will be cleaner, see below).

In this patch I've removed `explicit-dynsym-no-dynstr.yaml` to `dynsym-section.yaml`
and added the new test into. In a follow-up we probably might want
to merge 2 another existent `dynsymtab-*.yaml` tests into it too.

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

4 years ago[DSE] Use walker to skip noalias stores between current & clobber def.
Florian Hahn [Wed, 28 Oct 2020 11:01:25 +0000 (11:01 +0000)]
[DSE] Use walker to skip noalias stores between current & clobber def.

Instead of getting the defining access we should be able to use
getClobberingMemoryAccess to skip non-aliasing MemoryDefs. No additional
checks should be needed, because we only remove the starting def if it
matches the defining access of the load. All we need to worry about is
that there are no (may)alias stores between the starting def and the
load and getClobberingMemoryAccess should guarantee that.

Partly fixes PR47887.

This improves the number of redundant stores removed in some cases
(numbers below for MultiSource, SPEC2000, SPEC2006 on X86 with -flto
-O3).

Same hash: 226 (filtered out)
Remaining: 11
Metric: dse.NumRedundantStores

Program                                        base   patch1 diff
 test-suite...:: External/Povray/povray.test     1.00   5.00 400.0%
 test-suite...chmarks/MallocBench/gs/gs.test     1.00   3.00 200.0%
 test-suite...0/253.perlbmk/253.perlbmk.test    21.00  37.00 76.2%
 test-suite...0.perlbench/400.perlbench.test    24.00  37.00 54.2%
 test-suite.../Applications/SPASS/SPASS.test     3.00   4.00 33.3%
 test-suite...006/453.povray/453.povray.test    15.00  18.00 20.0%
 test-suite...T2006/445.gobmk/445.gobmk.test    27.00  29.00  7.4%
 test-suite.../CINT2006/403.gcc/403.gcc.test   136.00 137.00  0.7%
 test-suite.../CINT2000/176.gcc/176.gcc.test     6.00   6.00  0.0%
 test-suite.../Benchmarks/Bullet/bullet.test    NaN     3.00  nan%
 test-suite.../Benchmarks/Ptrdist/bc/bc.test    NaN     1.00  nan%

Reviewed By: asbirlea

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

4 years ago[VE] Add vector merger operation instructions
Kazushi (Jam) Marukawa [Wed, 28 Oct 2020 03:51:48 +0000 (12:51 +0900)]
[VE] Add vector merger operation instructions

Add VMRG/VSHF/VCP/VEX isntructions.  Add regression tests too.
Also add new patterns to parse new UImm4 oeprand.

Reviewed By: simoll

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

4 years ago[testing] Add missing REQUIRES: asserts
David Zarzycki [Wed, 28 Oct 2020 10:14:54 +0000 (06:14 -0400)]
[testing] Add missing REQUIRES: asserts

4 years ago[VE] Add vector iterative operation instructions
Kazushi (Jam) Marukawa [Tue, 27 Oct 2020 17:40:04 +0000 (02:40 +0900)]
[VE] Add vector iterative operation instructions

Add VFIA/VFIS/VFIM/VFIAM/VFISM/VFIMA/VFIMS isntructions.
Add regression tests too.

Reviewed By: simoll

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

4 years ago[llvm-exegesis][doc] Remove old FIXME.
Clement Courbet [Wed, 28 Oct 2020 09:51:50 +0000 (10:51 +0100)]
[llvm-exegesis][doc] Remove old FIXME.

This was fixed in a previous commit, the previous line in the
documentation explains how to proceed.

4 years ago[VE][NFC] Fix typo in comment
Kazushi (Jam) Marukawa [Mon, 26 Oct 2020 09:03:43 +0000 (18:03 +0900)]
[VE][NFC] Fix typo in comment

4 years ago[VE] Specify to expand BRIND and BR_JT
Kazushi (Jam) Marukawa [Sat, 24 Oct 2020 13:00:15 +0000 (22:00 +0900)]
[VE] Specify to expand BRIND and BR_JT

BRIND and BR_JT are not implmented yet, so expand them atm.
Add regression tests too.

Reviewed By: simoll

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

4 years ago[llvm-exegesis] Do not silently fail on unknown instruction encoding formats.
Clement Courbet [Wed, 28 Oct 2020 08:26:29 +0000 (09:26 +0100)]
[llvm-exegesis] Do not silently fail on unknown instruction encoding formats.

The addition of TILELOADD instructions with a new encoding format
triggered a hard abort instead of proper error reporting due to the use
of `llvm_unreachable` for actually reachable code.
Properly report an error when the encoding format is unknown.

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