platform/upstream/llvm.git
6 years agoMake TestCompletion work on windows
Pavel Labath [Fri, 9 Mar 2018 14:32:16 +0000 (14:32 +0000)]
Make TestCompletion work on windows

The test I added in r327110 is failing on windows because of "import
pexpect". However, this import is no longer necessary as these tests
don't use pexpect anymore.

In fact, it seems that all TestCompletion tests are passing on windows
after this, so I enable all of them.

llvm-svn: 327133

6 years ago[x86][aarch64] ask the backend whether it has a vector blend instruction
Sebastian Pop [Fri, 9 Mar 2018 14:29:21 +0000 (14:29 +0000)]
[x86][aarch64] ask the backend whether it has a vector blend instruction

The code to match and produce more x86 vector blends was enabled for all
architectures even though the transform may pessimize the code for other
architectures that do not provide a vector blend instruction.

Added an aarch64 testcase to check that a VZIP instruction is generated instead
of byte movs.

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

llvm-svn: 327132

6 years ago[clangd] Fix failing lit test.
Haojian Wu [Fri, 9 Mar 2018 14:16:46 +0000 (14:16 +0000)]
[clangd] Fix failing lit test.

This test is missed in r327129.

llvm-svn: 327131

6 years ago[clangd-vscode] Add package-lock.json to .gitignore
Eric Liu [Fri, 9 Mar 2018 14:06:43 +0000 (14:06 +0000)]
[clangd-vscode] Add package-lock.json to .gitignore

llvm-svn: 327130

6 years ago[clangd] Use identifier range as the definition range.
Haojian Wu [Fri, 9 Mar 2018 14:00:34 +0000 (14:00 +0000)]
[clangd] Use identifier range as the definition range.

Summary: This also matches the range in symbol index.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 327129

6 years ago[llvm-mca] Move the logic that prints the summary into its own view. NFCI
Andrea Di Biagio [Fri, 9 Mar 2018 13:52:03 +0000 (13:52 +0000)]
[llvm-mca] Move the logic that prints the summary into its own view. NFCI

llvm-svn: 327128

6 years ago[clangd] Don't index template specializations.
Sam McCall [Fri, 9 Mar 2018 13:25:29 +0000 (13:25 +0000)]
[clangd] Don't index template specializations.

Summary:
These have different USRs than the underlying entity, but are not typically
interesting in their own right and can be numerous (e.g. generated traits).

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 327127

6 years ago[CMake] Properly conditionalize installation of lld libraries
David Zarzycki [Fri, 9 Mar 2018 13:09:36 +0000 (13:09 +0000)]
[CMake] Properly conditionalize installation of lld libraries

In what appears to be a copy-and-paste error, lld currently only
installs libraries if the lld tools are configured to build.

Instead, lld should allow the libraries to be installed even if the lld
tools are not being built. Additionally, if users want to only install
the tools and not the libraries, the LLVM way of doing that is by
checking for LLVM_INSTALL_TOOLCHAIN_ONLY.

This fixes PR35960.

llvm-svn: 327126

6 years ago[llvm-mca] Run clang-format on the source code. NFC
Andrea Di Biagio [Fri, 9 Mar 2018 12:50:42 +0000 (12:50 +0000)]
[llvm-mca] Run clang-format on the source code. NFC

llvm-svn: 327125

6 years ago[lld-link] Add support for /ignore:4037.
Nico Weber [Fri, 9 Mar 2018 12:41:04 +0000 (12:41 +0000)]
[lld-link] Add support for /ignore:4037.

Fixes PR36657.
https://reviews.llvm.org/D44286

llvm-svn: 327124

6 years ago[elf] Remove one copy of the section merging code
Pavel Labath [Fri, 9 Mar 2018 12:30:09 +0000 (12:30 +0000)]
[elf] Remove one copy of the section merging code

Summary:
Besides being superfluous, this double merging was actually wrong and
causing some sections to be added twice. The reason for that was that
the code assumes section IDs are unique in the section list, but this is
only true if all sections in the list come from the same object file.

Reviewers: fjricci, jankratochvil

Subscribers: emaste, lldb-commits, arichardson

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

llvm-svn: 327123

6 years ago[asan] Try to unbreak arm build bots by only running the test on
Dan Liew [Fri, 9 Mar 2018 12:26:29 +0000 (12:26 +0000)]
[asan] Try to unbreak arm build bots by only running the test on
x86_64 and x86_64H (and not in the iOS simulator) where it seems
to work. We need to properly fix the test when time permits.

llvm-svn: 327122

6 years agoTableGen: Add a defset statement
Nicolai Haehnle [Fri, 9 Mar 2018 12:24:42 +0000 (12:24 +0000)]
TableGen: Add a defset statement

Allows capturing a list of concrete instantiated defs.

This can be combined with foreach to create parallel sets of def
instantiations with less repetition in the source. This purpose is
largely also served by multiclasses, but in some cases multiclasses
can't be used.

The motivating example for this change is having a large set of
intrinsics, which are generated from the IntrinsicsBackend.td file
included by Intrinsics.td, and a corresponding set of instruction
selection patterns, which are generated via the backend's .td files.

Multiclasses cannot be used to eliminate the redundancy in this case,
because a multiclass cannot span both LLVM's common .td files and
the backend .td files at the same time.

Change-Id: I879e35042dceea542a5e6776fad23c5e0e69e76b

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

llvm-svn: 327121

6 years agoTableGen: Allow arbitrary list values as ranges of foreach
Nicolai Haehnle [Fri, 9 Mar 2018 12:24:30 +0000 (12:24 +0000)]
TableGen: Allow arbitrary list values as ranges of foreach

The changes to FieldInit are required to make field references (Def.field)
work inside a ForeachDeclaration: previously, Def.field wasn't resolved
immediately when Def was already a fully resolved DefInit.

Change-Id: I9875baec2fc5aac8c2b249e45b9cf18c65ae699b
llvm-svn: 327120

6 years agoTableGen: Remove unused ParseForeachMode
Nicolai Haehnle [Fri, 9 Mar 2018 12:24:20 +0000 (12:24 +0000)]
TableGen: Remove unused ParseForeachMode

Use the default ParseValueMode instead of ParseForeachMode when
parsing the rule

  ForeachDeclaration ::= ID '=' '[' ValueList ']'

because the only difference between the two is how an open brace '{'
is handled at the end. In the context of foreach, the 'in' keyword
will appear after the ForeachDeclaration, so this special handling
of '{' is not required.

Change-Id: I4d86bb73bab9ec26752e1273e5213df77cf28d1d
llvm-svn: 327119

6 years agoTableGen: More helpful error messages
Nicolai Haehnle [Fri, 9 Mar 2018 12:24:14 +0000 (12:24 +0000)]
TableGen: More helpful error messages

Change-Id: Ic78afd0cd765fdb4cf1b7ecfb6bba22653ce6d29
llvm-svn: 327118

6 years agoTableGen: add !isa operation
Nicolai Haehnle [Fri, 9 Mar 2018 12:24:06 +0000 (12:24 +0000)]
TableGen: add !isa operation

Change-Id: Iddb724c3ae706d82933a2d82c91d07e0e36b30e3

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

llvm-svn: 327117

6 years ago[DebugInfo/AccelTable] Fix inconsistency in getDIEOffset implementations
Pavel Labath [Fri, 9 Mar 2018 11:58:59 +0000 (11:58 +0000)]
[DebugInfo/AccelTable] Fix inconsistency in getDIEOffset implementations

Summary:
Even though the getDIEOffset offset function was common for the two
accelerator table implementations, it was doing two different things:
for the Apple tables, it was returning the die offset relative to the
start of the section, whereas for DWARF v5 tables, it was relative to
the start of the CU.

I resolve this by renaming the function to getDIESectionOffset to make
it obvious what the function returns, and change the DWARF
implementation to return the section offset. I also keep the CU-relative
accessor, but only in the DWARF implementation (there is no way to get
this information for the Apple tables). This was not caught by existing
tests because the hand-written inputs also erroneously used section
offsets instead of CU-relative ones.

While looking at this, I noticed that the Apple implementation was not
fully correct either -- the header contains a DIEOffsetBase field, which
should be added to offsets encoded with the DW_FORM_ref*** family, but
this was not being used. This went unnoticed because all current writers
set this field to zero anyway. I fix this as well and add a hand-written
test which demonstrates the issue.

Reviewers: JDevlieghere, dblaikie

Subscribers: aprantl, llvm-commits

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

llvm-svn: 327116

6 years ago[clang-tidy] fix header guard
Sam McCall [Fri, 9 Mar 2018 11:47:37 +0000 (11:47 +0000)]
[clang-tidy] fix header guard

llvm-svn: 327115

6 years ago[clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWith
Haojian Wu [Fri, 9 Mar 2018 10:47:14 +0000 (10:47 +0000)]
[clang-tidy] Add check: replace string::find(...) == 0 with absl::StartsWith

Patch by Niko Weh!

Reviewers: hokein

Subscribers: klimek, cfe-commits, ioeric, ilya-biryukov, ahedberg

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

llvm-svn: 327111

6 years agoMove option parsing out of the Args class
Pavel Labath [Fri, 9 Mar 2018 10:39:40 +0000 (10:39 +0000)]
Move option parsing out of the Args class

Summary:
The args class is used in plenty of places (a lot of them in the lower lldb
layers) for representing a list of arguments, and most of these places don't
care about option parsing. Moving the option parsing out of the class removes
the largest external dependency (there are a couple more, but these are in
static functions), and brings us closer to being able to move it to the
Utility module).

The new home for these functions is the Options class, which was already used
as an argument to the parse calls, so this just inverts the dependency between
the two.

The functions are themselves are mainly just copied -- the biggest functional
change I've made to them is to avoid modifying the input Args argument (getopt
likes to permute the argument vector), as it was weird to have another class
reorder the entries in Args class. So now the functions don't modify the input
arguments, and (for those where it makes sense) return a new Args vector
instead. I've also made the addition of a "fake arg0" (required for getopt
compatibility) an implementation detail rather than a part of interface.

While doing that I noticed that ParseForCompletion function was recording the
option indexes in the shuffled vector, but then the consumer was looking up the
entries in the unshuffled one. This manifested itself as us not being able to
complete "watchpoint set variable foo --" (because getopt would move "foo" to
the end). Surprisingly all other completions (e.g. "watchpoint set variable foo
--w") were not affected by this. However, I couldn't find a comprehensive test
for command argument completion, so I consolidated the existing tests and added
a bunch of new ones.

Reviewers: davide, jingham, zturner

Subscribers: lldb-commits

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

llvm-svn: 327110

6 years ago[LV] Fix vectorizer's isUniform() abuse triggers assert in SCEV
Renato Golin [Fri, 9 Mar 2018 10:31:31 +0000 (10:31 +0000)]
[LV] Fix vectorizer's isUniform() abuse triggers assert in SCEV

Fixes PR36311.

See more detailed analysis in
https://bugs.llvm.org/show_bug.cgi?id=36311.

isUniform() information is recomputed after LV started transforming the
underlying IR and that triggered an assert in SCEV.

From vectorizer's architectural perspective, such information, while
still useful in vector code gen, should not be recomputed after the
start of transforming the LLVM IR. Instead, we should collect and cache
such information during the analysis phase of LV and use the cached info
during code gen.

From the symptom perspective, this assert as it stands right now is not
very useful. Legality already rejected loops that would trigger the
assert. As such, commenting out the assert is NFC from vectorizer's
functionality perspective. On top of that, just above the assertion, we
check for unit-strided load/store or
gather scatter. Addresses can't be uniform below that check.

From vectorization theory point of view, we don't have to reject all
cases of stores to uniform addresses. Eventually, we should support
safe/profitable cases.

This patch resolves the issue by removing the useless assertion that is
invoking LAA's isUniform() that requires up-to-date DomTree ---- once
vector code gen starts modifying CFG, we don't have an up-to-date
DomTree.

Patch by Hideki Saito <hideki.saito@intel.com>.

llvm-svn: 327109

6 years ago[Support] Move syntax highlighting into support
Jonas Devlieghere [Fri, 9 Mar 2018 09:56:24 +0000 (09:56 +0000)]
[Support] Move syntax highlighting into support

Move the DWARF syntax highlighting into support. This has several
advantages, most notably that this makes the WithColor RAII wrapper
available outside libDebugInfo. Furthermore, several projects all have
their own code for handling colored output. This provides a place to
centralize it.

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

llvm-svn: 327108

6 years ago[AArch64] Fix use of a regex in the win-alloca.ll test. NFC.
Martin Storsjo [Fri, 9 Mar 2018 09:45:37 +0000 (09:45 +0000)]
[AArch64] Fix use of a regex in the win-alloca.ll test. NFC.

Check that the variable actually is the same as the one previously
matched.

llvm-svn: 327107

6 years ago[AMDGPU] Fixed V_DIV_FIXUP_F16 selection on GFX9
Stanislav Mekhanoshin [Fri, 9 Mar 2018 07:21:43 +0000 (07:21 +0000)]
[AMDGPU] Fixed V_DIV_FIXUP_F16 selection on GFX9

GFX9 should select opsel version.

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

llvm-svn: 327106

6 years agoCodeGen: simplify and validate exception personalities
Saleem Abdulrasool [Fri, 9 Mar 2018 07:06:42 +0000 (07:06 +0000)]
CodeGen: simplify and validate exception personalities

Simplify the dispatching for the personality routines.  This really had
no test coverage previously, so add test coverage for the various cases.
This turns out to be pretty complicated as the various languages and
models interact to change personalities around.

You really should feel bad for the compiler if you are using exceptions.
There is no reason for this type of cruelty.

llvm-svn: 327105

6 years ago[X86] Remove duplicate isel pattern. NFC
Craig Topper [Fri, 9 Mar 2018 05:42:44 +0000 (05:42 +0000)]
[X86] Remove duplicate isel pattern. NFC

llvm-svn: 327104

6 years agoRevert "[clang-doc] Setup clang-doc frontend framework"
Julie Hockett [Fri, 9 Mar 2018 03:47:18 +0000 (03:47 +0000)]
Revert "[clang-doc] Setup clang-doc frontend framework"

This reverts commit r327102, since it was breaking the linux-abi-test on
x86.

llvm-svn: 327103

6 years ago[clang-doc] Setup clang-doc frontend framework
Julie Hockett [Fri, 9 Mar 2018 03:16:39 +0000 (03:16 +0000)]
[clang-doc] Setup clang-doc frontend framework

Setting up the mapper part of the frontend framework for a clang-doc
tool. It creates a series of relevant matchers for declarations, and
uses the ToolExecutor to traverse the AST and extract the matching
declarations and comments. The mapper serializes the extracted
information to individual records for reducing and eventually doc
generation.

For a more detailed overview of the tool, see the design document on the
mailing list: http://lists.llvm.org/pipermail/cfe-dev/2017-December/056203.html

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

llvm-svn: 327102

6 years agoDon't treat .symver as a regular alias definition.
Rafael Espindola [Fri, 9 Mar 2018 03:13:37 +0000 (03:13 +0000)]
Don't treat .symver as a regular alias definition.

This patch starts simplifying the handling of .symver.

For now it just moves the responsibility for creating an alias down to
the streamer. With that the asm streamer can pass a .symver unchanged,
which is nice since gas cannot parse "foo@bar = zed".

In a followup I hope to move the handling down to the writer so that
we don't need special hacks for avoiding breaking names with @@@ on
windows.

llvm-svn: 327101

6 years agoAttempt to fix vecreduce-propagate-sd-flags.ll test.
Matt Morehouse [Fri, 9 Mar 2018 02:04:30 +0000 (02:04 +0000)]
Attempt to fix vecreduce-propagate-sd-flags.ll test.

Buildbots have been failing since r327079.

llvm-svn: 327100

6 years agoPR36645: Go looking for an appropriate array bound when constant-evaluating a
Richard Smith [Fri, 9 Mar 2018 02:00:01 +0000 (02:00 +0000)]
PR36645: Go looking for an appropriate array bound when constant-evaluating a
name of an array object.

llvm-svn: 327099

6 years ago[analyzer] MmapWriteExecChecker: Add support for mprotect().
Artem Dergachev [Fri, 9 Mar 2018 01:47:24 +0000 (01:47 +0000)]
[analyzer] MmapWriteExecChecker: Add support for mprotect().

mprotect() allows setting memory access flags similarly to mmap(),
causing similar security issues if these flags are needlessly broad.

Patch by David Carlier!

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

llvm-svn: 327098

6 years agoI added CFLAGS etc to one part of the project file I should not have.
Jason Molenda [Fri, 9 Mar 2018 01:43:18 +0000 (01:43 +0000)]
I added CFLAGS etc to one part of the project file I should not have.

llvm-svn: 327097

6 years ago[CFG] [analyzer] Add construction context for implicit constructor conversions.
Artem Dergachev [Fri, 9 Mar 2018 01:39:59 +0000 (01:39 +0000)]
[CFG] [analyzer] Add construction context for implicit constructor conversions.

Implicit constructor conversions such as A a = B() are represented by
surrounding the constructor for B() with an ImplicitCastExpr of
CK_ConstructorConversion kind, similarly to how explicit constructor conversions
are surrounded by a CXXFunctionalCastExpr. Support this syntax pattern when
extracting the construction context for the implicit constructor that
performs the conversion.

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

llvm-svn: 327096

6 years agoMore cleanups of debugserver project file and the libpmenergy/libpmsample
Jason Molenda [Fri, 9 Mar 2018 01:37:37 +0000 (01:37 +0000)]
More cleanups of debugserver project file and the libpmenergy/libpmsample
stuff.  Activate it when an internal SDK is selected.  Update the name of
the LDFLAGS to match the rest of the settings.  Update the default arch for
ios builds.

llvm-svn: 327095

6 years agoRevert "[ThinLTO] Keep available_externally symbols live"
Eric Christopher [Fri, 9 Mar 2018 01:25:18 +0000 (01:25 +0000)]
Revert "[ThinLTO] Keep available_externally symbols live"

This reverts commit r327041 and the followup attempts at fixing the testcase as they're still failing.

llvm-svn: 327094

6 years ago[X86] Remove SRAs from v16i8 multiply lowering on sse2 targets
Craig Topper [Fri, 9 Mar 2018 01:22:31 +0000 (01:22 +0000)]
[X86] Remove SRAs from v16i8 multiply lowering on sse2 targets

Previously we unpacked the even bytes of each input into the high byte of 16-bit elements then did an v8i16 arithmetic shift right by 8 bits to fill the upper bits of each word with sign bits. Then we did the v8i16 multiply and then masked to zero the upper 8-bits of each result. The similar was done for all the odd bytes. The results are then packed together with packuswb

Since we are masking each multiply result element to 8-bits, and those 8-bits are determined only by the lower 8-bits of each of the inputs, we don't need to fill the upper bits with sign bits. So we can just unpack into the low byte of each element and treat the upper bits as garbage. This is what gcc also does.

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

llvm-svn: 327093

6 years agoLowerDbgDeclare: ignore dbg.declares for allocas with volatile access
Adrian Prantl [Fri, 9 Mar 2018 00:45:04 +0000 (00:45 +0000)]
LowerDbgDeclare: ignore dbg.declares for allocas with volatile access

There is no point in lowering a dbg.declare describing an alloca that
has volatile loads or stores as users, since the alloca cannot be
elided. Lowering the dbg.declare will result in larger debug info that
may also have worse coverage than just describing the alloca.

rdar://problem/34496278

llvm-svn: 327092

6 years agoMark the -overlap tests are "UNSUPPORTED: android". Android test harness doesn't...
Kuba Mracek [Fri, 9 Mar 2018 00:41:29 +0000 (00:41 +0000)]
Mark the -overlap tests are "UNSUPPORTED: android". Android test harness doesn't know how to handle suppression files.

llvm-svn: 327091

6 years ago[DOXYGEN] Fix doxygen and content issues in mmintrin.h
Douglas Yung [Fri, 9 Mar 2018 00:38:51 +0000 (00:38 +0000)]
[DOXYGEN] Fix doxygen and content issues in mmintrin.h

- Fix instruction mappings/listings for various intrinsics

This patch was made by Craig Flores

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

llvm-svn: 327090

6 years ago[test] Skip a test which sporadically fails in its dsym variant
Vedant Kumar [Fri, 9 Mar 2018 00:34:43 +0000 (00:34 +0000)]
[test] Skip a test which sporadically fails in its dsym variant

There is a mailing list discussion re: r325927 about why this test fails
in the dsym variant. I've marked it skipped for now, until the issue is
resolved.

llvm-svn: 327089

6 years agoRemove unneeded per-arch sdk specifications from debugserver xcode project file.
Jason Molenda [Fri, 9 Mar 2018 00:32:56 +0000 (00:32 +0000)]
Remove unneeded per-arch sdk specifications from debugserver xcode project file.

llvm-svn: 327088

6 years agoRemove the explicit dependency on libpmenergy and libpmsample.
Jason Molenda [Fri, 9 Mar 2018 00:28:51 +0000 (00:28 +0000)]
Remove the explicit dependency on libpmenergy and libpmsample.

llvm-svn: 327087

6 years agoFix header comment on SHA1 code.
Eric Christopher [Fri, 9 Mar 2018 00:23:35 +0000 (00:23 +0000)]
Fix header comment on SHA1 code.

llvm-svn: 327086

6 years agoFixed two more sdk inconsistencies with the pmenergy stuff.
Jason Molenda [Fri, 9 Mar 2018 00:23:29 +0000 (00:23 +0000)]
Fixed two more sdk inconsistencies with the pmenergy stuff.

llvm-svn: 327085

6 years agoThree little cleanups in the debugserver xcode project file.
Jason Molenda [Fri, 9 Mar 2018 00:17:22 +0000 (00:17 +0000)]
Three little cleanups in the debugserver xcode project file.

1. Link against libpmenergy and pmsample unconditionally.  It is available on
macOS 10.10 ("Yosemite") and newer.  We're already linking against libcompression
unconditionally which is only available on macOS 10.11 & newer.

2. Change a few "sdk=macosx.internal"'s to sdk=macosx.

3. Clean up a few places where libcompression was being enabled inconsistently.

Note: the -DLLDB_ENERGY define is only set when building against the macosx.internal
SDK; it includes a header file that is not public.  We link against the dylibs
unconditionally for simplicity.

llvm-svn: 327084

6 years agoRevert "[DWARF] Fix mixing assembler -g with DWARF .file directives."
Paul Robinson [Fri, 9 Mar 2018 00:11:54 +0000 (00:11 +0000)]
Revert "[DWARF] Fix mixing assembler -g with DWARF .file directives."

This reverts commit d6d9ac1ab5039ba1fe0f63c36eac2bdd9f0a79c9.
aka r327073

llvm-svn: 327083

6 years agoutils: add a helper class to lit for captured substitutions
Saleem Abdulrasool [Fri, 9 Mar 2018 00:06:10 +0000 (00:06 +0000)]
utils: add a helper class to lit for captured substitutions

On Windows, if the substitution contains a back reference, it would
removed due to the replacement of the escape character in lit. Create a
helper class to avoid this which will simply ignore the replacement and
mark the substitution as having capture groups being referenced.

llvm-svn: 327082

6 years agoMark strcat-overlap.cc as "UNSUPPORTED: win32"
Kuba Mracek [Fri, 9 Mar 2018 00:03:09 +0000 (00:03 +0000)]
Mark strcat-overlap.cc as "UNSUPPORTED: win32"

llvm-svn: 327081

6 years agoMove lto-constmerge-odr.cc to Posix (it's failing on Windows).
Kuba Mracek [Thu, 8 Mar 2018 23:53:29 +0000 (23:53 +0000)]
Move lto-constmerge-odr.cc to Posix (it's failing on Windows).

llvm-svn: 327080

6 years agoPropagate flags to SDValue in SplitVecOp_VECREDUCE
Sameer AbuAsal [Thu, 8 Mar 2018 23:41:40 +0000 (23:41 +0000)]
Propagate flags to SDValue in SplitVecOp_VECREDUCE

 This patch is a fix for PR36642.

 While legalizing long vector types, make sure the smaller types get the
 flags of the wider type.

link: https://bugs.llvm.org/show_bug.cgi?id=36642
Change-Id: I0c2829639f094c862c10a6b51b342d4c2563e1fa
llvm-svn: 327079

6 years agoAdd a debug info testcase for the trvial_abi attribute.
Adrian Prantl [Thu, 8 Mar 2018 23:11:46 +0000 (23:11 +0000)]
Add a debug info testcase for the trvial_abi attribute.

llvm-svn: 327078

6 years agoFor llvm-objdump and Mach-O files, update the printing of some thread states
Kevin Enderby [Thu, 8 Mar 2018 23:10:38 +0000 (23:10 +0000)]
For llvm-objdump and Mach-O files, update the printing of some thread states
from core files.  I tested this against the couple of core files that were
getting errors about unknown thread flavors and it now produce the same output as
the Xcode otool-classic(1) tool.  Since the core files are huge I didn’t include
them as test cases.

rdar://38216356

llvm-svn: 327077

6 years agoamdgcn/fmax: fcanonicalize operands
Jan Vesely [Thu, 8 Mar 2018 23:01:01 +0000 (23:01 +0000)]
amdgcn/fmax: fcanonicalize operands

v_max instruction needs canonicalized operands.
Passes CTS on carrizo

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327076

6 years agoamdgcn/fmin: fcanonicalize operands
Jan Vesely [Thu, 8 Mar 2018 23:00:58 +0000 (23:00 +0000)]
amdgcn/fmin: fcanonicalize operands

v_min instruction needs canonicalized operands.
Passes CTS on carrizo

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327075

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Thu, 8 Mar 2018 22:45:13 +0000 (22:45 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 327074

6 years ago[DWARF] Fix mixing assembler -g with DWARF .file directives.
Paul Robinson [Thu, 8 Mar 2018 22:39:47 +0000 (22:39 +0000)]
[DWARF] Fix mixing assembler -g with DWARF .file directives.

We were effectively overriding an explicit '.file' directive with info
for the assembler source.  That shouldn't happen.

Fixes PR36636.

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

llvm-svn: 327073

6 years ago[DebugInfo] Add DW_AT_byte_size to vectors
Matt Davis [Thu, 8 Mar 2018 22:22:26 +0000 (22:22 +0000)]
[DebugInfo] Add DW_AT_byte_size to vectors

Summary:
This patch adds the DW_AT_byte_size dwarf attribute to vectors.
This fixes PR21924

LLVM will round a vector up to the next alignable address, which can result in
the vector's representation in the object file being larger than what the
debugger will calculate via NumberOfElements * ElementSize. In such a case calling sizeof(MyVec) in the source will result in a different value than what a debugger might present. This situation can occur because LLVM permits non-power of two 'vector_size' attributes.

Reviewers: echristo, dexonsmith, aprantl

Reviewed By: aprantl

Subscribers: probinson, aprantl, llvm-commits, JDevlieghere

Tags: #debug-info

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

llvm-svn: 327072

6 years ago[Reassociate] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 22:05:27 +0000 (22:05 +0000)]
[Reassociate] fix test to be independent of FP undef

llvm-svn: 327071

6 years ago[Support] Pacify -Wsign-compare in unit test.
Benjamin Kramer [Thu, 8 Mar 2018 21:54:30 +0000 (21:54 +0000)]
[Support] Pacify -Wsign-compare in unit test.

llvm-svn: 327070

6 years ago[TargetLowering] Remove redundant if condition in SimplifySetcc. NFC
Craig Topper [Thu, 8 Mar 2018 21:53:36 +0000 (21:53 +0000)]
[TargetLowering] Remove redundant if condition in SimplifySetcc. NFC

We were checking the condition code a second time when we were already in a block with this same condition code check.

llvm-svn: 327069

6 years ago[asan] Fix bug where suppression of overlapping accesses was ignored on
Dan Liew [Thu, 8 Mar 2018 21:50:22 +0000 (21:50 +0000)]
[asan] Fix bug where suppression of overlapping accesses was ignored on
`strcpy()`, `strncpy()`, `strcat()`, and `strncat()`.

rdar://problem/35576899

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

llvm-svn: 327068

6 years ago[DebugInfo] Move RangeListEntries instead of copying.
Benjamin Kramer [Thu, 8 Mar 2018 21:31:10 +0000 (21:31 +0000)]
[DebugInfo] Move RangeListEntries instead of copying.

This is needed for correctness as RangeListEntry is not copy-assignable,
which std::vector might rely on.

llvm-svn: 327067

6 years ago[AMDGPU] fix test to survive more FP undef constant folding
Sanjay Patel [Thu, 8 Mar 2018 21:30:56 +0000 (21:30 +0000)]
[AMDGPU] fix test to survive more FP undef constant folding

llvm-svn: 327066

6 years ago[NFC] Factor out a helper function for checking if a block has a potential early...
Philip Reames [Thu, 8 Mar 2018 21:25:30 +0000 (21:25 +0000)]
[NFC] Factor out a helper function for checking if a block has a potential early implicit exit.

llvm-svn: 327065

6 years agoLow-hanging fruit optimization in string::__move_assign().
Vedant Kumar [Thu, 8 Mar 2018 21:15:26 +0000 (21:15 +0000)]
Low-hanging fruit optimization in string::__move_assign().

shrink_to_fit() ends up doing a lot work to get information that we
already know since we just called clear(). This change seems concise
enough to be worth the couple extra lines and my benchmarks show that it
is indeed a pretty decent win. It looks like the same thing is going on
twice in __copy_assign_alloc(), but I didn't want to go overboard since
this is my first contribution to llvm/libc++.

Patch by Timothy VanSlyke!

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

llvm-svn: 327064

6 years agoFix compilation failure with MSVC.
Zachary Turner [Thu, 8 Mar 2018 21:07:30 +0000 (21:07 +0000)]
Fix compilation failure with MSVC.

llvm-svn: 327063

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler...
Kuba Mracek [Thu, 8 Mar 2018 21:02:52 +0000 (21:02 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part, take 3]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example.

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

llvm-svn: 327062

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part...
Kuba Mracek [Thu, 8 Mar 2018 21:02:18 +0000 (21:02 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part, take 3]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327061

6 years agoFix signed-unsigned comparison warning.
Zachary Turner [Thu, 8 Mar 2018 20:57:37 +0000 (20:57 +0000)]
Fix signed-unsigned comparison warning.

llvm-svn: 327060

6 years ago[DWARF v5] Support for verbose dumping of .debug_rnglist entries
Wolfgang Pieb [Thu, 8 Mar 2018 20:52:35 +0000 (20:52 +0000)]
[DWARF v5] Support for verbose dumping of .debug_rnglist entries

Adding verbose dumping to the recent implementation of dumping of v5 range list entries.
We're capturing the entries as is as they come in during extraction, including their file offset,
so we can dump them in more detail.
The offset table entries which are table-relative are shown as is (as in non-verbose mode)
and with the actual file offset they map to.

Reviewers: dblaikie, aprantl, jdevlieghere, jhenderson

Subscribers: llvm-commits

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

llvm-svn: 327059

6 years ago[ConstantFold] fp_binop undef, undef --> undef
Sanjay Patel [Thu, 8 Mar 2018 20:42:49 +0000 (20:42 +0000)]
[ConstantFold] fp_binop undef, undef --> undef

These are uncontroversial and independent of a proposed LangRef edits (D44216).

I tried to fix tests that would fold away:
rL327004
rL327028
rL327030
rL327034

I'm not sure if the Reassociate tests are meaningless yet, but they probably will be
as we add more folds, so if anyone has suggestions or wants to fix those, please do.

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

llvm-svn: 327058

6 years ago[Support] Add WriteThroughMemoryBuffer.
Zachary Turner [Thu, 8 Mar 2018 20:34:47 +0000 (20:34 +0000)]
[Support] Add WriteThroughMemoryBuffer.

This is like MemoryBuffer (read-only) and WritableMemoryBuffer
(writable private), but where the underlying file can be modified
after writing.  This is useful when you want to open a file, make
some targeted edits, and then write it back out.

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

llvm-svn: 327057

6 years ago[llvm-mca] Fix handling of zero-latency instructions.
Andrea Di Biagio [Thu, 8 Mar 2018 20:21:55 +0000 (20:21 +0000)]
[llvm-mca] Fix handling of zero-latency instructions.

This patch fixes a problem found when testing zero latency instructions on
target AArch64 -mcpu=exynos-m3 / -mcpu=exynos-m1.

On Exynos-m3/m1, direct branches are zero-latency instructions that don't consume
any processor resources.  The DispatchUnit marks zero-latency instructions as
"executed", so that no scheduling is required.  The event of instruction
executed is then notified to all the listeners, and the reorder buffer (managed
by the RetireControlUnit) is updated. In particular, the entry associated to the
zero-latency instruction in the reorder buffer is marked as executed.

Before this patch, the DispatchUnit forgot to assign a retire control unit token
(RCUToken) to the zero-latency instruction. As a consequence, the RCUToken was
used uninitialized. This was causing a crash in the RetireControlUnit logic.

Fixes PR36650.

llvm-svn: 327056

6 years agoRevert r327053.
Kuba Mracek [Thu, 8 Mar 2018 20:13:39 +0000 (20:13 +0000)]
Revert r327053.

llvm-svn: 327055

6 years ago[X86][AVX] Pull out variable permute creation from LowerBUILD_VECTORAsVariablePermute...
Simon Pilgrim [Thu, 8 Mar 2018 20:07:06 +0000 (20:07 +0000)]
[X86][AVX] Pull out variable permute creation from LowerBUILD_VECTORAsVariablePermute. NFCI.

This will make it easier to handle more complex cases than basic scaling or index masks.

llvm-svn: 327054

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part...
Kuba Mracek [Thu, 8 Mar 2018 20:05:45 +0000 (20:05 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part, take 2]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327053

6 years ago[test] Skip a test when using an out-of-tree debugserver
Vedant Kumar [Thu, 8 Mar 2018 19:46:39 +0000 (19:46 +0000)]
[test] Skip a test when using an out-of-tree debugserver

The test "test_fp_special_purpose_register_read" in TestRegisters.py
fails on Darwin machines configured to use an out-of-tree debugserver.

The error message is: 'register read ftag' returns expected result, got
'ftag = 0x80'. This indicates that the debugserver in use is too old.

This commit introduces a decorator which can be used to skip tests which
rely on having a just-built debugserver. This resolves the issue:

$ ./bin/llvm-dotest -p TestRegisters.py -v
  1 out of 617 test suites processed - TestRegisters.py
  Test Methods:          7
  Success:               6
  Skip:                  1
...

llvm-svn: 327052

6 years agoSpecify that test from r327041 requires asserts
Vlad Tsyrklevich [Thu, 8 Mar 2018 19:46:19 +0000 (19:46 +0000)]
Specify that test from r327041 requires asserts

llvm-svn: 327051

6 years agoFix detection of COFF executable files.
Zachary Turner [Thu, 8 Mar 2018 19:45:20 +0000 (19:45 +0000)]
Fix detection of COFF executable files.

One overload of this function would try to identify a file
by opening it and using the first 32 bytes to identify the magic
of the file.  This didn't work properly when more than 32 bytes
is actually needed for magic detection to succeed.  So now we
have this overload read in the entire file.

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

llvm-svn: 327050

6 years agoResubmit "Write a hash of the executable into the PE timestamp fields."
Zachary Turner [Thu, 8 Mar 2018 19:33:47 +0000 (19:33 +0000)]
Resubmit "Write a hash of the executable into the PE timestamp fields."

This fixes the broken tests that were causing failures.  The tests
before were verifying that the time stamp was 0, but now that we
are actually writing a timestamp, I just removed the match against
the timestamp value.

llvm-svn: 327049

6 years ago[DebugInfo] Add verifier for DICompositeType vector
Matt Davis [Thu, 8 Mar 2018 19:31:37 +0000 (19:31 +0000)]
[DebugInfo] Add verifier for DICompositeType vector

Summary:
This patch adds verification logic for DICompositeType vectors, ensuring that they only have one element, and that element is of type subrange.

This patch complements https://reviews.llvm.org/D44048

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 327048

6 years agoFix test failure introduced in r327041
Vlad Tsyrklevich [Thu, 8 Mar 2018 19:20:08 +0000 (19:20 +0000)]
Fix test failure introduced in r327041

The "Assertion: `...' failed" error message format is not identical
across platforms.

llvm-svn: 327047

6 years ago[MemorySSA] Split PtrIntPair as this fails on win/arm.
Alina Sbirlea [Thu, 8 Mar 2018 19:15:00 +0000 (19:15 +0000)]
[MemorySSA] Split PtrIntPair as this fails on win/arm.

Summary: Split PtrIntPair into Instruction and OptionalAlias<Result>. The latter needs 3 bits, which appear unavailable on certain archs.

Subscribers: sanjoy, jlebar, Prazek, llvm-commits, kristof.beyls

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

llvm-svn: 327046

6 years agoamdgcn,popcount: Workaround broken llvm.ctpop intrinsic on some GCN ASICs
Jan Vesely [Thu, 8 Mar 2018 18:58:07 +0000 (18:58 +0000)]
amdgcn,popcount: Workaround broken llvm.ctpop intrinsic on some GCN ASICs

This is only really needed for VI+ ASICs. However, llvm would cast the value to
i32 for older asics anyway. The proper fix is in LLVM-7 (r326535).
Fixes CTS popcount on carrizo.

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327044

6 years agointeger/gentype: Add __CLC_VECSIZE macro
Jan Vesely [Thu, 8 Mar 2018 18:58:05 +0000 (18:58 +0000)]
integer/gentype: Add __CLC_VECSIZE macro

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327043

6 years agopopcount: Provide function implementation rather than intrinsic redirect
Jan Vesely [Thu, 8 Mar 2018 18:58:00 +0000 (18:58 +0000)]
popcount: Provide function implementation rather than intrinsic redirect

amdgcn will need to override this

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327042

6 years ago[ThinLTO] Keep available_externally symbols live
Vlad Tsyrklevich [Thu, 8 Mar 2018 18:48:03 +0000 (18:48 +0000)]
[ThinLTO] Keep available_externally symbols live

Summary:
This change fixes PR36483. The bug was originally introduced by a change
that marked non-prevailing symbols dead. This broke LowerTypeTests
handling of available_externally functions, which are non-prevailing.
LowerTypeTests uses liveness information to avoid emitting thunks for
unused functions.

Marking available_externally functions dead is incorrect, the functions
are used though the function definitions are not. This change keeps them
live, and lets the EliminateAvailableExternally/GlobalDCE passes remove
them later instead.

I've also enabled EliminateAvailableExternally for all optimization
levels, I believe it being disabled for O1 was an oversight.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: grimar, mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 327041

6 years ago[OpenMP][libomptarget] Fix union.
Gheorghe-Teodor Bercea [Thu, 8 Mar 2018 18:44:02 +0000 (18:44 +0000)]
[OpenMP][libomptarget] Fix union.

Summary: To make the two parts of the union have the same size, the size of vect needs to be increased by 16 bits.

Reviewers: grokos, carlo.bertolli, caomhin, ABataev

Reviewed By: grokos, ABataev

Subscribers: fedor.sergeev, guansong, openmp-commits

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

llvm-svn: 327040

6 years ago[InstCombine] add min/max tests with not ops; NFC
Sanjay Patel [Thu, 8 Mar 2018 18:34:23 +0000 (18:34 +0000)]
[InstCombine] add min/max tests with not ops; NFC

These are based on:
https://bugs.llvm.org/show_bug.cgi?id=35875
It's not clear if/how instcombine can reduce these,
but we should have the tests here either way to
document current behavior.

llvm-svn: 327039

6 years agoMore revert of r327031
Kuba Mracek [Thu, 8 Mar 2018 18:20:03 +0000 (18:20 +0000)]
More revert of r327031

llvm-svn: 327038

6 years ago[Hexagon] Ignore indexed loads when handling unaligned loads
Krzysztof Parzyszek [Thu, 8 Mar 2018 18:15:13 +0000 (18:15 +0000)]
[Hexagon] Ignore indexed loads when handling unaligned loads

llvm-svn: 327037

6 years ago[Tests] Remove empty test file that causes the test suite to fail
David Zarzycki [Thu, 8 Mar 2018 18:03:15 +0000 (18:03 +0000)]
[Tests] Remove empty test file that causes the test suite to fail

This empty file was "created" by r327033, which attempted to revert
r327029, which introduced the file.

llvm-svn: 327036

6 years agoExpose must/may alias info in MemorySSA.
Alina Sbirlea [Thu, 8 Mar 2018 18:03:14 +0000 (18:03 +0000)]
Expose must/may alias info in MemorySSA.

Summary:
Building MemorySSA gathers alias information for Defs/Uses.
Store and expose this information when optimizing uses (when building MemorySSA),
and when optimizing defs or updating uses (getClobberingMemoryAccess).
Current patch does not propagate alias information through MemoryPhis.

Reviewers: gbiv, dberlin

Subscribers: Prazek, sanjoy, llvm-commits

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

llvm-svn: 327035

6 years ago[AMDGPU] fix test to survive the most basic undef constant folding
Sanjay Patel [Thu, 8 Mar 2018 17:34:25 +0000 (17:34 +0000)]
[AMDGPU] fix test to survive the most basic undef constant folding

This will likely need to be changed again for anything more than:
fmul undef, undef -> undef

llvm-svn: 327034

6 years agoRevert r327029
Kuba Mracek [Thu, 8 Mar 2018 17:32:00 +0000 (17:32 +0000)]
Revert r327029

llvm-svn: 327033

6 years agoRevert r327031
Kuba Mracek [Thu, 8 Mar 2018 17:31:31 +0000 (17:31 +0000)]
Revert r327031

llvm-svn: 327032

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler...
Kuba Mracek [Thu, 8 Mar 2018 17:24:47 +0000 (17:24 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327031

6 years ago[x86] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 17:24:30 +0000 (17:24 +0000)]
[x86] fix test to be independent of FP undef

llvm-svn: 327030