platform/upstream/llvm.git
4 years ago[ELF][test] Improve MEMORY tests
Fangrui Song [Fri, 6 Mar 2020 20:53:24 +0000 (12:53 -0800)]
[ELF][test] Improve MEMORY tests

4 years agoCorrect the Bjarne Stroustrup's C++ Page link
Shivam Gupta [Fri, 6 Mar 2020 21:52:22 +0000 (16:52 -0500)]
Correct the Bjarne Stroustrup's C++ Page link

Summary: Bjarne Stroustrup's C++ Page link pointing to wrong AT&T page.

Reviewers: jyknight, sanjoy, silvas, hubert.reinterpretcast

Reviewed By: hubert.reinterpretcast

Subscribers: hubert.reinterpretcast, llvm-commits

Tags: #llvm

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

4 years ago[clang][Headers] Use __has_builtin instead of _MSC_VER.
Michael Spencer [Fri, 6 Mar 2020 01:56:13 +0000 (17:56 -0800)]
[clang][Headers] Use __has_builtin instead of _MSC_VER.

arm_acle.h relied on `_MSC_VER` to determine if a given function was
already defined as a builtin. This was incorrect because
`-fms-extensions` enables these builtins, but is not responsible for
defining `_MSC_VER` on any target. The next closest thing is
`_MSC_EXTENSIONS`, which is only defined on Windows targets, but even
this is suboptimal. What this conditional is actually trying to
determine is if the given functions are defined as builtins, so just
check that directly.

I also attempted to do this for `__nop`, but in that case intrin.h,
which is only includable if `_MSC_VER` is defined, has its own
definition. So in that case `_MSC_VER` is correct.

Differential Revision: https://reviews.llvm.org/D75719
rdar://60102353

4 years ago[gold][test] Fix tests after D75713 and D74749
Fangrui Song [Fri, 6 Mar 2020 21:35:39 +0000 (13:35 -0800)]
[gold][test] Fix tests after D75713 and D74749

4 years agoAvoid emitting unreachable SP adjustments after `throw`
Reid Kleckner [Thu, 5 Mar 2020 23:37:21 +0000 (15:37 -0800)]
Avoid emitting unreachable SP adjustments after `throw`

In 172eee9c, we tried to avoid these by modelling the callee as
internally resetting the stack pointer.

However, for the majority of functions with reserved stack frames, this
would lead LLVM to emit extra SP adjustments to undo the callee's
internal adjustment. This lead us to fix the problem further on down the
pipeline in eliminateCallFramePseudoInstr. In 5b79e603d3b7a2994, I added
use a heuristic to try to detect when the adjustment would be
unreachable.

This heuristic is imperfect, and when exception handling is involved, it
fails to fire. The new test is an example of this. Simply throwing an
exception with an active cleanup emits dead SP adjustments after the
throw. Not only are they dead, but if they were executed, they would be
incorrect, so they are confusing.

This change essentially reverts 172eee9c and makes the 5b79e603d3b7a2994
heuristic responsible for preventing unreachable stack adjustments. This
means we may emit unreachable stack adjustments for functions using EH
with unreserved call frames, but that is not very many these days. Back
in 2016 when this change was added, we were focused on 32-bit, which we
observed to have fewer reserved frames.

Fixes PR45064

Reviewed By: hans

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

4 years ago[RS4GC] Handle uses of extractelement for conversion from vector to scalar base
Anna Thomas [Fri, 6 Mar 2020 16:07:11 +0000 (11:07 -0500)]
[RS4GC] Handle uses of extractelement for conversion from vector to scalar base

As mentioned in the comments, extractelement is special
since we actually want a scalar base for that element we extracted from
the vector (i.e. not a vector base).
This same logic should apply to uses of the extractelement such as phis
and selects which have the same BDV as the extractelement.
Howeber, for these uses we conservatively mark the BDV state as
conflict, since setting the EE's new base BDV does not always dominate
these uses.

Added testcase showcases the problem where the BDV identification chokes
on the incorrect cast from vector to scalar for the phi use of
extractelement.

Tests-Run: make check, internal fuzzer testing

Reviewers: reames, skatkov, dantrushin
Reviewed-By: dantrushin
Differential Revision: https://reviews.llvm.org/D75704

4 years agoSplit findUnwindSectionsByPhdr into target-specific functions.
Sterling Augustine [Thu, 5 Mar 2020 19:50:51 +0000 (11:50 -0800)]
Split findUnwindSectionsByPhdr into target-specific functions.

Summary:
This further cleans up the control flow and makes it easier to
optimize and replace portions in a subsequent patch.

This should be NFC, but given the amount of #ifdeffing here,
it may not be. So will watch the buildbots closely.

Also, as this is purely moving existing code around, I plan to
ignore the lint errors.

Reviewers: compnerd, miyuki, mstorsjo

Subscribers: libcxx-commits

Tags: #libc

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

4 years ago[lld][test] Make tests pass when the test directory matches `bar`
Benjamin Barenblat [Fri, 6 Mar 2020 21:20:48 +0000 (13:20 -0800)]
[lld][test] Make tests pass when the test directory matches `bar`

Reviewed By: jhenderson, MaskRay

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

4 years ago[MLIR] Fixes for BUILD_SHARED_LIBS=on
Stephen Neuendorffer [Thu, 27 Feb 2020 22:53:12 +0000 (14:53 -0800)]
[MLIR] Fixes for BUILD_SHARED_LIBS=on

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

4 years ago[MLIR] Add support for libMLIR.so
Valentin Churavy [Sun, 9 Feb 2020 03:27:54 +0000 (19:27 -0800)]
[MLIR] Add support for libMLIR.so

Putting this up mainly for discussion on
how this should be done. I am interested in MLIR from
the Julia side and we currently have a strong preference
to dynamically linking against the LLVM shared library,
and would like to have a MLIR shared library.

This patch adds a new cmake function add_mlir_library()
which accumulates a list of targets to be compiled into
libMLIR.so.  Note that not all libraries make sense to
be compiled into libMLIR.so.  In particular, we want
to avoid libraries which primarily exist to support
certain tools (such as mlir-opt and mlir-cpu-runner).

Note that the resulting libMLIR.so depends on LLVM, but
does not contain any LLVM components.  As a result, it
is necessary to link with libLLVM.so to avoid linkage
errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on

FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
because mlir-tblgen is linked against libLLVM.so and
and independent LLVM components.

Previous version of this patch broke depencies on TableGen
targets.  This appears to be because it compiled all
libraries to OBJECT libraries (probably because cmake
is generating different target names).  Avoiding object
libraries results in correct dependencies.

(updated by Stephen Neuendorffer)

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

4 years ago[MLIR] Move from add_dependencies() to DEPENDS
Stephen Neuendorffer [Thu, 20 Feb 2020 18:48:51 +0000 (10:48 -0800)]
[MLIR] Move from add_dependencies() to DEPENDS

add_llvm_library and add_llvm_executable may need to create new targets with
appropriate dependencies.  As a result, it is not sufficient in some
configurations (namely LLVM_BUILD_LLVM_DYLIB=on) to only call
add_dependencies().  Instead, the explicit TableGen dependencies must
be passed to add_llvm_library() or add_llvm_executable() using the DEPENDS
keyword.

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

4 years agoPR45124: Don't leave behind pending cleanups when declaring implicit
Richard Smith [Fri, 6 Mar 2020 21:22:10 +0000 (13:22 -0800)]
PR45124: Don't leave behind pending cleanups when declaring implicit
deduction guides.

Previously if an implicit deduction guide had a default argument with a
cleanup, we'd leave the 'pending cleanup' flag set after declaring the
implicit guide. But it turns out that there's no reason to even
substitute into the default argument when declaring an implicit
deduction guide: we only need to record that the default argument
exists, not what it is, since we never actually form a call to a
deduction guide.

4 years agoReapply "clang: Treat ieee mode as the default for denormal-fp-math"
Matt Arsenault [Thu, 5 Mar 2020 14:13:09 +0000 (09:13 -0500)]
Reapply "clang: Treat ieee mode as the default for denormal-fp-math"

This reverts commit 737394c490444e968a6f640b99a6614567ca7f28.

The fp-model test was failing on platforms that enable denormal flushing
based on -ffast-math. This needs to reset to IEEE, not the default in
these cases.

Change-Id: Ibbad32f66d0d0b89b9c1173a3a96fb1a570ddd89

4 years agoFix test broken by simulator triple changes.
Adrian Prantl [Fri, 6 Mar 2020 19:13:04 +0000 (11:13 -0800)]
Fix test broken by simulator triple changes.

4 years ago[lldb] Remove some #ifdef LLDB_CONFIGURATION_DEBUG around asserts
Raphael Isemann [Fri, 6 Mar 2020 19:19:06 +0000 (11:19 -0800)]
[lldb] Remove some #ifdef LLDB_CONFIGURATION_DEBUG around asserts

Summary:
Otherwise this code won't run on the Release+Asserts builds we have on the CI.

Fixes rdar://problem/59867885 (partly)

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Update the current execution context at the beginning of tab completions
Gongyu Deng [Fri, 6 Mar 2020 18:10:24 +0000 (10:10 -0800)]
[lldb] Update the current execution context at the beginning of tab completions

Summary: Fix a bug that tab completions won't synchronous the current execution context. ( Thanks for Jim's explanation! )

Reviewers: teemperor, labath, jingham

Reviewed By: jingham

Subscribers: jingham, labath

Tags: #lldb

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

4 years ago[InstComine] Forego of one-use check in `(X - (X & Y)) --> (X & ~Y)` if Y is...
Roman Lebedev [Fri, 6 Mar 2020 18:39:07 +0000 (21:39 +0300)]
[InstComine] Forego of one-use check in `(X - (X & Y))   -->   (X & ~Y)` if Y is a constant

Summary:
This is potentially more friendly for further optimizations,
analysies, e.g.: https://godbolt.org/z/G24anE

This resolves phase-ordering bug that was introduced
in D75145 for https://godbolt.org/z/2gBwF2
https://godbolt.org/z/XvgSua

Reviewers: spatel, nikic, dmgreen, xbolva00

Reviewed By: nikic, xbolva00

Subscribers: hiraditya, zzheng, llvm-commits

Tags: #llvm

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

4 years agoLLD already has a mechanism for caching creation of DWARCContext:
Alexey Lapshin [Thu, 27 Feb 2020 17:38:42 +0000 (20:38 +0300)]
LLD already has a mechanism for caching creation of DWARCContext:

llvm::call_once(initDwarfLine, [this]() { initializeDwarf(); });

Though it is not used in all places.

I need that patch for implementing "Remove obsolete debug info" feature
(D74169). But this caching mechanism is useful by itself, and I think it
would be good to use it without connection to "Remove obsolete debug info"
feature. So this patch changes inplace creation of DWARFContext with
its cached version.

Depends on D74308

Reviewed By: ruiu

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

4 years agoCorrectly identify iOS simulator processes in debugserver.
Adrian Prantl [Thu, 5 Mar 2020 17:51:40 +0000 (09:51 -0800)]
Correctly identify iOS simulator processes in debugserver.

Starting with iOS 13 simulator binaries are identified with an
explicit platform in the new LC_BUILD_VERSION load command.

On older deployment targets using the LC_VERSION_MIN load commands,
this patch detects when an ios process runs on a macOS host and
updates the target triple with the "simulator" environment
accordingly.

(Patch re-applied with bugfix this time).

This is part of https://bugs.swift.org/browse/SR-11971

rdar://problem/58438125

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

4 years agoRevert "Correctly identify iOS simulator processes in debugserver."
Adrian Prantl [Fri, 6 Mar 2020 17:52:20 +0000 (09:52 -0800)]
Revert "Correctly identify iOS simulator processes in debugserver."

This reverts commit 59d816d88464e93a89e0d9c80c8855ab1f453541.

It broke TestGDBRemoteClient.

4 years ago[X86] Cleanup patterns and ins for VCVTNEPS2BF16.
Craig Topper [Fri, 6 Mar 2020 18:07:15 +0000 (10:07 -0800)]
[X86] Cleanup patterns and ins for VCVTNEPS2BF16.

There was a noop bitconvert in the load pattern. While there
also make all the sources refer to src_v.RC even though its the
same as _.RC, but its consistent.

4 years ago[MLIR] Remove redundant library dependencies
Stephen Neuendorffer [Thu, 20 Feb 2020 06:56:38 +0000 (22:56 -0800)]
[MLIR] Remove redundant library dependencies

In cmake, it is redundant to have a target list under target_link_libraries()
and add_dependency().  This patch removes the redundant dependency from
add_dependency().

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

4 years agoIncrease default timeout in lldbutil.expect_state_changes()
Adrian Prantl [Fri, 6 Mar 2020 17:59:45 +0000 (09:59 -0800)]
Increase default timeout in lldbutil.expect_state_changes()

4 years agoCorrectly identify iOS simulator processes in debugserver.
Adrian Prantl [Thu, 5 Mar 2020 17:51:40 +0000 (09:51 -0800)]
Correctly identify iOS simulator processes in debugserver.

Starting with iOS 13 simulator binaries are identified with an
explicit platform in the new LC_BUILD_VERSION load command.

On older deployment targets using the LC_VERSION_MIN load commands,
this patch detects when an ios process runs on a macOS host and
updates the target triple with the "simulator" environment
accordingly.

(Patch re-applied without modifications, the bot failure was unrelated).

This is part of https://bugs.swift.org/browse/SR-11971

rdar://problem/58438125

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

4 years agoRevert "Correctly identify iOS simulator processes in debugserver."
Adrian Prantl [Fri, 6 Mar 2020 17:52:20 +0000 (09:52 -0800)]
Revert "Correctly identify iOS simulator processes in debugserver."

This reverts commit 59d816d88464e93a89e0d9c80c8855ab1f453541.

It broke TestGDBRemoteClient.

4 years agoCorrectly identify iOS simulator processes in debugserver.
Adrian Prantl [Thu, 5 Mar 2020 17:51:40 +0000 (09:51 -0800)]
Correctly identify iOS simulator processes in debugserver.

Starting with iOS 13 simulator binaries are identified with an
explicit platform in the new LC_BUILD_VERSION load command.

On older deployment targets using the LC_VERSION_MIN load commands,
this patch detects when an ios process runs on a macOS host and
updates the target triple with the "simulator" environment
accordingly.

This is part of https://bugs.swift.org/browse/SR-11971

rdar://problem/58438125

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

4 years ago[Concepts] Add null check for TemplateTypeParmType::getDecl() in GetContainedInvented...
Saar Raz [Fri, 6 Mar 2020 16:45:12 +0000 (18:45 +0200)]
[Concepts] Add null check for TemplateTypeParmType::getDecl() in GetContainedInventedTypeParmVisitor

GetContainedInventedTypeParmVisitor would not account for the case where TemplateTypeParmType::getDecl() is
nullptr, causing bug #45102.

Add the nullptr check.

4 years ago[X86] Add CMOV to i686 BMI/TBM tests
Simon Pilgrim [Fri, 6 Mar 2020 17:26:20 +0000 (17:26 +0000)]
[X86] Add CMOV to i686 BMI/TBM tests

As mentioned on D75748, there is no such target that has BMI/TBM support but not the much older CMOV.

4 years ago[Hexagon] Fix fshl/fshr -> combine() bug identified in D75114
Simon Pilgrim [Fri, 6 Mar 2020 17:22:55 +0000 (17:22 +0000)]
[Hexagon] Fix fshl/fshr -> combine() bug identified in D75114

4 years ago[Hexagon] Add fshl/fshr -> combine() tests identified in D75114
Simon Pilgrim [Fri, 6 Mar 2020 17:14:28 +0000 (17:14 +0000)]
[Hexagon] Add fshl/fshr -> combine() tests identified in D75114

Added tests showing that the fshl/fshr -> combine() is working the wrong way around

4 years ago[MLIR] Ensure that target_link_libraries() always has a keyword.
Stephen Neuendorffer [Thu, 5 Mar 2020 19:49:42 +0000 (11:49 -0800)]
[MLIR] Ensure that target_link_libraries() always has a keyword.

CMake allows calling target_link_libraries() without a keyword,
but this usage is not preferred when also called with a keyword,
and has surprising behavior.  This patch explicitly specifies a
keyword when using target_link_libraries().

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

4 years agoFix incorrect logic in maintaining the side-effect of compiler generated outliner...
Jin Lin [Thu, 5 Mar 2020 21:54:58 +0000 (13:54 -0800)]
Fix incorrect logic in maintaining the side-effect of compiler generated outliner functions

Summary: Fix incorrect logic in maintaining the side-effect of compiler generated outliner functions by adding the up-exposed uses.

Reviewers: paquette, tellenbach

Reviewed By: paquette

Subscribers: aemerson, lebedev.ri, hiraditya, llvm-commits, jinlin

Tags: #llvm

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

4 years ago[OPENMP50]Add 'depobj' modifier in 'depend' clauses.
Alexey Bataev [Fri, 6 Mar 2020 16:09:55 +0000 (11:09 -0500)]
[OPENMP50]Add 'depobj' modifier in 'depend' clauses.

Added basic support (parsing/sema/serialization) for depobj dependency
kind in depend clauses.

4 years ago[AMDGPU][ConstantFolding] Fold llvm.amdgcn.cube* intrinsics
Jay Foad [Wed, 26 Feb 2020 16:19:41 +0000 (16:19 +0000)]
[AMDGPU][ConstantFolding] Fold llvm.amdgcn.cube* intrinsics

Summary:
This folds the following family of intrinsics:
llvm.amdgcn.cubeid (face id)
llvm.amdgcn.cubema (major axis)
llvm.amdgcn.cubesc (S coordinate)
llvm.amdgcn.cubetc (T coordinate)

Reviewers: nhaehnle, arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[APFloat] Make use of new overloaded comparison operators. NFC.
Jay Foad [Fri, 6 Mar 2020 15:22:11 +0000 (15:22 +0000)]
[APFloat] Make use of new overloaded comparison operators. NFC.

Reviewers: ekatz, spatel, jfb, tlively, craig.topper, RKSimon, nikic, scanon

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, dexonsmith, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[APFloat] Overload comparison operators
Jay Foad [Thu, 27 Feb 2020 09:57:16 +0000 (09:57 +0000)]
[APFloat] Overload comparison operators

Summary:
These implement the usual IEEE-style floating point comparison
semantics, e.g. +0.0 == -0.0 and all operators except != return false
if either argument is NaN.

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, dexonsmith, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[NFC][InstCombine] Add 'x - (x & y)' tests with multi-use 'and'
Roman Lebedev [Fri, 6 Mar 2020 16:40:13 +0000 (19:40 +0300)]
[NFC][InstCombine] Add 'x - (x & y)' tests with multi-use 'and'

If %y is constant, we could still perform the fold

4 years ago[MC] Allowing the use of $-prefixed integer as asm identifiers
Lucas Prates [Mon, 10 Feb 2020 16:48:25 +0000 (16:48 +0000)]
[MC] Allowing the use of $-prefixed integer as asm identifiers

Summary:
Dollar signed prefixed integers were not allowed by the AsmParser to be
used as Identifiers, differing from the GNU assembler behavior.

This patch updates the parsing of Identifiers to consider such cases as
valid, where the identifier string includes the $ prefix itself. As the
Lexer currently splits these occurrences into separate tokens, those
need to be combined by the AsmParser itself.

Reviewers: efriedma, chill

Reviewed By: efriedma

Subscribers: sdardis, hiraditya, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

4 years ago[ARM] Fix dropped dollar sign from symbols in branch targets
Lucas Prates [Tue, 21 Jan 2020 16:36:32 +0000 (16:36 +0000)]
[ARM] Fix dropped dollar sign from symbols in branch targets

Summary:
ARMAsmParser was incorrectly dropping a leading dollar sign character
from symbol names in targets of branch instructions. This was caused by
an incorrect assumption that the contents following the dollar sign
token should be handled as a constant immediate, similarly to the #
token.

This patch avoids the operand parsing from consuming the dollar sign
token when it is followed by an identifier, making sure it is properly
parsed as part of the expression.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: danielkiss, chill, carwil, vhscampos, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang-format] Extend AllowShortLoopsOnASingleLine to do ... while loops.
Mitchell Balan [Fri, 6 Mar 2020 16:13:23 +0000 (11:13 -0500)]
[clang-format] Extend AllowShortLoopsOnASingleLine to do ... while loops.
Summary:
If AllowShortLoopsOnASingleLine is enabled,

  do
    a++;
  while (true);

becomes

  do a++;
  while (true);

Reviewers: MyDeveloperDay, mitchell-stellar

Reviewed by: mitchell-stellar

Contributed by: DaanDeMeyer

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[DebugInfo] Print the actual value of an unknown section identifier.
Igor Kudrin [Thu, 5 Mar 2020 09:43:56 +0000 (16:43 +0700)]
[DebugInfo] Print the actual value of an unknown section identifier.

This is a follow-up for D75609. As @dblaikie suggested, it prints
the actual number for an unknown section identifier when dumping
unit index sections.

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

4 years ago[Hexagon] Recognize undefined registers in expandPostRAPseudo
Krzysztof Parzyszek [Fri, 6 Mar 2020 13:54:12 +0000 (07:54 -0600)]
[Hexagon] Recognize undefined registers in expandPostRAPseudo

4 years ago[AIX] Handle LinkOnceODRLinkage and AppendingLinkage for static init gloabl arrays
Xiangling Liao [Wed, 26 Feb 2020 21:48:23 +0000 (16:48 -0500)]
[AIX] Handle LinkOnceODRLinkage and AppendingLinkage for static init gloabl arrays

Handle LinkOnceODRLinkage;
Handle AppendingLinkage type for llvm.global_ctors/dtors static init global arrays;

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

4 years agoarcher: Remove superfluous dot from warning message
Jonas Hahnfeld [Fri, 6 Mar 2020 14:18:38 +0000 (15:18 +0100)]
archer: Remove superfluous dot from warning message

4 years ago[Sema] Reword -Wrange-loop-analysis warning messages
Aaron Puchert [Fri, 6 Mar 2020 13:56:47 +0000 (14:56 +0100)]
[Sema] Reword -Wrange-loop-analysis warning messages

Summary:
The messages for two of the warnings are misleading:
* warn_for_range_const_reference_copy suggests that the initialization
  of the loop variable results in a copy. But that's not always true,
  we just know that some conversion happens, potentially invoking a
  constructor or conversion operator. The constructor might copy, as in
  the example that lead to this message [1], but it might also not.
  However, the constructed object is bound to a reference, which is
  potentially misleading, so we rewrite the message to emphasize that.
  We also make sure that we print the reference type into the warning
  message to clarify that this warning only appears when operator*
  returns a reference.
* warn_for_range_variable_always_copy suggests that a reference type
  loop variable initialized from a temporary "is always a copy". But
  we don't know this, the range might just return temporary objects
  which aren't copies of anything. (Assuming RVO a copy constructor
  might never have been called.)

The message for warn_for_range_copy is a bit repetitive: the type of a
VarDecl and its initialization Expr are the same up to cv-qualifiers,
because Sema will insert implicit casts or constructor calls to make
them match.

[1] https://bugs.llvm.org/show_bug.cgi?id=32823

Reviewers: aaron.ballman, Mordante, rtrieu

Reviewed By: aaron.ballman

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

4 years agoExtract common code to deal with multidimensional vectors.
Adrian Kuegel [Fri, 6 Mar 2020 12:04:37 +0000 (13:04 +0100)]
Extract common code to deal with multidimensional vectors.

Summary: Also replace dyn_cast_or_null with dyn_cast when possible.

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

4 years ago[OpenCL] Align vload and vstore builtins
Sven van Haastregt [Fri, 6 Mar 2020 12:45:28 +0000 (12:45 +0000)]
[OpenCL] Align vload and vstore builtins

Various vload and vstore builtins were missing or misdefined in the
TableGen description.  Align the OpenCL vload* and vstore* builtins of
the `-fdeclare-opencl-builtins` option to those of `opencl-c.h`.

Reviewed-by: Stuart Brady <stuart.brady@arm.com>
4 years ago[clangd][VSCode] Force VSCode to use the ranking provided by clangd.
Sam McCall [Fri, 6 Mar 2020 12:34:14 +0000 (13:34 +0100)]
[clangd][VSCode] Force VSCode to use the ranking provided by clangd.

Summary:
Clangd's approach is to provide lots of completions, and let ranking sort them
out. This relies on various important signals (Quality.h), without which the
large completion lists are extremely spammy.

Even with a completion result exactly at the cursor, vscode looks backwards and
tries to match the presumed partial-identifier against filterText, and uses
the result to rank, with sortText only used as a tiebreak.
By prepending the partial-identifier to the filterText, we can force the match
to be perfect and so give sortText full control of the ranking.

Full sad story: https://github.com/microsoft/language-server-protocol/issues/898

It's possible to do this on the server side too of course, and switch it on
with an initialization option. But it's a little easier in the extension, it
will get the fix to users of old clangd versions, and other editors

Reviewers: hokein

Reviewed By: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[BFI] Use CallbackVH to notify BFI about deletion of basic blocks
Daniil Suchkov [Thu, 5 Mar 2020 14:14:26 +0000 (21:14 +0700)]
[BFI] Use CallbackVH to notify BFI about deletion of basic blocks

With AssertingVHs instead of bare pointers in
BlockFrequencyInfoImpl::Nodes (but without CallbackVHs) ~1/36 of all
tests ran by make check fail. It means that there are users of BFI that
delete basic blocks while keeping BFI. Some of those transformations add
new basic blocks, so if a new basic block happens to be allocated at
address where an already deleted block was and we don't explicitly set
block frequency for that new block, BFI will report some non-default
frequency for the block even though frequency for the block was never
set. Inliner is an example of a transformation that adds and removes BBs
while querying and updating BFI.
With this patch, thanks to updates via CallbackVH, BFI won't keep stale
pointers in its Nodes map.

This is a resubmission of 408349a25d0f5a012003f84c95b49bcc7782fa70 with
fixed compiler warning and MSVC compilation error.

Reviewers: davidxl, yamauchi, asbirlea, fhahn, fedor.sergeev

Reviewed-By: asbirlea, davidxl
Tags: #llvm

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

4 years ago[DAG] Combine fshl/fshr(load1,load0,c) if we have consecutive loads
Simon Pilgrim [Fri, 6 Mar 2020 11:36:00 +0000 (11:36 +0000)]
[DAG] Combine fshl/fshr(load1,load0,c) if we have consecutive loads

As noted on D75114, if both arguments of a funnel shift are consecutive loads we are missing the opportunity to combine them into a single load.

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

4 years ago[lib/ObjectYAML] - Make `ELFYAML::Relocation::Offset` optional.
Georgii Rymar [Wed, 4 Mar 2020 13:55:15 +0000 (16:55 +0300)]
[lib/ObjectYAML] - Make `ELFYAML::Relocation::Offset` optional.

Currently `yaml2obj` require `Offset` field in a relocation description.
There are many cases when `Offset` is insignificant in a context of a test case.

Making `Offset` optional allows to simplify our test cases.
This is what this patch does.

Also, with this patch `obj2yaml` does not dump a zero offset of a relocation.

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

4 years ago[yaml2obj][obj2yaml][Object][test] - Improve testing of relocation types.
Georgii Rymar [Thu, 5 Mar 2020 13:00:16 +0000 (16:00 +0300)]
[yaml2obj][obj2yaml][Object][test] - Improve testing of relocation types.

The intention was to remove the `Object/X86/yaml-elf-x86-rel-broken.yaml test`,
This test is at the wrong place.

`yaml-elf-x86-rel-broken.yaml` was introduced in
rG892c6c86ea25dc97668ff1f1b7bf1108e85fa5ec to check that
yaml2obj can use an arbitrary `Hex32` value as a relocation type.
We have tests that check the similar functionality.

I've improved them and removed the `yaml-elf-x86-rel-broken.yaml`

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

4 years ago[lldb/Disassembler] Move address resolution into the ParseInstructions function
Pavel Labath [Thu, 5 Mar 2020 12:48:56 +0000 (13:48 +0100)]
[lldb/Disassembler] Move address resolution into the ParseInstructions function

The static Disassembler can be thought of as shorthands for three
operations:
- fetch an appropriate disassembler instance (FindPluginForTarget)
- ask it to dissassemble some bytes (ParseInstructions)
- ask it to dump the disassembled instructions (PrintInstructions)

The only thing that's standing in the way of this interpretation is that
the Disassemble function also does some address resolution before
calling ParseInstructions. This patch moves this functionality into
ParseInstructions so that it is available to users who call
ParseInstructions directly.

4 years agoRevert "PR45083: Mark statement expressions as being dependent if they contain"
Stephan Herhut [Fri, 6 Mar 2020 10:09:45 +0000 (11:09 +0100)]
Revert "PR45083: Mark statement expressions as being dependent if they contain"

This reverts commit a95cc77be154433c37a3110ac9af394b7447fcba.

Causes an internal build failure. I followed up with the author by mail.

4 years ago[lldb/test] Use inline assembly for instruction counting tests
Pavel Labath [Fri, 6 Mar 2020 09:47:33 +0000 (10:47 +0100)]
[lldb/test] Use inline assembly for instruction counting tests

We have a test which checks that instruction-step really steps one
instruction, but the way it checks this makes it very susceptible to
codegen changes. This rewrites the test inferior to use inline assembly,
which guarantees a known sequence of instructions that the test can
check. This does mean we have to write separate assembly for each
architecture, but that is no better than having architecture-specific
assertions, which the test was already starting to accumulate.

4 years agoLLDB AArch64 skip single_step_only_steps_one_instruction* tests
Muhammad Omair Javaid [Fri, 6 Mar 2020 08:41:53 +0000 (13:41 +0500)]
LLDB AArch64 skip single_step_only_steps_one_instruction* tests

This patch makes sure that LLDB AArch64/Linux testsuite skips
single_step_only_steps_one_instruction* tests. There is no possible
gaurantee for this test to pass and there already exists a bug report
against this bug.

4 years ago[Analyzer][StreamChecker] Adding PreCall and refactoring (NFC).
Balázs Kéri [Fri, 6 Mar 2020 08:10:37 +0000 (09:10 +0100)]
[Analyzer][StreamChecker] Adding PreCall and refactoring (NFC).

Summary:
Adding PreCall callback.
Argument validity checks are moved into the PreCall callback.
Code is restructured, functions renamed.
There are "pre" and "eval" functions for the file operations.
And additional state check (validate) functions.

Reviewers: Szelethus

Reviewed By: Szelethus

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, cfe-commits

Tags: #clang

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

4 years ago[APFloat] Overload unary operator-
Jay Foad [Thu, 27 Feb 2020 09:50:29 +0000 (09:50 +0000)]
[APFloat] Overload unary operator-

Summary:
We already have overloaded binary arithemetic operators so you can write
A+B etc. This patch lets you write -A instead of neg(A).

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[ARM][MVE] Enable VMOVN for tail predication
Sam Parker [Thu, 5 Mar 2020 11:30:37 +0000 (11:30 +0000)]
[ARM][MVE] Enable VMOVN for tail predication

These instructions also don't exchange lanes, so make them legal.

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

4 years ago[GlobalISel] add missing libcalls and 128-bit support for floating points
Dominik Montada [Mon, 2 Mar 2020 15:28:17 +0000 (16:28 +0100)]
[GlobalISel] add missing libcalls and 128-bit support for floating points

Add libcall support for G_FMINNUM, G_FMAXNUM, G_FSQRT, G_FRINT, G_FNEARBYINT.
Add 128-bit libcall support for all simple libcalls.

Reviewers: arsenm, Petar.Avramovic, dsanders, petarj, paquette

Subscribers: wdng, rovka, hiraditya, volkan, llvm-commits

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

4 years agoRewrite the non-trivial structs section of the ARC spec.
John McCall [Fri, 6 Mar 2020 07:49:06 +0000 (02:49 -0500)]
Rewrite the non-trivial structs section of the ARC spec.

As part of this, set down the general rules for non-trivial types
in C in their full and gory detail, and then separately describe how
they apply to the ARC qualified types.

I'm not totally satisfied with the drafting of the dynamic-objects UB
rules here, but I feel like I'm building on a lot of wreckage.

4 years ago[lldb] Delete UnwindMacOSXFrameBackchain
Pavel Labath [Thu, 5 Mar 2020 14:14:45 +0000 (15:14 +0100)]
[lldb] Delete UnwindMacOSXFrameBackchain

Summary:
It isn't used anywhere (except on imaginary triples like
sparc-apple-ios) and it also violates plugin separation.

This patch deletes it and declares UnwindLLDB to be _the_ lldb unwinder.

Reviewers: jasonmolenda, JDevlieghere, xiaobai

Subscribers: jyknight, mgorny, krytarowski, fedor.sergeev, lldb-commits

Tags: #lldb

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

4 years ago[clang-tools-extra/clang-tidy] Mark modernize-make-shared as offering fixes
Jonas Devlieghere [Fri, 6 Mar 2020 05:44:33 +0000 (21:44 -0800)]
[clang-tools-extra/clang-tidy] Mark modernize-make-shared as offering fixes

The list incorrectly states that modernize-make-shared does not offer
fixes, which is incorrect. Just like modernize-make-unique it does.

4 years ago[clang][cmake] Include generated rst files in html built by docs-clang-html target
Tom Stellard [Fri, 6 Mar 2020 03:57:24 +0000 (19:57 -0800)]
[clang][cmake] Include generated rst files in html built by docs-clang-html target

Summary:
This is an attempt to simply the process of building the clang
documentation, which should help avoid some of the recent issues we've
had generating the documentation for the website.

The html documentation for clang is generated by sphinx from the
reStructuredText (rst) files we have in the clang/docs directory.
There are also some rst files that need to be generated by TableGen,
before they can be passed to sphinx.  Prior to this patch we were not
generating those rst files as part with the build system and they had to be
generated manually.

This patch enables the automatic generation of these rst files, but
since they are generated at build time the cannot be placed in the
clang/docs directory and must go into the cmake build directory.

Unfortunately sphinx does not currently support multiple source
directories[1], so in order to be able to generate the full
documentation, we need to work around this by copying the
rst files from the clang/docs into the  build directory before
generating the html documentation.

[1] https://github.com/sphinx-doc/sphinx/issues/3132

Reviewers: rsmith, aaron.ballman, beanz, smeenai, phosek, compnerd, mgorny, delcypher

Reviewed By: mgorny, delcypher

Subscribers: delcypher, merge_guards_bot, mgorny, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

4 years ago[lldb/DWARF] Fix 80 col formatting (NFC)
Jonas Devlieghere [Fri, 6 Mar 2020 05:28:19 +0000 (21:28 -0800)]
[lldb/DWARF] Fix 80 col formatting (NFC)

Forgot to run git clang-format before landing my previous commit
(226d52b1faadbe4a770d5738ac9d2c5bbc110d3d).

4 years ago[lldb/DWARF] Replace C style casts with static_cast<> (NFC)
Jonas Devlieghere [Fri, 6 Mar 2020 05:23:08 +0000 (21:23 -0800)]
[lldb/DWARF] Replace C style casts with static_cast<> (NFC)

Using static_cast instead of C style casts better conveys the code's
intent, is a tad more safe and stands out more.

4 years ago[libc]Revert "Add linux implementations of thrd_create and thrd_join functions."
Siva Chandra Reddy [Fri, 6 Mar 2020 04:46:13 +0000 (20:46 -0800)]
[libc]Revert "Add linux implementations of thrd_create and thrd_join functions."

This reverts commit abc040e9533011a62a25c93b07b4fc31c8a641f7 as the bots
are failing because of this.

4 years agoAdd some more vscode files
Yuanfang Chen [Fri, 6 Mar 2020 02:14:01 +0000 (18:14 -0800)]
Add some more vscode files

On top of existing TableGen file syntax highlighting, added
- IR syntax highlighting
- LIT test output patterMatcher
- etc.

4 years agoPR45083: Mark statement expressions as being dependent if they contain
Richard Smith [Thu, 5 Mar 2020 20:20:02 +0000 (12:20 -0800)]
PR45083: Mark statement expressions as being dependent if they contain
dependent constructs.

We previously assumed they were neither value- nor
instantiation-dependent under any circumstances, which would lead to
crashes and other misbehavior.

This doesn't match GCC's behavior (where statement expressions appear to
be treated as value-dependent if they appear in a dependent context),
but seems to be the best thing we can do in the short term: it turns out
to be remarkably difficult for us to correctly determine whether we are
in a dependent context (and it's not even possible in some cases, such
as in a generic lambda where we might not have seen the 'auto' yet).

4 years ago[AVR][NFC] Remove trailing space
Jim Lin [Fri, 6 Mar 2020 02:40:27 +0000 (10:40 +0800)]
[AVR][NFC] Remove trailing space

4 years agoThinLTOBitcodeWriter: drop dso_local when a GlobalVariable is converted to a declaration
Fangrui Song [Sun, 16 Feb 2020 01:23:18 +0000 (17:23 -0800)]
ThinLTOBitcodeWriter: drop dso_local when a GlobalVariable is converted to a declaration

If we infer the dso_local flag for -fpic, dso_local should be dropped
when we convert a GlobalVariable a declaration. dso_local causes the
generation of direct access (e.g. R_X86_64_PC32). Such relocations referencing
STB_GLOBAL STV_DEFAULT objects are not allowed in a -shared link.

Reviewed By: tejohnson

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

4 years ago[llvm-objdump] -d: print `00000000 <foo>:` instead of `00000000 foo:`
Fangrui Song [Thu, 5 Mar 2020 22:18:38 +0000 (14:18 -0800)]
[llvm-objdump] -d: print `00000000 <foo>:` instead of `00000000 foo:`

The new behavior matches GNU objdump. A pair of angle brackets makes tests slightly easier.

`.foo:` is not unique and thus cannot be used in a `CHECK-LABEL:` directive.
Without `-LABEL`, the CHECK line can match the `Disassembly of section`
line and causes the next `CHECK-NEXT:` to fail.

```
Disassembly of section .foo:

0000000000001634 .foo:
```

Bdragon: <> has metalinguistic connotation. it just "feels right"

Reviewed By: rupprecht

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

4 years ago[lldb/Core] Minor code cleanup in Editline.cpp (NFC)
Shu Anzai [Fri, 6 Mar 2020 00:14:05 +0000 (16:14 -0800)]
[lldb/Core] Minor code cleanup in Editline.cpp (NFC)

Simplify the code a bit.

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

4 years agoFix 45129: Incorrect generated configuration modernize-make-shared.IncludeStyle
Nathan James [Fri, 6 Mar 2020 00:07:08 +0000 (00:07 +0000)]
Fix 45129: Incorrect generated configuration modernize-make-shared.IncludeStyle

4 years ago[libc] [UnitTest] Add Matchers
Alex Brachet [Thu, 5 Mar 2020 23:36:11 +0000 (18:36 -0500)]
[libc] [UnitTest] Add Matchers

Summary: This patch adds gtest-like matchers and `EXPECT|ASSERT_THAT` macros. It also adds matchers `Succeeds` and `Fails` and has examples using these in test/src/signal/sigaddset_test.cpp.

Reviewers: sivachandra, gchatelet, PaulkaToast

Reviewed By: sivachandra, PaulkaToast

Subscribers: mgorny, MaskRay, tschuett, libc-commits

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

4 years agoAdd warnings for casting ptr -> smaller int for C++ in Microsoft mode
Arthur Eubanks [Thu, 5 Mar 2020 23:07:07 +0000 (15:07 -0800)]
Add warnings for casting ptr -> smaller int for C++ in Microsoft mode

Adds warnings to groups recently added in https://reviews.llvm.org/D72231.

Reviewed By: rnk

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

4 years ago[mlir] Introduce an intrinsic for llvm.matrix.multiply
Nicolas Vasilache [Thu, 5 Mar 2020 22:27:52 +0000 (17:27 -0500)]
[mlir] Introduce an intrinsic for llvm.matrix.multiply

This revision adds the first intrinsic for llvm.matrix.multiply.
This uses the more general `LLVM_OneResultOp` for now since the goal is
to use the
specific Matrix builders that @fhahn has created recently.

When piped through:
```
opt -O3 -enable-matrix | llc -O3 -march=x86-64 -mcpu=skylake-avx512
```
this has been verified to generate ymm instructions.

Additional function attribute support will be needed to generate proper
zmm instructions but at least things run end to end.

Benchmarking will be provided separately with the experimental
metaprogramming
[ModelBuilder](https://github.com/google/iree/tree/master/experimental/ModelBuilder)
tool when ready.

4 years ago[lldb] Fix more typos in log statements in ClangASTSource
Raphael Isemann [Thu, 5 Mar 2020 22:13:05 +0000 (14:13 -0800)]
[lldb] Fix more typos in log statements in ClangASTSource

The indexes need to start at 0 but in D74951 I removed the first parameter
and didn't decrement all the indexes. This patch at least makes sure that
LLDB logging no longer crashes (but it still deadlocks).

4 years ago[libc] Add linux implementations of thrd_create and thrd_join functions.
Siva Chandra Reddy [Wed, 4 Dec 2019 17:06:56 +0000 (09:06 -0800)]
[libc] Add linux implementations of thrd_create and thrd_join functions.

Reviewers: abrachet, phosek

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

4 years ago[TextAPI] Teach TextAPI about arm64e
Cyndy Ishida [Thu, 5 Mar 2020 18:04:32 +0000 (10:04 -0800)]
[TextAPI] Teach TextAPI about arm64e

Reviewers: ributzka, cishida

Subscribers: kristof.beyls, dexonsmith, dcoughlin, llvm-commits

Tags: #llvm

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

4 years ago[IndVarSimplify] Extend previous special case for load use instruction to any narrow...
Zhongduo Lin [Thu, 5 Mar 2020 21:24:47 +0000 (16:24 -0500)]
[IndVarSimplify] Extend previous special case for load use instruction to any narrow type loop variant to avoid extra trunc instruction

Summary:
The widenIVUse avoids generating trunc by evaluating the use as AddRec, this
will not work when:
   1) SCEV traces back to an instruction inside the loop that SCEV can not
expand, eg. add %indvar, (load %addr)
   2) SCEV finds a loop variant, eg. add %indvar, %loopvariant

While SCEV fails to avoid trunc, we can still try to use instruction
combining approach to prove trunc is not required. This can be further
extended with other instruction combining checks, but for now we handle the
following case (sub can be "add" and "mul", "nsw + sext" can be "nus + zext")
```
Src:
  %c = sub nsw %b, %indvar
  %d = sext %c to i64
Dst:
  %indvar.ext1 = sext %indvar to i64
  %m = sext %b to i64
  %d = sub nsw i64 %m, %indvar.ext1
```
Therefore, as long as the result of add/sub/mul is extended to wide type with
right extension and overflow wrap combination, no
trunc is required regardless of how %b is generated. This pattern is common
when calculating address in 64 bit architecture.

Note that this patch reuse almost all the code from D49151 by @az:
https://reviews.llvm.org/D49151

It extends it by providing proof of why trunc is unnecessary in more general case,
it should also resolve some of the concerns from the following discussion with @reames.

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180910/585945.html

Reviewers: sanjoy, efriedma, sebpop, reames, az, javed.absar, amehsan

Reviewed By: az, amehsan

Subscribers: hiraditya, llvm-commits, amehsan, reames, az

Tags: #llvm

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

4 years ago[mlir] [VectorOps] Merge VectorReduction/VectorReductionV2 into one Op
aartbik [Thu, 5 Mar 2020 19:17:58 +0000 (11:17 -0800)]
[mlir] [VectorOps] Merge VectorReduction/VectorReductionV2 into one Op

Summary:
Paying off some technical debt in VectorOps, where I introduced a special
op for a fused accumulator into reduction to avoid some issues around
printing and parsing an optional accumulator. This CL merges the two
into one op again and does things the right way (still would be nice
to have "assemblyFormat" for optional operands though....).

Reviewers: nicolasvasilache, andydavis1, ftynse, rriddle

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Remove successor operands from the Operation class
River Riddle [Thu, 5 Mar 2020 20:48:28 +0000 (12:48 -0800)]
[mlir] Remove successor operands from the Operation class

Summary:
This revision removes all of the functionality related to successor operands on the core Operation class. This greatly simplifies a lot of handling of operands, as well as successors. For example, DialectConversion no longer needs a special "matchAndRewrite" for branching terminator operations.(Note, the existing method was also broken for operations with variadic successors!!)

This also enables terminator operations to define their own relationships with successor arguments, instead of the hardcoded "pass-through" behavior that exists today.

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

4 years ago[mlir] Automatically populate `operand_segment_sizes` in the auto-generated build...
River Riddle [Thu, 5 Mar 2020 20:41:56 +0000 (12:41 -0800)]
[mlir] Automatically populate `operand_segment_sizes` in the auto-generated build methods.

This greatly simplifies the requirements for builders using this mechanism for managing variadic operands.

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

4 years ago[mlir] Refactor a few users to no longer rely on the successor operand API of Operation.
River Riddle [Thu, 5 Mar 2020 20:41:25 +0000 (12:41 -0800)]
[mlir] Refactor a few users to no longer rely on the successor operand API of Operation.

The existing API for successor operands on operations is in the process of being removed. This revision simplifies a later one that completely removes the existing API.

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

4 years ago[mlir][DeclarativeParser] Add support for formatting operations with AttrSizedOperand...
River Riddle [Thu, 5 Mar 2020 20:40:53 +0000 (12:40 -0800)]
[mlir][DeclarativeParser] Add support for formatting operations with AttrSizedOperandSegments.

This attribute details the segment sizes for operand groups within the operation. This revision add support for automatically populating this attribute in the declarative parser.

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

4 years ago[mlir] Add a new BranchOpInterface to allow for opaquely interfacing with branching...
River Riddle [Thu, 5 Mar 2020 20:40:23 +0000 (12:40 -0800)]
[mlir] Add a new BranchOpInterface to allow for opaquely interfacing with branching terminator operations.

This interface contains the necessary components to provide the same builtin behavior that terminators have. This will be used in future revisions to remove many of the hardcoded constraints placed on successors and successor operands. The interface initially contains three methods:

```c++
// Return a set of values corresponding to the operands for successor 'index', or None if the operands do not correspond to materialized values.
Optional<OperandRange> getSuccessorOperands(unsigned index);

// Return true if this terminator can have it's successor operands erased.
bool canEraseSuccessorOperand();

// Erase the operand of a successor. This is only valid to call if 'canEraseSuccessorOperand' returns true.
void eraseSuccessorOperand(unsigned succIdx, unsigned opIdx);
```

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

4 years ago[mlir] Add traits for verifying the number of successors and providing relevant acces...
River Riddle [Thu, 5 Mar 2020 20:39:46 +0000 (12:39 -0800)]
[mlir] Add traits for verifying the number of successors and providing relevant accessors.

This allows for simplifying OpDefGen, as well providing specializing accessors for the different successor counts. This mirrors the existing traits for operands and results.

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

4 years ago[clangd] Remove vsc-extension-quickstart.md from the vscode-clangd plugin
Nathan Ridge [Thu, 27 Feb 2020 20:33:38 +0000 (15:33 -0500)]
[clangd] Remove vsc-extension-quickstart.md from the vscode-clangd plugin

Summary:

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[libomptarget] Implement locks for amdgcn
Jon Chesterfield [Thu, 5 Mar 2020 20:25:30 +0000 (20:25 +0000)]
[libomptarget] Implement locks for amdgcn

Summary:
[libomptarget] Implement locks for amdgcn

The nvptx implementation deadlocks on amdgcn. atomic_cas with multiple
active lanes can deadlock - if one lane succeeds, all the others are locked
out. The set_lock implementation therefore runs on a single lane.

Also uses a sleep intrinsic instead of the system clock for a probably
minor performance improvement. The unset/test implementations may be revised
later, based on code size / performance or similar concerns.

This implements the lock at a per-wavefront scope. That's not strictly as
specified, since openmp describes locks in terms of threads. I think the
nvptx implementation provides true per-thread locking on volta and the same
per-warp locking on other architectures.

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: jvesely, mgorny, jfb, openmp-commits

Tags: #openmp

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

4 years ago[AST Matchers] Restrict `optionally` matcher to a single argument.
Yitzhak Mandelbaum [Tue, 3 Mar 2020 20:04:08 +0000 (15:04 -0500)]
[AST Matchers] Restrict `optionally` matcher to a single argument.

Summary:
Currently, `optionally` can take multiple arguments, which commits it to a
particular strategy for those arguments (in this case, "for each"). We limit the
matcher to a single argument, which avoids any potential confusion and
simplifies the implementation. The user can retrieve multiple-argument
optionality, by explicitly using the desired operator (like `forEach`, `anyOf`,
`allOf`, etc.) with all children wrapped in `optionally`.

Reviewers: sbenza, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[OPENMP50]Add codegen for update clause in depobj directive.
Alexey Bataev [Thu, 5 Mar 2020 18:45:28 +0000 (13:45 -0500)]
[OPENMP50]Add codegen for update clause in depobj directive.

Added codegen for update clause in depobj. Reads the number of the
elements from the first element and updates flags for each element in
the loop.
```
omp_depend_t x;
kmp_depend_info *base = (kmp_depend_info *)x;
intptr_t num = x[-1].base_addr;
kmp_depend_info *end = x + num;
kmp_depend_info *el = base;
do {
  el.flags = new_flag;
  el = &el[1];
} while (el != end);
```

4 years ago[OPENMP50]Skip the first element when storing the list of dependencies
Alexey Bataev [Thu, 5 Mar 2020 18:55:40 +0000 (13:55 -0500)]
[OPENMP50]Skip the first element when storing the list of dependencies
in depobj object.

The first element in the list of the dependencies is used for internal
purposes to store the number of the elements in the provided list.
The first element now is skipped and depobj object poits exactly to the
list of dependencies.

4 years ago[libc] Create abort and _Exit
Alex Brachet [Thu, 5 Mar 2020 19:21:18 +0000 (14:21 -0500)]
[libc] Create abort and _Exit

This revision creates abort and _Exit implementations

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

4 years ago[AArch64][GlobalISel] Avoid copies to target register bank for subregister copies
Jessica Paquette [Thu, 5 Mar 2020 18:57:52 +0000 (10:57 -0800)]
[AArch64][GlobalISel] Avoid copies to target register bank for subregister copies

Previously for any copy from a register bigger than the destination:

Copied to a same-sized register in the destination register bank.
Subregister copy of that to the destination.
This fails for copies from 128-bit FPRs to GPRs because the GPR register bank
can't accomodate 128-bit values.

Instead of special-casing such copies to perform the truncation beforehand in
the source register bank, generalize this:
a) Perform a subregister copy straight from source register whenever possible.
This results in shorter MIR and fixes the above problem.

b) Perform a full copy to target bank and then do a subregister copy only if
source bank can't support target's size. E.g. GPR to 8-bit FPR copy.

Patch by Raul Tambre (tambre)!

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

4 years ago[PowerPC] Delete PPCMachObjectWriter and powerpc{,64}-apple-darwin
Fangrui Song [Tue, 3 Mar 2020 00:52:17 +0000 (16:52 -0800)]
[PowerPC] Delete PPCMachObjectWriter and powerpc{,64}-apple-darwin

Reviewed By: #powerpc, sfertile

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

4 years ago[mlir][GPU] Expose the functionality to create a GPUFuncOp from a LaunchOp
MaheshRavishankar [Thu, 5 Mar 2020 19:01:24 +0000 (11:01 -0800)]
[mlir][GPU] Expose the functionality to create a GPUFuncOp from a LaunchOp

The current setup of the GPU dialect is to model both the host and
device side codegen. For cases (like IREE) the host side modeling
might not directly fit its use case, but device-side codegen is still
valuable. First step in accessing just the device-side functionality
of the GPU dialect is to allow just creating a gpu.func operation from
a gpu.launch operation. In addition this change also "inlines"
operations into the gpu.func op at time of creation instead of this
being a later step.

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

4 years ago[ARM] Rewrite ARMAttributeParser
Fangrui Song [Fri, 21 Feb 2020 19:32:33 +0000 (11:32 -0800)]
[ARM] Rewrite ARMAttributeParser

* Delete boilerplate
* Change functions to return `Error`
* Test parsing errors
* Update callers of ARMAttributeParser::parse() to check the `Error` return value.

Since this patch touches nearly everything in the file, I apply
http://llvm.org/docs/Proposals/VariableNames.html and change variable
names to lower case.

Reviewed By: compnerd

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

4 years agoComment parsing: Treat \ref as inline command
Aaron Puchert [Thu, 5 Mar 2020 18:24:28 +0000 (19:24 +0100)]
Comment parsing: Treat \ref as inline command

Summary:
It's basically Doxygen's version of a link and can happen anywhere
inside of a paragraph. Fixes a bogus warning about empty paragraphs when
a parameter description starts with a link.

Reviewers: gribozavr2

Reviewed By: gribozavr2

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

4 years ago[GWP-ASan] Fix thread ID.
Mitch Phillips [Thu, 5 Mar 2020 18:27:08 +0000 (10:27 -0800)]
[GWP-ASan] Fix thread ID.

Summary:
GWP-ASan currently reports <unknown> thread ID, as the crash handler
merge dropped the include. Oops.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: eugenis, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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