platform/upstream/llvm.git
4 years ago[LegalizeTypes] In PromoteFloatOp_SETCC, don't both querying for transforming the...
Craig Topper [Sat, 14 Dec 2019 22:40:43 +0000 (14:40 -0800)]
[LegalizeTypes] In PromoteFloatOp_SETCC, don't both querying for transforming the result type.

The result type is already legal, is doesnt' need to be
transformed.

4 years ago[cxx_status] Fix paper number for "Concept auto" paper.
Richard Smith [Sat, 14 Dec 2019 22:52:24 +0000 (14:52 -0800)]
[cxx_status] Fix paper number for "Concept auto" paper.

4 years agoRevert "AArch64: Fix frame record chain"
Logan Chien [Sat, 14 Dec 2019 21:58:40 +0000 (13:58 -0800)]
Revert "AArch64: Fix frame record chain"

Breaks aosp-O3-polly-before-vectorizer-unprofitable with the following
error message:

void llvm::emitFrameOffset(llvm::MachineBasicBlock &,
MachineBasicBlock::iterator, const llvm::DebugLoc &, unsigned int,
unsigned int, llvm::StackOffset, const llvm::TargetInstrInfo *,
MachineInstr::MIFlag, bool, bool, bool *): Assertion `(DestReg !=
AArch64::SP || Bytes % 16 == 0) && "SP increment/decrement not 16-byte
aligned"' failed.

This reverts commit d4e10e6adb1b629b3fc1b78f7e281fbcec392edb.

4 years agogn build: (manually and belatedly) merge ed153ef044fd
Nico Weber [Sat, 14 Dec 2019 19:12:25 +0000 (14:12 -0500)]
gn build: (manually and belatedly) merge ed153ef044fd

4 years agoAArch64: Fix frame record chain
Logan Chien [Thu, 28 Nov 2019 06:56:34 +0000 (22:56 -0800)]
AArch64: Fix frame record chain

The commit r369122 may keep LR and FP register (aka. frame record) in
the middle of a frame, thus we must add the offsets to ensure the FP
register always points to innermost frame record on the stack.

According to AAPCS64[1], a conforming code shall construct a linked list
of stack frames that can be traversed with frame records.  This commit
is also essential to frame-pointer-based stack unwinder (e.g.  the stack
unwinder in linx-perf-tools.)

[1] https://github.com/ARM-software/software-standards/blob/master/abi/aapcs64/aapcs64.rst#the-frame-pointer

Test: llvm-lit ${LLVM_SRC}/test/CodeGen/AArch64/framelayout-frame-record.ll
Test: llvm-lit ${LLVM_SRC}/test/CodeGen/AArch64

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

4 years ago[perf-training] Make training data location configurable
Shoaib Meenai [Sat, 14 Dec 2019 03:35:49 +0000 (19:35 -0800)]
[perf-training] Make training data location configurable

We may wish to keep the PGO training data outside the repository. Add a
CMake variable to allow referencing an external lit testsuite.

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

4 years ago[AArch64][test] Fix machine-outliner-size-info.mir after D71168
Fangrui Song [Sat, 14 Dec 2019 17:44:34 +0000 (09:44 -0800)]
[AArch64][test] Fix machine-outliner-size-info.mir after D71168

4 years ago[clang] Fix modules build after addition of TypeBitCodes.def
Raphael Isemann [Sat, 14 Dec 2019 17:18:59 +0000 (18:18 +0100)]
[clang] Fix modules build after addition of TypeBitCodes.def

In revision 139006ceb641f038a2b19cac1174316e57004ed6 the Serialization
folder got its first def file 'TypeBitCodes.def'. This broke the
modules build as this .def file was not textually included but implicitly
converted into a module due to our umbrella directive.

This patch fixes this by explicitly marking the .def file as textual.

4 years ago[AArch64] add tests for fcvtl2; NFC
Sanjay Patel [Sat, 14 Dec 2019 16:08:36 +0000 (11:08 -0500)]
[AArch64] add tests for fcvtl2; NFC

4 years agoFix build with older (still supported) gcc versions.
Nico Weber [Sat, 14 Dec 2019 15:13:15 +0000 (10:13 -0500)]
Fix build with older (still supported) gcc versions.

Older gccs can't handle multiline raw string literals in
macro parameters.

4 years agogn build: Merge 91dd67ef724
Nico Weber [Sat, 14 Dec 2019 14:44:46 +0000 (09:44 -0500)]
gn build: Merge 91dd67ef724

4 years agoRevert "[clangd] Fall back to selecting token-before-cursor if token-after-cursor...
Nico Weber [Sat, 14 Dec 2019 13:13:29 +0000 (08:13 -0500)]
Revert "[clangd] Fall back to selecting token-before-cursor if token-after-cursor fails."

This reverts commit b60896fad926754f715acc5d771555aaaa577e0f.
Breaks building with gcc:

/usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function ‘clang::clangd::Tweak::Selection::Selection(const clang::clangd::Tweak::Selection&)’
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.h:28:0,
                 from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.cpp:9:
/home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/refactor/Tweak.h:49:10: note: ‘clang::clangd::Tweak::Selection::Selection(const clang::clangd::Tweak::Selection&)’ is implicitly deleted because the default definition would be ill-formed:
   struct Selection {
          ^~~~~~~~~
/home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/refactor/Tweak.h:49:10: error: use of deleted function ‘clang::clangd::SelectionTree::SelectionTree(const clang::clangd::SelectionTree&)’
In file included from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/refactor/Tweak.h:25:0,
                 from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.h:28,
                 from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.cpp:9:
/home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/Selection.h:96:3: note: declared here
   SelectionTree(const SelectionTree &) = delete;
   ^~~~~~~~~~~~~

e.g. here:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-selfhost-neon/builds/2714
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/41866

4 years agogn build: (manually) merge 6404bd236 and d505e57cc2
Nico Weber [Sat, 14 Dec 2019 12:44:36 +0000 (07:44 -0500)]
gn build: (manually) merge 6404bd236 and d505e57cc2

4 years agoMove ASTRecordWriter into its own header; NFC.
John McCall [Sat, 14 Dec 2019 08:17:03 +0000 (03:17 -0500)]
Move ASTRecordWriter into its own header; NFC.

Similar motivations to the movement of ASTRecordReader:
AbstractBasicWriter.h already has quite a few dependencies,
and it's going to get pretty large as we generate more and more
into it.  Meanwhile, most clients don't depend on this detail of
the implementation and shouldn't need to be recompiled.

I've also made OMPClauseWriter private, like it belongs.

4 years agoMove ASTRecordReader into its own header; NFC.
John McCall [Sat, 14 Dec 2019 08:01:28 +0000 (03:01 -0500)]
Move ASTRecordReader into its own header; NFC.

AbstractBasicReader.h has quite a few dependencies already,
and that's only likely to increase.  Meanwhile, ASTRecordReader
is really an implementation detail of the ASTReader that is only
used in a small number of places.

I've kept it in a public header for the use of projects like Swift
that might want to plug in to Clang's serialization framework.

I've also moved OMPClauseReader into an implementation file,
although it can't be made private because of friendship.

4 years ago[NFC][llvm][MIRVRegNamerUtils] Refactoring GetHashableMO into switch-statement.
Puyan Lotfi [Sat, 14 Dec 2019 05:58:44 +0000 (00:58 -0500)]
[NFC][llvm][MIRVRegNamerUtils] Refactoring GetHashableMO into switch-statement.

This refactors the if-statements handling the hashing of various
MachineOperand types into a switch-statement. The purpose is to cover
all the basis for all MachineOperand types while being very deliberate
about which MachineOperand types we are not handling and why (better
added comments). This patch is a NFC redo of https://reviews.llvm.org/D71396.
Much of the changes present in D71396 will come in smaller follow-up patches
that will add support for hashing the MachineOperand types that aren't
covered piece-meal with tests for each new case.

4 years ago[Attributor][Tests] Copy & use the ArgumentPromotion tests
Johannes Doerfert [Sat, 14 Dec 2019 06:47:29 +0000 (00:47 -0600)]
[Attributor][Tests] Copy & use the ArgumentPromotion tests

4 years ago[ArgPromo][Tests] Run update_test_checks on all ArgumentPromotion tests
Johannes Doerfert [Thu, 10 Oct 2019 07:10:51 +0000 (02:10 -0500)]
[ArgPromo][Tests] Run update_test_checks on all ArgumentPromotion tests

Summary:
In preparation of D65531 as well as the reuse of these tests for the
Attributor, we modernize them and use the update_test_checks to simplify
updates.

This was done with the update_test_checks after D68819 and D68850.

Reviewers: hfinkel, vsk, dblaikie, davidxl, tejohnson, tstellar, echristo, chandlerc, efriedma, lebedev.ri

Subscribers: bollu, arphaman, llvm-commits

Tags: #llvm

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

4 years agoMSVC build fix: forget some unneeded and incorrect friends.
John McCall [Sat, 14 Dec 2019 05:55:26 +0000 (00:55 -0500)]
MSVC build fix: forget some unneeded and incorrect friends.

On MSVC, friend declarations are (incorrectly) visible even if
not otherwise declared, which causes them to interfere with
lookup.  ASTTypeWriter is actually in an anonymous namespace
and cannot be ASTWriter's friend.  The others simply don't need
to be anymore.

4 years ago[Attributor] Annotate call sites of declarations with a callback
Johannes Doerfert [Sat, 14 Dec 2019 05:41:02 +0000 (23:41 -0600)]
[Attributor] Annotate call sites of declarations with a callback

Even if a declaration is called, if there is a callback we might need
the information during CG-SCC traversal (D70767).

4 years ago[Attributor][NFC] Add more simple test situations for callbacks
Johannes Doerfert [Sat, 14 Dec 2019 05:39:48 +0000 (23:39 -0600)]
[Attributor][NFC] Add more simple test situations for callbacks

4 years ago[Attributor][NFC] Reorder test functions
Johannes Doerfert [Sat, 14 Dec 2019 05:38:05 +0000 (23:38 -0600)]
[Attributor][NFC] Reorder test functions

Since one of the functions has a personality the attribute set is
printed. If the function is the first it should (hopefully) always be #0

4 years ago[Attributor][NFC] Simplify debug printing for abstract attributes
Johannes Doerfert [Sat, 14 Dec 2019 05:35:45 +0000 (23:35 -0600)]
[Attributor][NFC] Simplify debug printing for abstract attributes

This also fixes a type in the debug printing of AANoAlias.

4 years agoAbstract serialization: TableGen the (de)serialization code for Types.
John McCall [Sat, 14 Dec 2019 02:54:44 +0000 (21:54 -0500)]
Abstract serialization: TableGen the (de)serialization code for Types.

The basic technical design here is that we have three levels
of readers and writers:

- At the lowest level, there's a `Basic{Reader,Writer}` that knows
  how to emit the basic structures of the AST.  CRTP allows this to
  be metaprogrammed so that the client only needs to support a handful
  of primitive types (e.g. `uint64_t` and `IdentifierInfo*`) and more
  complicated "inline" structures such as `DeclarationName` can just
  be emitted in terms of those primitives.

  In Clang's binary-serialization code, these are
  `ASTRecord{Reader,Writer}`.  For now, a large number of basic
  structures are still emitted explicitly by code on those classes
  rather than by either TableGen or CRTP metaprogramming, but I
  expect to move more of these over.

- In the middle, there's a `Property{Reader,Writer}` which is
  responsible for processing the properties of a larger object.  The
  object-level reader/writer asks the property-level reader/writer to
  project out a particular property, yielding a basic reader/writer
  which will be used to read/write the property's value, like so:

  ```
    propertyWriter.find("count").writeUInt32(node->getCount());
  ```

  Clang's binary-serialization code ignores this level (it uses
  the basic reader/writer as the property reader/writer and has the
  projection methods just return `*this`) and simply relies on the
  roperties being read/written in a stable order.

- At the highest level, there's an object reader/writer (e.g.
  `Type{Reader,Writer}` which emits a logical object with properties.
  Think of this as writing something like a JSON dictionary literal.

I haven't introduced support for bitcode abbreviations yet --- it
turns out that there aren't any operative abbreviations for types
besides the QualType one --- but I do have some ideas of how they
should work.  At any rate, they'll be necessary in order to handle
statements.

I'm sorry for not disentangling the patches that added basic and type
reader/writers; I made some effort to, but I ran out of energy after
disentangling a number of other patches from the work.

Negligible impact on module size, time to build a set of about 20
fairly large modules, or time to read a few declarations out of them.

4 years agoAbstract serialization: TableGen "basic" reader/writer CRTP
John McCall [Sat, 14 Dec 2019 02:52:16 +0000 (21:52 -0500)]
Abstract serialization: TableGen "basic" reader/writer CRTP
classes that serialize basic values

4 years agoStandardize the reader methods in ASTReader; NFC.
John McCall [Fri, 13 Dec 2019 08:37:23 +0000 (03:37 -0500)]
Standardize the reader methods in ASTReader; NFC.

There are three significant changes here:

- Most of the methods to read various embedded structures (`APInt`,
  `NestedNameSpecifier`, `DeclarationName`, etc.) have been moved
  from `ASTReader` to `ASTRecordReader`.  This cleans up quite a
  bit of code which was passing around `(F, Record, Idx)` arguments
  everywhere or doing explicit indexing, and it nicely parallels
  how it works on the writer side.  It also sets us up to then move
  most of these methods into the `BasicReader`s that I'm introducing
  as part of abstract serialization.

  As part of this, several of the top-level reader methods (e.g.
  `readTypeRecord`) have been converted to use `ASTRecordReader`
  internally, which is a nice readability improvement.

- I've standardized most of these method names on `readFoo` rather
  than `ReadFoo` (used in some of the helper structures) or `GetFoo`
  (used for some specific types for no apparent reason).

- I've changed a few of these methods to return their result instead
  of reading into an argument passed by reference.  This is partly
  for general consistency and partly because it will make the
  metaprogramming easier with abstract serialization.

4 years agoExtract the TypeClass <-> TypeCode map into a .def file; NFC.
John McCall [Wed, 11 Dec 2019 08:30:22 +0000 (03:30 -0500)]
Extract the TypeClass <-> TypeCode map into a .def file; NFC.

4 years agoEnable better node-hierarchy metaprogramming; NFC.
John McCall [Tue, 10 Dec 2019 21:23:43 +0000 (16:23 -0500)]
Enable better node-hierarchy metaprogramming; NFC.

4 years agoExtract out WrappedRecord as a convenience base class; NFC.
John McCall [Tue, 10 Dec 2019 21:20:36 +0000 (16:20 -0500)]
Extract out WrappedRecord as a convenience base class; NFC.

4 years agoAdd a function to get the ExceptionSpecInfo of a function type; NFC.
John McCall [Tue, 10 Dec 2019 21:14:41 +0000 (16:14 -0500)]
Add a function to get the ExceptionSpecInfo of a function type; NFC.

4 years agoIntroduce some types and functions to make it easier to work with
John McCall [Mon, 28 Oct 2019 16:45:53 +0000 (09:45 -0700)]
Introduce some types and functions to make it easier to work with
the tblgen AST node hierarchies.

Not totally NFC because both of the emitters now emit in a different
order.  The type-nodes emitter now visits nodes in hierarchy order,
which means we could use range checks in classof if we had any types
that would benefit from that; currently we do not.  The AST-nodes
emitter now uses a multimap keyed by the name of the record; previously
it was using `Record*`, which of couse isn't stable across processes
and may have led to non-reproducible builds in some circumstances.

4 years ago[NFC] Correct accidental use of tabs.
John McCall [Mon, 28 Oct 2019 16:25:31 +0000 (09:25 -0700)]
[NFC] Correct accidental use of tabs.

4 years ago[NFC] Rename ClangASTEmitters.h -> ASTTableGen.h
John McCall [Sat, 26 Oct 2019 01:38:07 +0000 (18:38 -0700)]
[NFC] Rename ClangASTEmitters.h -> ASTTableGen.h

4 years ago[Attributor] Only replace instruction operands
Johannes Doerfert [Sat, 14 Dec 2019 04:11:42 +0000 (22:11 -0600)]
[Attributor] Only replace instruction operands

This was part of D70767. When we replace the value of (call/invoke)
instructions we do not want to disturb the old call graph so we will
only replace instruction uses until we get rid of the old PM.

Accepted as part of D70767.

4 years ago[Attributor] Reuse the IPConstantProp tests for the Attributor
Johannes Doerfert [Sat, 2 Nov 2019 04:37:04 +0000 (23:37 -0500)]
[Attributor] Reuse the IPConstantProp tests for the Attributor

The Attributor can, to some degree, do what IPConstantProp does. We can
consequently use the corner cases already collected and tested for in
the IPConstantProp tests to improve Attributor test coverage.

This exposed various bugs fixed in previous Attributor patches.

Not all functionality of IPConstantProp is available in AAValueSimplify
and AAIsDead so some tests show that we cannot perform the expected
constant propagation.

Reviewers: fhahn, efriedma, mssimpso, davide

Subscribers: bollu, llvm-commits

Tags: #llvm

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

4 years agogn build: add deps I failed to add in b2508ce85c1
Nico Weber [Sat, 14 Dec 2019 03:19:11 +0000 (22:19 -0500)]
gn build: add deps I failed to add in b2508ce85c1

4 years ago[clang] Move CLANG_BOOTSTRAP_CMAKE_ARGS above PASSTHROUGH_VARIABLES
Xin-Xin Wang [Sat, 14 Dec 2019 03:04:36 +0000 (19:04 -0800)]
[clang] Move CLANG_BOOTSTRAP_CMAKE_ARGS above PASSTHROUGH_VARIABLES

I want to pass some CMake cache files in CLANG_BOOTSTRAP_CMAKE_ARGS as
`-C <cache file>.cmake` arguments. I want to be able to use the values
of the bootstrap passthrough variables in the cache files, so the cache
file arguments need to be after passthrough variables. This should be
safe because the values of passthrough variables are all constants and
can't refer to values in CLANG_BOOTSTRAP_CMAKE_ARGS.

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

4 years ago[AArch64] Save FP for leaf functions when disabling frame pointer elimination
Fangrui Song [Sat, 7 Dec 2019 18:23:30 +0000 (10:23 -0800)]
[AArch64] Save FP for leaf functions when disabling frame pointer elimination

The change allows clang -mno-omit-leaf-frame-pointer to disable frame
pointer elimination. This behavior matches X86 and Mips, and also GCC
AArch64.

Reviewed By: efriedma

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

4 years ago[Driver] Default to -momit-leaf-frame-pointer for AArch64
Fangrui Song [Sat, 7 Dec 2019 18:40:39 +0000 (10:40 -0800)]
[Driver] Default to -momit-leaf-frame-pointer for AArch64

This matches https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html

> -momit-leaf-frame-pointer
> -mno-omit-leaf-frame-pointer
>
>   Omit or keep the frame pointer in leaf functions. The former behavior is the default.

-mno-omit-leaf-frame-pointer is currently a no-op because
TargetOptions::DisableFramePointerElim is only considered for non-leaf
functions.

Reviewed By: efriedma

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

4 years agoPR44268: Fix crash if __builtin_object_size is applied to a heap
Richard Smith [Sat, 14 Dec 2019 02:38:33 +0000 (18:38 -0800)]
PR44268: Fix crash if __builtin_object_size is applied to a heap
allocation.

4 years ago[c++20] Improve phrasing of diagnostic for missing #include <compare>.
Richard Smith [Thu, 12 Dec 2019 01:28:46 +0000 (17:28 -0800)]
[c++20] Improve phrasing of diagnostic for missing #include <compare>.

4 years ago[libcxx] [test] Include missing headers. (NFC)
Stephan T. Lavavej [Sat, 14 Dec 2019 02:14:09 +0000 (18:14 -0800)]
[libcxx] [test] Include missing headers. (NFC)

libcxx/test/std/containers/sequences/array/at.pass.cpp
Need to include <stdexcept> for std::out_of_range.

libcxx/test/std/localization/locale.categories/category.time/*
Need to include <ios> for std::ios.

4 years ago[analyzer] CStringChecker: Fix a crash on unknown value passed to strlcat.
Artem Dergachev [Sat, 14 Dec 2019 01:59:36 +0000 (17:59 -0800)]
[analyzer] CStringChecker: Fix a crash on unknown value passed to strlcat.

Checkers should always account for unknown values.

Also use a slightly more high-level API that naturally avoids the problem.

4 years ago[PowerPC] Add Support for indirect calls on AIX.
Sean Fertile [Fri, 13 Dec 2019 19:34:11 +0000 (14:34 -0500)]
[PowerPC] Add Support for indirect calls on AIX.

Extends the desciptor-based indirect call support for 32-bit codegen,
and enables indirect calls for AIX.

In-depth Description:
In a function descriptor based ABI, a function pointer points at a
descriptor structure as opposed to the function's entry point. The
descriptor takes the form of 3 pointers: 1 for the function's entry
point, 1 for the TOC anchor of the module containing the function
definition, and 1 for the environment pointer:

struct FunctionDescriptor {
  void *EntryPoint;
  void *TOCAnchor;
  void *EnvironmentPointer;
};

An indirect call has several steps of loading the the information from
the descriptor into the proper registers for setting up the call. Namely
it has to:

1) Save the caller's TOC pointer into the TOC save slot in the linkage
   area, and then load the callee's TOC pointer into the TOC register
   (GPR 2 on AIX).

2) Load the function descriptor's entry point into the count register.

3) Load the environment pointer into the environment pointer register
   (GPR 11 on AIX).

4) Perform the call by branching on count register.

5) Restore the caller's TOC pointer after returning from the indirect call.

A couple important caveats to the above:

- There is no way to directly load a value from memory into the count register.
  Instead we populate the count register by loading the entry point address into
  a gpr and then moving the gpr to the count register.

- The TOC restore has to come immediately after the branch on count register
  instruction (i.e., the 1st instruction executed after we return from the
  call). This is an implementation limitation. We could, in theory, schedule
  the restore elsewhere as long as no uses of the TOC pointer fall in between
  the call and the restore; however, to keep it simple, we insert a pseudo
  instruction that represents both the indirect branch instruction and the
  load instruction that restores the caller's TOC from the linkage area. As
  they flow through the compiler as a single pseudo instruction, nothing can be
  inserted between them and the caller's TOC is then valid at any use.

Differtential Revision: https://reviews.llvm.org/D70724

4 years ago[lit] Small cleanups. NFCI
Julian Lettner [Tue, 26 Feb 2019 06:51:50 +0000 (22:51 -0800)]
[lit] Small cleanups. NFCI

Remove unnecessary (argument same as default), cleanup imports, use
"pythonic" names for variables, and general formatting.

4 years ago[OpenMP][Docs] Claim loop tiling.
Michael Kruse [Sat, 14 Dec 2019 00:40:54 +0000 (18:40 -0600)]
[OpenMP][Docs] Claim loop tiling.

4 years ago[Mips] Fix gcc -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after...
Fangrui Song [Sat, 14 Dec 2019 00:40:34 +0000 (16:40 -0800)]
[Mips] Fix gcc -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D71028

4 years ago[Legalizer] Making artifact combining order-independent
Roman Tereshin [Thu, 12 Dec 2019 21:20:41 +0000 (13:20 -0800)]
[Legalizer] Making artifact combining order-independent

Legalization algorithm is complicated by two facts:
1) While regular instructions should be possible to legalize in
   an isolated, per-instruction, context-free manner, legalization
   artifacts can only be eliminated in pairs, which could be deeply, and
   ultimately arbitrary nested: { [ () ] }, where which paranthesis kind
   depicts an artifact kind, like extend, unmerge, etc. Such structure
   can only be fully eliminated by simple local combines if they are
   attempted in a particular order (inside out), or alternatively by
   repeated scans each eliminating only one innermost pair, resulting in
   O(n^2) complexity.
2) Some artifacts might in fact be regular instructions that could (and
   sometimes should) be legalized by the target-specific rules. Which
   means failure to eliminate all artifacts on the first iteration is
   not a failure, they need to be tried as instructions, which may
   produce more artifacts, including the ones that are in fact regular
   instructions, resulting in a non-constant number of iterations
   required to finish the process.

I trust the recently introduced termination condition (no new artifacts
were created during as-a-regular-instruction-retrial of artifacts not
eliminated on the previous iteration) to be efficient in providing
termination, but only performing the legalization in full if and only if
at each step such chains of artifacts are successfully eliminated in
full as well.

Which is currently not guaranteed, as the artifact combines are applied
only once and in an arbitrary order that has to do with the order of
creation or insertion of artifacts into their worklist, which is a no
particular order.

In this patch I make a small change to the artifact combiner, making it
to re-insert into the worklist immediate (modulo a look-through copies)
artifact users of each vreg that changes its definition due to an
artifact combine.

Here the first scan through the artifacts worklist, while not
being done in any guaranteed order, only needs to find the innermost
pair(s) of artifacts that could be immediately combined out. After that
the process follows def-use chains, making them shorter at each step, thus
combining everything that can be combined in O(n) time.

Reviewers: volkan, aditya_nandakumar, qcolombet, paquette, aemerson, dsanders

Reviewed By: aditya_nandakumar, paquette

Tags: #llvm

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

4 years ago[Legalizer] Refactoring out legalizeMachineFunction
Roman Tereshin [Thu, 12 Dec 2019 16:35:16 +0000 (08:35 -0800)]
[Legalizer] Refactoring out legalizeMachineFunction

and introducing new unittests/CodeGen/GlobalISel/LegalizerTest.cpp
relying on it to unit test the entire legalizer algorithm (including the
top-level main loop).

See also https://reviews.llvm.org/D71448

4 years ago[Legalizer] More detailed debugging printing in main loop
Roman Tereshin [Thu, 12 Dec 2019 21:08:40 +0000 (13:08 -0800)]
[Legalizer] More detailed debugging printing in main loop

4 years ago[ubsan] Enable testing of .m files
Vedant Kumar [Fri, 13 Dec 2019 20:57:37 +0000 (12:57 -0800)]
[ubsan] Enable testing of .m files

This allows `.m` test files, like the existing Misc/bool.m, to be
tested.

4 years ago[lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.
Jonas Devlieghere [Fri, 13 Dec 2019 22:48:30 +0000 (14:48 -0800)]
[lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.

This groups the headers and interfaces in separate files that can be
included by other swig files for different languages.

4 years ago[Driver] Use .init_array for all gcc installations and simplify Generic_ELF -fno...
Fangrui Song [Thu, 12 Dec 2019 18:49:46 +0000 (10:49 -0800)]
[Driver] Use .init_array for all gcc installations and simplify Generic_ELF -fno-use-init-array rules

D39317 made clang use .init_array when no gcc installations is found.
This change changes all gcc installations to use .init_array .

GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files,
and stopped emitting .ctors for __attribute__((constructor)).
.init_array should always work.

FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean.

Reviewed By: rnk

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

4 years ago[OPENMP]Fix skipping of functions body.
Alexey Bataev [Fri, 13 Dec 2019 21:05:30 +0000 (16:05 -0500)]
[OPENMP]Fix skipping of functions body.

When parsing the code with OpenMP and the function's body must be
skipped, need to skip also OpenMP annotation tokens. Otherwise the
counters for braces/parens are unbalanced and parsing fails.

4 years ago[lldb/CMake] Initialize LLDB_ENABLE_POSIX based on the UNIX variable.
Jonas Devlieghere [Fri, 13 Dec 2019 21:46:30 +0000 (13:46 -0800)]
[lldb/CMake] Initialize LLDB_ENABLE_POSIX based on the UNIX variable.

4 years ago[lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHON
Jonas Devlieghere [Fri, 13 Dec 2019 18:37:33 +0000 (10:37 -0800)]
[lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHON

This matches the naming scheme used by LLVM and all the other optional
dependencies in LLDB.

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

4 years ago[LSAN] Increase stack space for guard-page.c test
Alex Richardson [Fri, 13 Dec 2019 19:44:13 +0000 (19:44 +0000)]
[LSAN] Increase stack space for guard-page.c test

Summary:
When running the tests on a Ubuntu 18.04 machine this test is crashing for
me inside the runtime linker. My guess is that it is trying to save more
registers (possibly large vector ones) and the current stack space is not
sufficient.

Reviewers: samsonov, kcc, eugenis

Reviewed By: eugenis

Subscribers: eugenis, merge_guards_bot, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[NFC] Use SelectionDAG::getMemBasePlusOffset() instead of getNode(ISD::ADD)
Alex Richardson [Fri, 13 Dec 2019 19:43:15 +0000 (19:43 +0000)]
[NFC] Use SelectionDAG::getMemBasePlusOffset() instead of getNode(ISD::ADD)

Summary:
To find potential opportunities to use getMemBasePlusOffset() I looked at
all ISD::ADD uses found with the regex getNode\(ISD::ADD,.+,.+Ptr
in lib/CodeGen/SelectionDAG. If this patch is accepted I will convert
the files in the individual backends too.

The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.

We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.

Reviewers: spatel

Reviewed By: spatel

Subscribers: merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Implement SelectionDAG::getObjectPtrOffset() using getMemBasePlusOffset()
Alex Richardson [Fri, 13 Dec 2019 19:43:06 +0000 (19:43 +0000)]
[NFC] Implement SelectionDAG::getObjectPtrOffset() using getMemBasePlusOffset()

Summary:
This change is preparatory work to use this helper functions in more places.
In order to make this change, getMemBasePlusOffset() has been extended to
also take a SDNodeFlags parameter.

The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.

We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.

Reviewers: spatel

Reviewed By: spatel

Subscribers: merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Add a SDValue overload for SelectionDAG::getMemBasePlusOffset()
Alex Richardson [Fri, 13 Dec 2019 19:43:02 +0000 (19:43 +0000)]
[NFC] Add a SDValue overload for SelectionDAG::getMemBasePlusOffset()

Summary:
This change is preparatory work to use this helper functions in more places.
Currently the function only allows integer constants offsets, but there
are cases where we can use an existing SDValue parameter.

The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.

We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.

Reviewers: spatel, craig.topper

Reviewed By: spatel, craig.topper

Subscribers: craig.topper, merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Change SelectionDAG::getMemBasePlusOffset() to use int64_t
Alex Richardson [Fri, 13 Dec 2019 19:42:58 +0000 (19:42 +0000)]
[NFC] Change SelectionDAG::getMemBasePlusOffset() to use int64_t

Summary:
This change is preparatory work to use this helper functions in more places.
Currently the function only allows positive offsets, but there are cases
where we want to subtract an offset from an existing pointer.

The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.

We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.

Reviewers: spatel

Reviewed By: spatel

Subscribers: merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[libomptarget] Move resource id functions into target specific code, implemen...
Alexey Bataev [Fri, 13 Dec 2019 21:24:10 +0000 (16:24 -0500)]
Revert "[libomptarget] Move resource id functions into target specific code, implement for amdgcn"

This reverts commit dbb3fec8adfc4ac3fbf31f51f294427dbabbebb2 since it
breaks the NVPTX tests.

4 years agoCall objc_retainBlock before passing a block as a variadic argument
Akira Hatanaka [Thu, 12 Dec 2019 06:51:18 +0000 (22:51 -0800)]
Call objc_retainBlock before passing a block as a variadic argument

Copy the block to the heap before passing it to the callee in case the
block escapes in the callee.

rdar://problem/55683462

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

4 years agoFix -Wswitch-coverage warning in clang-tidy after ak_addrspace introduction.
Eric Christopher [Fri, 13 Dec 2019 20:54:13 +0000 (12:54 -0800)]
Fix -Wswitch-coverage warning in clang-tidy after ak_addrspace introduction.

Differential Revision: https://reviews.llvm.org/D71486
Reviewed By: rsmith

4 years ago[libc++] Ensure __config always defines certain configuration macros.
Eric Fiselier [Fri, 13 Dec 2019 20:42:07 +0000 (15:42 -0500)]
[libc++] Ensure __config always defines certain configuration macros.

4 years agoLanguageRuntime: Simplify NSException::GetSummary() output
Med Ismail Bennani [Tue, 10 Dec 2019 23:09:25 +0000 (15:09 -0800)]
LanguageRuntime: Simplify NSException::GetSummary() output

Summary:
Right now, NSException::GetSummary() has the following output:
"name: $exception_name - reason: $exception_reason"

It would be better to simplify the output by removing the name and only
showing the exception's reason. This way, annotations would look nicer in
the editor, and would be a shorter summary in the Variables Inspector.

Accessing the exception's name can still be done by expanding the
NSException object in the Variables Inspector.

rdar://54770115

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Subscribers: lldb-commits

Tags: #lldb

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years agoCorrect gcc vector splat conversion from float to int-vector
Erich Keane [Fri, 13 Dec 2019 20:15:41 +0000 (12:15 -0800)]
Correct gcc vector splat conversion from float to int-vector

In looking into some other code, I came across this issue where a
float converted to a gcc integer vector via a splat causes it to miss
the float-to-integral cast, which causes some REALLY strange codegen
bugs.

The AST looked like:
`-ImplicitCastExpr <col:13>
'gcc_int_2':'__attribute__((__vector_size__(2 * sizeof(int)))) int' <VectorSplat>
        `-ImplicitCastExpr <col:13> 'float' <LValueToRValue>
                  `-DeclRefExpr <col:13> 'float' lvalue ParmVar
                  0x556f16a5dc90 'f' 'float'

Despite the type of the VectorSplat cast as printed, it ended up
becoming a vector of float, which caused non-matching instructions. For
example, IntVector + a float constant resulted in:

add <2 x i32> %8, <2 x float> <float 3.000000e+00, float 3.000000e+00>

This patch corrects the conversion so that the float is first converted
to an integral, THEN splatted.

4 years ago[RISCV] Move DebugLoc Copy into CompressInstEmitter
Sam Elliott [Fri, 13 Dec 2019 20:00:14 +0000 (20:00 +0000)]
[RISCV] Move DebugLoc Copy into CompressInstEmitter

Summary:
This copy ensures that debug location information is kept for
compressed instructions. There are places where both compressInstruction and
uncompressInstruction are called that were not doing this copy, discarding some
debug info.

This change merely moves the copy into the generated file, so you cannot forget
to copy the location over when compressing or uncompressing.

Reviewers: asb, luismarques

Reviewed By: luismarques

Subscribers: sameer.abuasal, aprantl, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

4 years agoRevert "[VectorUtils] Introduce the Vector Function Database (VFDatabase)."
Francesco Petrogalli [Fri, 13 Dec 2019 19:15:29 +0000 (19:15 +0000)]
Revert "[VectorUtils] Introduce the Vector Function Database (VFDatabase)."

This reverts commit 0be81968a283fd4161cb9ac9748d5ed200926292.

The VFDatabase needs some rework to be able to handle vectorization
and subsequent scalarization of intrinsics in out-of-tree versions of
the compiler. For more details, see the discussion in
https://reviews.llvm.org/D67572.

4 years ago[profile] Fix a crash when -fprofile-remapping-file= triggers an error
Fangrui Song [Fri, 13 Dec 2019 19:15:40 +0000 (11:15 -0800)]
[profile] Fix a crash when -fprofile-remapping-file= triggers an error

Reviewed By: wmi

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

4 years ago[InstSimplify] improve test coverage for insert+splat; NFC
Sanjay Patel [Fri, 13 Dec 2019 19:03:18 +0000 (14:03 -0500)]
[InstSimplify] improve test coverage for insert+splat; NFC

4 years ago[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc (2nd try)
Sanjay Patel [Fri, 13 Dec 2019 14:40:33 +0000 (09:40 -0500)]
[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc (2nd try)

The initial attempt (rG89633320) botched the logic by reversing
the source/dest types. Added x86 tests for additional coverage.
The vector tests show a potential improvement (fold vector load
instead of broadcasting), but that's a known/existing problem.

This fold is done in IR by instcombine, and we have a special
form of it already here in DAGCombiner, but we want the more
general transform too:
https://rise4fun.com/Alive/3jZm

Name: general
Pre: (C1 + zext(C2) < 64)
%s = lshr i64 %x, C1
%t = trunc i64 %s to i16
%r = lshr i16 %t, C2
=>
%s2 = lshr i64 %x, C1 + zext(C2)
%a = and i64 %s2, zext((1 << (16 - C2)) - 1)
%r = trunc %a to i16

Name: special
Pre: C1 == 48
%s = lshr i64 %x, C1
%t = trunc i64 %s to i16
%r = lshr i16 %t, C2
=>
%s2 = lshr i64 %x, C1 + zext(C2)
%r = trunc %s2 to i16

...because D58017 exposes a regression without this fold.

4 years ago[PGO][PGSO] Enable size optimizations in code gen / target passes for cold code.
Hiroshi Yamauchi [Thu, 7 Nov 2019 16:52:05 +0000 (08:52 -0800)]
[PGO][PGSO] Enable size optimizations in code gen / target passes for cold code.

Summary: Split off of D67120.

Reviewers: davidxl

Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Guard scudo_standalone's optional dependency on GWP-ASan behind flags.
Mitch Phillips [Fri, 13 Dec 2019 18:55:53 +0000 (10:55 -0800)]
[NFC] Guard scudo_standalone's optional dependency on GWP-ASan behind flags.

4 years ago[ARM] Fix in ICE when retrieving the number of micro-ops for vlldm/vlstm
Momchil Velikov [Fri, 13 Dec 2019 18:14:38 +0000 (18:14 +0000)]
[ARM] Fix in ICE when retrieving the number of micro-ops for vlldm/vlstm

The big switch in `ARMBaseInstrInfo::getNumMicroOps` is missing cases for
`VLLDM` and `VLSTM`, which are currently defined with itineraries having a
dynamic count of micro-ops.

Assuming an optimistic case in which these instruction do not actually perform
loads or stores, and with the idea that Armv8-m cores are supposed to use the
new style scheduling models, this patch just sets the itinerary for those two
instructions to `NoItinerary`.

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

4 years agogn docs: remove obsolete reference to monorepo
Nico Weber [Fri, 13 Dec 2019 18:03:55 +0000 (13:03 -0500)]
gn docs: remove obsolete reference to monorepo

4 years ago[lldb/Test] C++ test should use CXXFLAGS_EXTRAS
Jonas Devlieghere [Fri, 13 Dec 2019 17:49:51 +0000 (09:49 -0800)]
[lldb/Test] C++ test should use CXXFLAGS_EXTRAS

Thanks Ted Woodward for noticing this.

4 years ago[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_POSIX
Jonas Devlieghere [Thu, 12 Dec 2019 18:00:45 +0000 (10:00 -0800)]
[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_POSIX

Rename LLDB_DISABLE_POSIX to LLDB_ENABLE_POSIX and use cmakedefine01 for
consistency.

4 years ago[libomptarget] Build most of common/src for amdgcn
Jon Chesterfield [Fri, 13 Dec 2019 17:48:19 +0000 (17:48 +0000)]
[libomptarget] Build most of common/src for amdgcn

Summary:
[libomptarget] Build most of common/src for amdgcn

Excluding parallel.cu, which uses an integer min() from cuda,
Excluding support.cu, which calls malloc that is not yet available for amdgcn

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: gregrodgers, ronlieb, jvesely, mgorny, openmp-commits

Tags: #openmp

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

4 years ago[GWP-ASan] [Scudo] ifdef entire GWP-ASan tests.
Mitch Phillips [Fri, 13 Dec 2019 17:43:51 +0000 (09:43 -0800)]
[GWP-ASan] [Scudo] ifdef entire GWP-ASan tests.

Turns out that gtest in LLVM is only 1.8.0 (the newest version 1.10.0)
supports the GTEST_SKIP() macro, and apparently I didn't build w/o
GWP-ASan.

Should fix the GN bot, as well as any bots that may spuriously break on
platforms where the code wasn't correctly ifdef'd out as well.

4 years agoRevert "[ELF] Allow getErrPlace() to work before Out::bufferStart is set"
Vlad Tsyrklevich [Fri, 13 Dec 2019 17:43:51 +0000 (09:43 -0800)]
Revert "[ELF] Allow getErrPlace() to work before Out::bufferStart is set"

This reverts commit 2bbd32f5e8f0f62d895966e2623d9bdb9778b50b, it was
causing UBSan failures like the following:
lld/ELF/Target.cpp:103:41: runtime error: applying non-zero offset 24 to null pointer

4 years ago[AArch64] Emit PAC/BTI .note.gnu.property flags
Momchil Velikov [Fri, 13 Dec 2019 17:37:22 +0000 (17:37 +0000)]
[AArch64] Emit PAC/BTI .note.gnu.property flags

This patch make LLVM emit the processor specific program property types
defined in AArch64 ELF spec
https://developer.arm.com/docs/ihi0056/f/elf-for-the-arm-64-bit-architecture-aarch64-abi-2019q2-documentation

A file containing no functions gets both property flags.  Otherwise, a property
is set iff all the functions in the file have the corresponding attribute.

Patch by Daniel Kiss and Momchil Velikov.

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

4 years ago[MC][PowerPC] Fix a crash when redefining a symbol after .set
Fangrui Song [Fri, 13 Dec 2019 00:18:57 +0000 (16:18 -0800)]
[MC][PowerPC] Fix a crash when redefining a symbol after .set

Fix PR44284. This is probably not valid assembly but we should not crash.

Reviewed By: luporl, #powerpc, steven.zhang

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

4 years ago[ARM][MVE][Intrinsics] All vqdmulhq/vqrdmulhq tests should be for signed numbers.
Mark Murray [Fri, 13 Dec 2019 17:25:49 +0000 (17:25 +0000)]
[ARM][MVE][Intrinsics] All vqdmulhq/vqrdmulhq tests should be for signed numbers.

Fix broken tests. I can't yet explain how they worked locally pre-commit.

4 years ago[ARM][MVE] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D71062
Fangrui Song [Fri, 13 Dec 2019 17:26:15 +0000 (09:26 -0800)]
[ARM][MVE] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D71062

4 years ago[ELF] Update st_size when merging a common symbol with a shared symbol
Fangrui Song [Sat, 7 Dec 2019 05:18:31 +0000 (21:18 -0800)]
[ELF] Update st_size when merging a common symbol with a shared symbol

When a common symbol is merged with a shared symbol, increase st_size if
the shared symbol has a larger st_size. At runtime, the executable's
symbol overrides the shared symbol.  The shared symbol may be created
from common symbols in a previous link.  This rule makes sure we pick
the largest size among all common symbols.

This behavior matches GNU ld. See
https://sourceware.org/bugzilla/show_bug.cgi?id=25236 for discussions.

A shared symbol does not hold alignment constraints. Ignore the
alignment update.

Reviewed By: peter.smith

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

4 years ago[Scudo] [GWP-ASan] Add GWP-ASan to Scudo Standalone.
Mitch Phillips [Fri, 13 Dec 2019 17:09:34 +0000 (09:09 -0800)]
[Scudo] [GWP-ASan] Add GWP-ASan to Scudo Standalone.

Summary:
Adds GWP-ASan to Scudo standalone. Default parameters are pulled across from the
GWP-ASan build. No backtrace support as of yet.

Reviewers: cryptoad, eugenis, pcc

Reviewed By: cryptoad

Subscribers: merge_guards_bot, mgorny, #sanitizers, llvm-commits, cferris, vlad.tsyrklevich, pcc

Tags: #sanitizers, #llvm

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

4 years ago[ARM][MVE][Intrinsics] remove extraneous intrinsics. (Reapply)
Mark Murray [Fri, 13 Dec 2019 16:36:08 +0000 (16:36 +0000)]
[ARM][MVE][Intrinsics] remove extraneous intrinsics. (Reapply)

Summary:
I overstepped my reach and generated too many intrinsics; these never
made it into the tests.

Remove these extras. Some needed to be signed-olny, and there were some
possible but unrequired _x variants that needed an extra argument to
IntrinsicMX to allow [de-]selection at compile-time.

Reviewers: simon_tatham

Subscribers: kristof.beyls, dmgreen, cfe-commits

Tags: #clang

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

4 years agogn build: Merge 84728e65e95
LLVM GN Syncbot [Fri, 13 Dec 2019 16:20:43 +0000 (16:20 +0000)]
gn build: Merge 84728e65e95

4 years agoRevert "[ARM][MVE][Intrinsics] remove extraneous intrinsics."
Dmitri Gribenko [Fri, 13 Dec 2019 16:16:13 +0000 (17:16 +0100)]
Revert "[ARM][MVE][Intrinsics] remove extraneous intrinsics."

This reverts commit 0eb0992739189dba0d86af33722bc27260a9b555.

The code does not compile:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/20462

4 years ago[llvm-exegesis][mips] Add BenchmarkResultTest unit test
Miloš Stojanović [Fri, 13 Dec 2019 16:02:19 +0000 (17:02 +0100)]
[llvm-exegesis][mips] Add BenchmarkResultTest unit test

Test writing and reading benchmark instructions to and from disc, and
check calculations of min, max and avg values from a list of benchmark
measures.

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

4 years ago[clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.
Sam McCall [Wed, 11 Dec 2019 12:19:52 +0000 (13:19 +0100)]
[clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.

Summary:
The problem:

LSP specifies that Positions are between characters. Therefore when a position
(or an empty range) is used to target elements of the source code, there is an
ambiguity - should we look left or right of the cursor?

Until now, SelectionTree resolved this to the right except in trivial cases
(where there's whitespace, semicolon, or eof on the right).
This meant that it's unable to e.g. out-line `int foo^()` today.

Complicating this, LSP notwithstanding the cursor is *on* a character in many
editors (mostly terminal-based). In these cases there's no ambiguity - we must
"look right" - but there's also no way to tell in LSP.

(Several features currently resolve this by using getBeginningOfIdentifier,
which tries to rewind and supports end-of-identifier. But this relies on
raw lexing and is limited and buggy).

Precedent: well - most other languages aren't so full of densely packed symbols
that we might want to target. Bias-towards-identifier works well enough.
MS C++ for vscode seems to mostly use bias-toward-identifier too.
The problem with this solution is it doesn't provide any way to target some
things such as the constructor call in Foo^(bar());

Presented solution:

When an ambiguous selection is found, we generate *both* possible selection
trees. We try to run the feature on the rightward tree first, and then on the
leftward tree if it fails.

This is basically do-what-I-mean, the main downside is the need to do this on
a feature-by-feature basis (because each feature knows what "fail" means).
The most complicated instance of this is Tweaks, where the preferred selection
may vary tweak-by-tweak.

Wrinkles:

While production behavior is pretty consistent, this introduces some
inconsistency in testing, depending whether the interface we're testing is
inside or outside the "retry" wrapper.

In particular, for many features like Hover, the unit tests will show production
behavior, while for Tweaks the harness would have to run the loop itself if
we want this.

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

Tags: #clang

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

4 years ago[Tooling/Syntax] Helpers to find spelled tokens touching a location.
Sam McCall [Wed, 11 Dec 2019 14:40:23 +0000 (15:40 +0100)]
[Tooling/Syntax] Helpers to find spelled tokens touching a location.

Summary: Useful when positions are used to target nodes, with before/after ambiguity.

Reviewers: ilya-biryukov, kbobyrev

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[ARM][MVE][Intrinsics] remove extraneous intrinsics.
Mark Murray [Fri, 13 Dec 2019 14:54:23 +0000 (14:54 +0000)]
[ARM][MVE][Intrinsics] remove extraneous intrinsics.

Summary:
I overstepped my reach and generated too many intrinsics; these never
made it into the tests.

Remove these extras. Some needed to be signed-olny, and there were some
possible but unrequired _x variants that needed an extra argument to
IntrinsicMX to allow [de-]selection at compile-time.

Reviewers: simon_tatham

Subscribers: kristof.beyls, dmgreen, cfe-commits

Tags: #clang

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

4 years ago[ARM][MVE] Make VPT invalid for tail predication
Sam Parker [Wed, 11 Dec 2019 16:12:58 +0000 (16:12 +0000)]
[ARM][MVE] Make VPT invalid for tail predication

We've been marking VPT incompatible instructions as invalid for tail
predication too, though this may not strictly be true. VPT are
incompatible and, unless its the first predicate def in a loop,
they shouldn't be compatible for tail predication either.

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

4 years ago[llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%
Kristina Bessonova [Thu, 5 Dec 2019 13:45:57 +0000 (16:45 +0300)]
[llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%

Summary:
This is a follow up for D70548.
Currently, variables with debug info coverage between 0% and 1% are put into
zero-bucket. D70548 changed the way statistics calculate a variable's coverage:
we began to use enclosing scope rather than a possible variable life range.
Thus more variables might be moved to zero-bucket despite they have some debug
info coverage.
The patch is to distinguish between a variable that has location info but
it's significantly less than its enclosing scope and a variable that doesn't
have it at all.

Reviewers: djtodoro, aprantl, dblaikie, avl

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoReland [DataLayout] Fix occurrences that size and range of pointers are assumed to...
Nicola Zaghen [Fri, 13 Dec 2019 09:55:45 +0000 (09:55 +0000)]
Reland [DataLayout] Fix occurrences that size and range of pointers are assumed to be the same.

GEP index size can be specified in the DataLayout, introduced in D42123. However, there were still places
in which getIndexSizeInBits was used interchangeably with getPointerSizeInBits. This notably caused issues
with Instcombine's visitPtrToInt; but the unit tests was incorrect, so this remained undiscovered.

This fixes the buildbot failures.

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

Patch by Joseph Faulls!

4 years ago[libomptarget][nfc] Add nop syncwarp function for amdgcn
Jon Chesterfield [Fri, 13 Dec 2019 14:27:52 +0000 (14:27 +0000)]
[libomptarget][nfc] Add nop syncwarp function for amdgcn

4 years ago[x86] add tests for shift-trunc-shift; NFC
Sanjay Patel [Thu, 12 Dec 2019 23:19:57 +0000 (18:19 -0500)]
[x86] add tests for shift-trunc-shift; NFC

More coverage for a possible generic transform.

4 years ago[ARM][MVE] Add vector reduction intrinsics with two vector operands
Mikhail Maltsev [Fri, 13 Dec 2019 13:17:29 +0000 (13:17 +0000)]
[ARM][MVE] Add vector reduction intrinsics with two vector operands

Summary:
This patch adds intrinsics for the following MVE instructions:
* VABAV
* VMLADAV, VMLSDAV
* VMLALDAV, VMLSLDAV
* VRMLALDAVH, VRMLSLDAVH

Each of the above 4 groups has a corresponding new LLVM IR intrinsic,
since the instructions cannot be easily represented using
general-purpose IR operations.

Reviewers: simon_tatham, ostannard, dmgreen, MarkMurrayARM

Reviewed By: MarkMurrayARM

Subscribers: merge_guards_bot, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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