platform/upstream/llvm.git
6 years ago[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock
Vitaly Buka [Tue, 15 May 2018 01:39:25 +0000 (01:39 +0000)]
[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock

Reviewers: eugenis, dvyukov

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 332320

6 years ago[asan] Workaround to avoid hangs in Chromium tests
Vitaly Buka [Tue, 15 May 2018 01:39:13 +0000 (01:39 +0000)]
[asan] Workaround to avoid hangs in Chromium tests

Summary:
For some reasons on Chromium when we start leak checking we get own pid as 1.
After that we see threads with PPID:0 assuming that thread is dead in infinite
loop.

To resolve particularly this case and possible issues like this, when IsAlive check failed to detect thread status, we need to limit the number of SuspendAllThreads
iterations.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 332319

6 years ago[RISCV] Define FeatureRelax and shouldForceRelocation for RISCV linker relaxation
Shiva Chen [Tue, 15 May 2018 01:28:50 +0000 (01:28 +0000)]
[RISCV] Define FeatureRelax and shouldForceRelocation for RISCV linker relaxation

1. Deine FeatureRelax to enable/disable linker relaxation.

2. Define shouldForceRelocation to preserve relocation types even if the fixup
   can be resolved when linker relaxation enabled. This is necessary for
   correctness as offsets may change during relaxation.

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

llvm-svn: 332318

6 years ago[NFC] Add const to method signature
Max Kazantsev [Tue, 15 May 2018 01:21:56 +0000 (01:21 +0000)]
[NFC] Add const to method signature

llvm-svn: 332317

6 years ago[libFuzzer] deprecate equivalence_server
Kostya Serebryany [Tue, 15 May 2018 01:15:47 +0000 (01:15 +0000)]
[libFuzzer] deprecate equivalence_server

llvm-svn: 332316

6 years agoFix debug build by adding missing dependencies on libBinaryFormat
Sam Clegg [Tue, 15 May 2018 00:46:43 +0000 (00:46 +0000)]
Fix debug build by adding missing dependencies on libBinaryFormat

Debug BUILD_SHARED_LIBS build was broken by rL332305

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

llvm-svn: 332315

6 years ago[AST] Fix printing tag decl groups in decl contexts
Joel E. Denny [Tue, 15 May 2018 00:44:14 +0000 (00:44 +0000)]
[AST] Fix printing tag decl groups in decl contexts

For example, given:

  struct T1 {
    struct T2 *p0;
  };

-ast-print produced:

  struct T1 {
    struct T2;
    struct T2 *p0;
  };

Compiling that produces a warning that the first struct T2 declaration
does not declare anything.

Details:

A tag decl group is one or more decls that share a type specifier that
is a tag decl (that is, a struct/union/class/enum decl).  Within
functions, the parser builds such a tag decl group as part of a
DeclStmt.  However, in decl contexts, such as file scope or a member
list, the parser does not group together the members of a tag decl
group.  Previously, detection of tag decl groups during printing was
implemented but only if the tag decl was unnamed.  Otherwise, as in
the above example, the members of the group did not print together and
so sometimes introduced warnings.

This patch extends detection of tag decl groups in decl contexts to
any tag decl that is recorded in the AST as not free-standing.

Reviewed by: rsmith

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

llvm-svn: 332314

6 years ago[XRay][profiler] Part 2: XRay Function Call Trie
Dean Michael Berris [Tue, 15 May 2018 00:42:36 +0000 (00:42 +0000)]
[XRay][profiler] Part 2: XRay Function Call Trie

Summary:
This is part of the larger XRay Profiling Mode effort.

This patch implements a central data structure for capturing statistics
about XRay instrumented function call stacks. The `FunctionCallTrie`
type does the following things:

*  It keeps track of a shadow function call stack of XRay instrumented
   functions as they are entered (function enter event) and as they are
   exited (function exit event).

*  When a function is entered, the shadow stack contains information
   about the entry TSC, and updates the trie (or prefix tree)
   representing the current function call stack. If we haven't
   encountered this function call before, this creates a unique node for
   the function in this position on the stack. We update the list of
   callees of the parent function as well to reflect this newly found
   path.

*  When a function is exited, we compute statistics (TSC deltas,
   function call count frequency) for the associated function(s) up the
   stack as we unwind to find the matching entry event.

This builds upon the XRay `Allocator` and `Array` types in Part 1 of
this series of patches.

Depends on D45756.

Reviewers: echristo, pelikan, kpw

Reviewed By: kpw

Subscribers: llvm-commits, mgorny

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

llvm-svn: 332313

6 years ago[Debugify] Add -debugify-each for testing each pass in a pipeline
Vedant Kumar [Tue, 15 May 2018 00:29:27 +0000 (00:29 +0000)]
[Debugify] Add -debugify-each for testing each pass in a pipeline

This adds a -debugify-each mode to opt which, when enabled, wraps each
{Module,Function}Pass in a pipeline with logic to add, check, and strip
synthetic debug info for testing purposes.

This mode can be used to test complex pipelines for debug info bugs, or
to collect statistics about the number of debug values & locations lost
throughout various stages of a pipeline.

Patch by Son Tuan Vu!

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

llvm-svn: 332312

6 years ago[CommandLine] Error message for incorrect PositionalEatArgs usage
Keno Fischer [Mon, 14 May 2018 23:26:06 +0000 (23:26 +0000)]
[CommandLine] Error message for incorrect PositionalEatArgs usage

Summary:
bugpoint has several options specified as `PositionalEatArgs` to pass
options through to the underlying tool, e.g. `-tool-args`. The `-help`
message suggests the usage is: `-tool-args=<string>`. However, this is
misleading, because that's not how these arguments work. Rather than taking
a value, the option consumes all positional arguments until the next
recognized option (or all arguments if `--` is specified at some point).
To make this slightly clearer, instead print the help as:
```
  -tool-args <string>...                            - <tool arguments>...
```
Additionally, add an error if the user attempts to use a `PositionalEatArgs`
argument with a value, instead of silently ignoring it. Example:
```
./bin/bugpoint -tool-args=-mpcu=skylake-avx512
bugpoint: for the -tool-args option: This argument does not take a value.
    Instead, it consumes any positional arguments until the next recognized option.
```

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D46787

llvm-svn: 332311

6 years agoEnable control flow pruning of float overflow warnings.
Richard Trieu [Mon, 14 May 2018 23:21:48 +0000 (23:21 +0000)]
Enable control flow pruning of float overflow warnings.

Like other conversion warnings, allow float overflow warnings to be disabled
in known dead paths of template instantiation.  This often occurs when a
template template type is a numeric type and the template will check the
range of the numeric type before performing the conversion.

llvm-svn: 332310

6 years ago[SCEVAffinator] Fix handling of pwaff complexity limit.
Eli Friedman [Mon, 14 May 2018 23:05:43 +0000 (23:05 +0000)]
[SCEVAffinator] Fix handling of pwaff complexity limit.

nullptr is not a valid affine expression, and none of the callers check
for null, so we eventually hit an isl error and crash.

Instead, invalidate the scop and return a constant zero.

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

llvm-svn: 332309

6 years ago[WebAssembly] Allow signautre of entry function to be flexible
Sam Clegg [Mon, 14 May 2018 23:01:16 +0000 (23:01 +0000)]
[WebAssembly] Allow signautre of entry function to be flexible

Since we a no longer using this function for the wasm start
section we don't actually care what its signature is.

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

llvm-svn: 332308

6 years ago[c++17] Fix assertion on synthesizing deduction guides after a fatal error.
Volodymyr Sapsai [Mon, 14 May 2018 22:49:44 +0000 (22:49 +0000)]
[c++17] Fix assertion on synthesizing deduction guides after a fatal error.

After a fatal error Sema::InstantiatingTemplate doesn't allow further
instantiation and doesn't push a CodeSynthesisContext. When we tried to
synthesize implicit deduction guides from constructors we hit the
assertion

> Assertion failed: (!CodeSynthesisContexts.empty() && "Cannot perform an instantiation without some context on the " "instantiation stack"), function SubstType, file clang/lib/Sema/SemaTemplateInstantiate.cpp, line 1580.

Fix by avoiding deduction guide synthesis if InstantiatingTemplate is invalid.

rdar://problem/39051732

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 332307

6 years ago[WebAssembly] Update to match llvm changes
Sam Clegg [Mon, 14 May 2018 22:42:33 +0000 (22:42 +0000)]
[WebAssembly] Update to match llvm changes

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 332306

6 years ago[WebAssembly] Move toString helpers to BinaryFormat
Sam Clegg [Mon, 14 May 2018 22:42:07 +0000 (22:42 +0000)]
[WebAssembly] Move toString helpers to BinaryFormat

Subscribers: dschuff, mgorny, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 332305

6 years agoRevert "[Option] Fix PR37006 prefix choice in findNearest"
Brian Gesiak [Mon, 14 May 2018 22:36:47 +0000 (22:36 +0000)]
Revert "[Option] Fix PR37006 prefix choice in findNearest"

Summary:
This revision causes build failures in PS4 and ppc64le buildbots (for example,
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/29988).
I'll revert for now and try to diagnose the issue.

Test Plan: check-llvm check-clang

llvm-svn: 332304

6 years ago[analyzer] Re-apply r331096 "CStringChecker: Add support for BSD strlcpy()...".
Artem Dergachev [Mon, 14 May 2018 22:32:24 +0000 (22:32 +0000)]
[analyzer] Re-apply r331096 "CStringChecker: Add support for BSD strlcpy()...".

Fixed after revert in r331401.

Patch by David Carlier!

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

llvm-svn: 332303

6 years ago[InstCombine] fix crash due to ignored addrspacecast
Keno Fischer [Mon, 14 May 2018 22:05:01 +0000 (22:05 +0000)]
[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue https://github.com/JuliaLang/julia/issues/27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722

llvm-svn: 332302

6 years ago[AArch64] enhance test to show FMF loss; NFC
Sanjay Patel [Mon, 14 May 2018 21:53:21 +0000 (21:53 +0000)]
[AArch64] enhance test to show FMF loss; NFC

llvm-svn: 332301

6 years ago[analyzer] Extend the ObjCAutoreleaseWriteChecker to warn on captures as well
George Karpenkov [Mon, 14 May 2018 21:39:54 +0000 (21:39 +0000)]
[analyzer] Extend the ObjCAutoreleaseWriteChecker to warn on captures as well

A common pattern is that the code in the block does not write into the
variable explicitly, but instead passes it to a helper function which
performs the write.

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

llvm-svn: 332300

6 years ago[Option] Fix PR37006 prefix choice in findNearest
Brian Gesiak [Mon, 14 May 2018 21:35:00 +0000 (21:35 +0000)]
[Option] Fix PR37006 prefix choice in findNearest

Summary:
In https://bugs.llvm.org/show_bug.cgi?id=37006 Nico Weber points out a
flaw in `OptTable::findNearest`: if an option "foo"'s prefixes are "--"
and "-", then the nearest option for "--fob" will be "-foo". This is
incorrect, however, since the function is expected to return "--foo".

The bug is due to a naive loop that attempts to predetermines which
prefix is best. Instead, compute the edit distance for each prefix/name
pair.

Test Plan: `check-llvm`

Reviewers: thakis

Reviewed By: thakis

Subscribers: llvm-commits

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

llvm-svn: 332299

6 years ago[ARM] Back up R4 and LR if calling the stack probe function
Martin Storsjo [Mon, 14 May 2018 21:32:52 +0000 (21:32 +0000)]
[ARM] Back up R4 and LR if calling the stack probe function

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

llvm-svn: 332298

6 years ago[llvm-rc] Add missing inputs for tag-icon-cursor.test.
Martin Storsjo [Mon, 14 May 2018 21:32:47 +0000 (21:32 +0000)]
[llvm-rc] Add missing inputs for tag-icon-cursor.test.

This adds the missing input files used for this test, except for
the separate input files for specific error cases; matching
test input files were provided by Nico Weber.

The extra copying of files into the %t directory doesn't seem to
be necessary since that directory only ever is used for output here,
not for inputs.

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

llvm-svn: 332297

6 years ago[CodeView] Improve debugging of virtual base class member variables
Brock Wyma [Mon, 14 May 2018 21:21:22 +0000 (21:21 +0000)]
[CodeView] Improve debugging of virtual base class member variables

Initial support for passing the virtual base pointer offset to CodeViewDebug.

https://reviews.llvm.org/D46271

llvm-svn: 332296

6 years ago[PowerPC] add more tests for FMF propagation; NFC
Sanjay Patel [Mon, 14 May 2018 21:17:49 +0000 (21:17 +0000)]
[PowerPC] add more tests for FMF propagation; NFC

llvm-svn: 332295

6 years agoFix test fail on some buildbots, caused by r332281.
Joel E. Denny [Mon, 14 May 2018 21:06:04 +0000 (21:06 +0000)]
Fix test fail on some buildbots, caused by r332281.

llvm-svn: 332294

6 years ago[lit] Fix several tests that fail when using Python 3 or on Windows
Stella Stamenova [Mon, 14 May 2018 21:04:24 +0000 (21:04 +0000)]
[lit] Fix several tests that fail when using Python 3 or on Windows

Summary:
1) In logtest.cpp, the name of the file that is reported is not always capitalized, so split the comparison to validate the file (case insensitive) and function (case sensitive) separately
2) Update the gdb remote client tests to work with Python 3. In Python 3, socket sends/receives data as bytes rather than byte strings. This also updates the usage of .hex() - this is no longer available in Python 3, so use hexlify instead

Reviewers: asmith, labath, zturner

Reviewed By: labath

Subscribers: llvm-commits

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

llvm-svn: 332293

6 years ago[Hexagon] Add a target feature to control using small data section
Krzysztof Parzyszek [Mon, 14 May 2018 21:01:56 +0000 (21:01 +0000)]
[Hexagon] Add a target feature to control using small data section

llvm-svn: 332292

6 years agoFix regression in r332076.
Richard Smith [Mon, 14 May 2018 20:52:48 +0000 (20:52 +0000)]
Fix regression in r332076.

If the name after 'template' is an unresolved using declaration (not containing
'typename'), then we don't yet know if it's a valid template-name, so don't
reject it prior to instantiation. Instead, treat it as naming a dependent
member of the current instantiation.

llvm-svn: 332291

6 years ago[Hexagon] Add a target feature for generating new-value stores
Krzysztof Parzyszek [Mon, 14 May 2018 20:41:04 +0000 (20:41 +0000)]
[Hexagon] Add a target feature for generating new-value stores

llvm-svn: 332290

6 years ago[DWARF] Factor out a DWARFUnitHeader class. NFC
Paul Robinson [Mon, 14 May 2018 20:32:31 +0000 (20:32 +0000)]
[DWARF] Factor out a DWARFUnitHeader class. NFC

Extract information related to a "unit header" from DWARFUnit into a
new DWARFUnitHeader class, and add a DWARFUnit member for the header.
This is one step in the direction of allowing type units in the
.debug_info section for DWARF v5.

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

llvm-svn: 332289

6 years agoRemove the fixit for the diagnostics regarding capturing autoreleasing variables...
George Karpenkov [Mon, 14 May 2018 20:29:16 +0000 (20:29 +0000)]
Remove the fixit for the diagnostics regarding capturing autoreleasing variables in a block

The fixit is actively harmful, as it encourages developers to ignore the
warning and to write unsafe code.
It is almost impossible to write safe code while capturing autoreleasing
variables in the block, as in order to check that the block is never
called in the autoreleasing pool the developer has to check the
transitive closure of all potential callers of the block.

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

llvm-svn: 332288

6 years ago[Tooling] Pull #include manipulation code from clangFormat into libToolingCore.
Eric Liu [Mon, 14 May 2018 20:17:53 +0000 (20:17 +0000)]
[Tooling] Pull #include manipulation code from clangFormat into libToolingCore.

Summary: Also pull #include related style out of FormatStyle as tooling::IncludeStyle.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, mgorny, cfe-commits, djasper

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

llvm-svn: 332287

6 years agoPR37450: Fix bug that disabled some type checks for variables with deduced types.
Richard Smith [Mon, 14 May 2018 20:15:04 +0000 (20:15 +0000)]
PR37450: Fix bug that disabled some type checks for variables with deduced types.

Also improve diagnostic for the case where a type is non-literal because it's a lambda.

llvm-svn: 332286

6 years ago[Hexagon] Add a target feature for memop generation
Krzysztof Parzyszek [Mon, 14 May 2018 20:09:07 +0000 (20:09 +0000)]
[Hexagon] Add a target feature for memop generation

llvm-svn: 332285

6 years ago[clang-format] Move #include related style to libToolingCore
Eric Liu [Mon, 14 May 2018 19:51:33 +0000 (19:51 +0000)]
[clang-format] Move #include related style to libToolingCore

Summary: This will be shared by include insertion/deletion library.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, klimek, cfe-commits

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

llvm-svn: 332284

6 years agoHexagon: Put relocations after instructions not packets.
Sid Manning [Mon, 14 May 2018 19:46:08 +0000 (19:46 +0000)]
Hexagon: Put relocations after instructions not packets.

Change relocation output so that relocation information follows
individual instructions rather than clustering them at the end
of packets.

This change required shifting block of code but the actual change
is in HexagonPrettyPrinter's PrintInst.

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

llvm-svn: 332283

6 years agoUpdate XFAIL so apple-clang-9.0 is the last version not implementing Core 2094.
Volodymyr Sapsai [Mon, 14 May 2018 19:45:24 +0000 (19:45 +0000)]
Update XFAIL so apple-clang-9.0 is the last version not implementing Core 2094.

The test is passing with apple-clang-9.1. rdar://problem/40222003

llvm-svn: 332282

6 years ago[AST] Print correct tag decl for tag specifier
Joel E. Denny [Mon, 14 May 2018 19:36:45 +0000 (19:36 +0000)]
[AST] Print correct tag decl for tag specifier

For example, given:

  void fn() {
    struct T *p0;
    struct T { int i; } *p1;
  }

-ast-print produced:

  void fn() {
    struct T { int i; } *p0;
    struct T { int i; } *p1;
  }

Compiling that fails with a redefinition error.

Given:

  void fn() {
    struct T *p0;
    struct __attribute__((deprecated)) T *p1;
  }

-ast-print dropped the attribute.

Details:

For a tag specifier (that is, struct/union/class/enum used as a type
specifier in a declaration) that was also a tag declaration (that is,
first occurrence of the tag) or tag redeclaration (that is, later
occurrence that specifies attributes or a member list), clang printed
the tag specifier as either (1) the full tag definition if one
existed, or (2) the first tag declaration otherwise.  Redefinition
errors were sometimes introduced, as in the first example above.  Even
when that was impossible because no member list was ever specified,
attributes were sometimes lost, thus changing semantics and
diagnostics, as in the second example above.

This patch fixes a major culprit for these problems.  It does so by
creating an ElaboratedType with a new OwnedDecl member wherever an
occurrence of a tag type is a (re)declaration of that tag type.
PrintingPolicy's IncludeTagDefinition used to trigger printing of the
member list, attributes, etc. for a tag specifier by using a tag
(re)declaration selected as described above.  Now, it triggers the
same thing except it uses the tag (re)declaration stored in the
OwnedDecl.  Of course, other tooling can now make use of the new
OwnedDecl as well.

Also, to be more faithful to the original source, this patch
suppresses printing of attributes inherited from previous
declarations.

Reviewed by: rsmith, aaron.ballman

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

llvm-svn: 332281

6 years agoInline a few CMake variables into their only uses.
Nico Weber [Mon, 14 May 2018 19:23:31 +0000 (19:23 +0000)]
Inline a few CMake variables into their only uses.

No behavior change. Makes unittests CMakeLists.txt files more self-consistent.

llvm-svn: 332280

6 years agoCodeGen: Emit string literal in constant address space
Yaxun Liu [Mon, 14 May 2018 19:20:12 +0000 (19:20 +0000)]
CodeGen: Emit string literal in constant address space

Some targets have constant address space (e.g. amdgcn). For them string literal should be
emitted in constant address space then casted to default address space.

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

llvm-svn: 332279

6 years agoRemove a workaround that should be unneeded after r202806.
Nico Weber [Mon, 14 May 2018 19:13:23 +0000 (19:13 +0000)]
Remove a workaround that should be unneeded after r202806.

llvm-svn: 332278

6 years ago[Documentation] Alphabetical order of new checks in Release Notes.
Eugene Zelenko [Mon, 14 May 2018 19:12:40 +0000 (19:12 +0000)]
[Documentation] Alphabetical order of new checks in Release Notes.

llvm-svn: 332277

6 years agoRevert "[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock"
Vitaly Buka [Mon, 14 May 2018 18:53:13 +0000 (18:53 +0000)]
Revert "[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock"

Tsan tests fail.

This reverts commit r332268

llvm-svn: 332276

6 years ago[AST] Fix -ast-print for _Bool when have diagnostics
Joel E. Denny [Mon, 14 May 2018 18:41:44 +0000 (18:41 +0000)]
[AST] Fix -ast-print for _Bool when have diagnostics

For example, given:

  #define bool _Bool
  _Bool i;
  void fn() { 1; }

-ast-print produced:

  tmp.c:3:13: warning: expression result unused
  void fn() { 1; }
              ^
  bool i;
  void fn() {
      1;
  }

That fails to compile because bool is undefined.

Details:

Diagnostics print _Bool as bool when the latter is defined as the
former.  However, diagnostics were altering the printing policy for
-ast-print as well.  The printed source was then invalid because the
preprocessor eats the bool definition.

Problematic diagnostics included suppressed warnings (e.g., add
-Wno-unused-value to the above example), including those that are
suppressed by default.

This patch fixes this bug and cleans up some related comments.

Reviewed by: aaron.ballman, rsmith

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

llvm-svn: 332275

6 years ago[X86] Add NT load/store scheduler classes
Simon Pilgrim [Mon, 14 May 2018 18:37:19 +0000 (18:37 +0000)]
[X86] Add NT load/store scheduler classes

llvm-svn: 332274

6 years agoCOFF: Allow ICFing sections with different alignments.
Peter Collingbourne [Mon, 14 May 2018 18:36:51 +0000 (18:36 +0000)]
COFF: Allow ICFing sections with different alignments.

The combined section gets the maximum alignment of all sections.

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

llvm-svn: 332273

6 years agoalphabetize list
Nico Weber [Mon, 14 May 2018 18:23:05 +0000 (18:23 +0000)]
alphabetize list

llvm-svn: 332272

6 years ago[X86] Remove and autoupgrade avx512.vbroadcast.ss/avx512.vbroadcast.sd intrinsics.
Craig Topper [Mon, 14 May 2018 18:21:22 +0000 (18:21 +0000)]
[X86] Remove and autoupgrade avx512.vbroadcast.ss/avx512.vbroadcast.sd intrinsics.

llvm-svn: 332271

6 years ago[llvm-mca][X86] Add missing SSE4A test file
Simon Pilgrim [Mon, 14 May 2018 18:20:40 +0000 (18:20 +0000)]
[llvm-mca][X86] Add missing SSE4A test file

llvm-svn: 332270

6 years ago[X86][BtVer2] Fix MMX/YMM integer vector nt store schedules
Simon Pilgrim [Mon, 14 May 2018 18:07:28 +0000 (18:07 +0000)]
[X86][BtVer2] Fix MMX/YMM integer vector nt store schedules

MMX was missing and YMM was tagged as a fp nt store

llvm-svn: 332269

6 years ago[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock
Vitaly Buka [Mon, 14 May 2018 18:03:34 +0000 (18:03 +0000)]
[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock

Reviewers: eugenis, dvyukov

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 332268

6 years ago[X86] Remove GCCBuiltin from the intrinsics that clang stopped using in r332266.
Craig Topper [Mon, 14 May 2018 18:02:21 +0000 (18:02 +0000)]
[X86] Remove GCCBuiltin from the intrinsics that clang stopped using in r332266.

Add a FIXME for their eventual removal.

llvm-svn: 332267

6 years ago[X86] Use __builtin_convertvector to replace some of the avx512 truncate builtins.
Craig Topper [Mon, 14 May 2018 17:50:40 +0000 (17:50 +0000)]
[X86] Use __builtin_convertvector to replace some of the avx512 truncate builtins.

As long as the destination type is a 256 or 128 bit vector with the same number of elements we can use __builtin_convertvector to directly generate trunc IR instruction which will be handled natively by the backend.

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

llvm-svn: 332266

6 years ago[BranchFolding] Allow hoisting to block with a single conditional branch.
Geoff Berry [Mon, 14 May 2018 17:31:18 +0000 (17:31 +0000)]
[BranchFolding] Allow hoisting to block with a single conditional branch.

Summary:
The BranchFolding pass is currently missing opportunities to hoist
common code if the hoisted-to block contains a single conditional branch
that has register uses.  This occurs somewhat frequently on AArch64 with
CBZ/TBZ opcodes.

This change also eliminates some code differences when debug info is
present since the presence of e.g. DBG_VALUE instructions in the
hoisted-to block can enable hoisting that wouldn't have occurred without
them.

Reviewers: MatzeB, rnk, kparzysz, twoh, aprantl, javed.absar

Subscribers: kristof.beyls, JDevlieghere, mcrosier, llvm-commits

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

llvm-svn: 332265

6 years ago[llvm-mca][x86] Add scalar nt-store instruction tests
Simon Pilgrim [Mon, 14 May 2018 17:10:33 +0000 (17:10 +0000)]
[llvm-mca][x86] Add scalar nt-store instruction tests

llvm-svn: 332262

6 years agoRevert "Remove Process references from the Host module"
Pavel Labath [Mon, 14 May 2018 16:54:53 +0000 (16:54 +0000)]
Revert "Remove Process references from the Host module"

The first fix wasn't enough, there is still a missing
ProcessInstanceInfo include in Host.mm. I won't be able to test a fix
before leaving work, so I am reverting both commits.

This reverts commit r332250 and the subsequent fix attempt.

llvm-svn: 332261

6 years ago[Hexagon] Avoid predicate copies to integer registers from store-locked
Krzysztof Parzyszek [Mon, 14 May 2018 16:41:40 +0000 (16:41 +0000)]
[Hexagon] Avoid predicate copies to integer registers from store-locked

llvm-svn: 332260

6 years ago[ELF][PPC64] Fix getRelExpr for R_PPC64_REL64
Zaara Syeda [Mon, 14 May 2018 16:39:45 +0000 (16:39 +0000)]
[ELF][PPC64] Fix getRelExpr for R_PPC64_REL64

The relocation R_PPC64_REL64 should return R_PC for getRelExpr since it
computes S + A - P.

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

llvm-svn: 332259

6 years ago[mips] Fix the predicates of round, ceiling, floor and trunc.
Simon Dardis [Mon, 14 May 2018 16:26:50 +0000 (16:26 +0000)]
[mips] Fix the predicates of round, ceiling, floor and trunc.

Reviewers: atanasyan, abeserminji, smaksimovic

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

llvm-svn: 332258

6 years ago[llvm-mca][x86] Add and/not/or/xor instruction tests
Simon Pilgrim [Mon, 14 May 2018 16:26:24 +0000 (16:26 +0000)]
[llvm-mca][x86] Add and/not/or/xor instruction tests

llvm-svn: 332257

6 years ago[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free
Aleksei Sidorin [Mon, 14 May 2018 16:12:31 +0000 (16:12 +0000)]
[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free

This is a workaround for the issue in buildASTFromCodeWithArgs()
where a local buffer can be used to store the program text
referred by SourceManager.
FIXME: Fix the root issue in buildASTFromCodeWithArgs().

llvm-svn: 332256

6 years agoFix macosx build broken by r332250
Pavel Labath [Mon, 14 May 2018 16:01:49 +0000 (16:01 +0000)]
Fix macosx build broken by r332250

llvm-svn: 332255

6 years agoFix another case where libstdc++ is being inappropriately requested (see
Dan Liew [Mon, 14 May 2018 15:48:49 +0000 (15:48 +0000)]
Fix another case where libstdc++ is being inappropriately requested (see
r328775) for all platforms.

Given that this is the second occurance of this problem it seemed worth
fixing this problem in a more generic way. r328775 has been reverted and
now a substitution `%linux_static_libstdcplusplus` has been provided.
This substitution expands to Clang driver arguments to use a static
libstdc++ on Linux and on all other platforms it expands to nothing.

The `asan/TestCases/throw_invoke_test.cc` and
`test/tsan/static_init6.cc` test cases now use this substitution.

rdar://problem/39948818

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

llvm-svn: 332254

6 years ago[NFC] [Power] Fix instruction format for xsrqpi
Zaara Syeda [Mon, 14 May 2018 15:45:15 +0000 (15:45 +0000)]
[NFC] [Power] Fix instruction format for xsrqpi

xsrqpi is currently using Z23Form_1.
The instruction format is xsrqpi R,VRT,VRB,RMC.
Rathar than bits 11-15 being used for FRA, it should have
bits 11-14 reserved and bit 15 for R. This patch adds a new
class Z23Form_4 to fix the instruction format.

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

llvm-svn: 332253

6 years ago[ELF][PPC64] Fix getRelExpr for R_PPC64_REL32
Zaara Syeda [Mon, 14 May 2018 15:26:44 +0000 (15:26 +0000)]
[ELF][PPC64] Fix getRelExpr for R_PPC64_REL32

The relocation R_PPC64_REL32 should return R_PC for getRelExpr since it
computes S + A - P.

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

llvm-svn: 332252

6 years ago[AArch64] Improve single vector lane stores
Evandro Menezes [Mon, 14 May 2018 15:26:35 +0000 (15:26 +0000)]
[AArch64] Improve single vector lane stores

When storing the 0th lane of a vector, use a simpler and usually more efficient scalar store instead.

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

llvm-svn: 332251

6 years agoRemove Process references from the Host module
Pavel Labath [Mon, 14 May 2018 15:13:13 +0000 (15:13 +0000)]
Remove Process references from the Host module

The Process class was only being referenced because of the last-ditch
effort in the process launchers to set a process death callback in case
one isn't set already.

Although launching a process for debugging is the most important kind of
"launch" we are doing, it is by far not the only one, so assuming this
particular callback is the one to be used is not a good idea (besides
breaking layering). Instead of assuming a particular exit callback, I
change the launcher code to require the callback to be set by the user (and fix
up the two call sites which did not set the callback already).

Reviewers: jingham, davide

Subscribers: lldb-commits

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

llvm-svn: 332250

6 years ago[llvm-mca] Improved support for dependency-breaking instructions.
Andrea Di Biagio [Mon, 14 May 2018 15:08:22 +0000 (15:08 +0000)]
[llvm-mca] Improved support for dependency-breaking instructions.

The tool assumes that a zero-latency instruction that doesn't consume hardware
resources is an optimizable dependency-breaking instruction. That means, it
doesn't have to wait on register input operands, and it doesn't consume any
physical register. The PRF knows how to optimize it at register renaming stage.

llvm-svn: 332249

6 years agoFileSpec: Remove PathSyntax enum and use llvm version instead
Pavel Labath [Mon, 14 May 2018 14:52:47 +0000 (14:52 +0000)]
FileSpec: Remove PathSyntax enum and use llvm version instead

Summary:
The llvm version of the enum has the same enumerators, with stlightly
different names, so this is mostly just a search&replace exercise. One
concrete benefit of this is that we can remove the function for
converting between the two enums.

To avoid typing llvm::sys::path::Style::windows everywhere I import the
enum into the FileSpec class, so it can be referenced as
FileSpec::Style::windows.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 332247

6 years ago[CodeGen/AccelTable]: Handle -dwarf-linkage-names=Abstract correctly
Pavel Labath [Mon, 14 May 2018 14:13:20 +0000 (14:13 +0000)]
[CodeGen/AccelTable]: Handle -dwarf-linkage-names=Abstract correctly

Summary:
If we are not emitting a linkage name in the .debug_info sections, we
should not add it into the index either. This makes sure our index is
consistent with the actual debug info.

I am also explicitly setting the --dwarf-linkage-names=All in the
name-collsions test as that one would now fail on targets where this
defaults to "Abstract" (in fact, it would have failed already if there
wasn't a bug in the DWARF verifier, which I fix as well).

Reviewers: probinson, aprantl, JDevlieghere

Subscribers: llvm-commits

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

llvm-svn: 332246

6 years agoDocs: Fix the title underline too short.
Nicola Zaghen [Mon, 14 May 2018 13:54:39 +0000 (13:54 +0000)]
Docs: Fix the title underline too short.

llvm-svn: 332245

6 years ago[CodeComplete] Provide completion in decls even for incomplete types
Ilya Biryukov [Mon, 14 May 2018 13:50:36 +0000 (13:50 +0000)]
[CodeComplete] Provide completion in decls even for incomplete types

Summary:
This change fixes lack of completions in the following case
('^'designates completion points) :

    void f(^);
    struct Incomplete;
    Incomplete g(^);

Reviewers: bkramer, aaron.ballman, sammccall

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 332244

6 years ago[AggressiveInstCombine] avoid crashing on unsimplified code (PR37446)
Sanjay Patel [Mon, 14 May 2018 13:43:32 +0000 (13:43 +0000)]
[AggressiveInstCombine] avoid crashing on unsimplified code (PR37446)

This bug:
https://bugs.llvm.org/show_bug.cgi?id=37446
...raises another question: why do we run aggressive-instcombine before
regular instcombine?

llvm-svn: 332243

6 years ago[ELF] - Simplify. NFC.
George Rimar [Mon, 14 May 2018 13:21:09 +0000 (13:21 +0000)]
[ELF] - Simplify. NFC.

llvm-svn: 332242

6 years ago[mips] Add missing test case from r332227
Simon Dardis [Mon, 14 May 2018 13:18:51 +0000 (13:18 +0000)]
[mips] Add missing test case from r332227

I did not commit this test from D46689.

llvm-svn: 332241

6 years agoRename DEBUG macro to LLVM_DEBUG.
Nicola Zaghen [Mon, 14 May 2018 12:53:11 +0000 (12:53 +0000)]
Rename DEBUG macro to LLVM_DEBUG.

The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM
- Manual change to APInt
- Manually chage DOCS as regex doesn't match it.

In the transition period the DEBUG() macro is still present and aliased
to the LLVM_DEBUG() one.

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

llvm-svn: 332240

6 years agoFix Wdocumentation warnings. NFCI.
Simon Pilgrim [Mon, 14 May 2018 12:22:30 +0000 (12:22 +0000)]
Fix Wdocumentation warnings. NFCI.

llvm-svn: 332239

6 years agoFix "not all control paths return a value" MSVC warning. NFCI.
Simon Pilgrim [Mon, 14 May 2018 12:20:19 +0000 (12:20 +0000)]
Fix "not all control paths return a value" MSVC warning. NFCI.

llvm-svn: 332238

6 years ago[clangd] Add helper for collecting #include directives in file.
Eric Liu [Mon, 14 May 2018 12:19:16 +0000 (12:19 +0000)]
[clangd] Add helper for collecting #include directives in file.

Summary: Separate unit tests for the new function will be added in followup patch which will further refactor Headers.h

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 332237

6 years agoRedirect output to /dev/null in the tests added in r332160.
Eric Liu [Mon, 14 May 2018 12:07:56 +0000 (12:07 +0000)]
Redirect output to /dev/null in the tests added in r332160.

llvm-svn: 332236

6 years agoRe-land r332230 "[llvm-exegesis]Fix a warning in r332221"
Clement Courbet [Mon, 14 May 2018 12:00:35 +0000 (12:00 +0000)]
Re-land r332230 "[llvm-exegesis]Fix a warning in r332221"

comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp:60:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
    ASSERT_EQ(FromDiskVector.size(), 1);

llvm-svn: 332235

6 years ago[AArch64][SVE] Extend parsing of Prefetch operation for SVE.
Sander de Smalen [Mon, 14 May 2018 11:54:41 +0000 (11:54 +0000)]
[AArch64][SVE] Extend parsing of Prefetch operation for SVE.

Reviewers: rengolin, fhahn, samparker, SjoerdMeijer, javed.absar

Reviewed By: fhahn

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

llvm-svn: 332234

6 years ago[clangd] Fix warning after fully covered enum switch. NFC.
Ilya Biryukov [Mon, 14 May 2018 11:47:30 +0000 (11:47 +0000)]
[clangd] Fix warning after fully covered enum switch. NFC.

By adding llvm_unreachable.

llvm-svn: 332233

6 years agoRevert "[CodeGen] Disable aggressive structor optimizations at -O0"
Pavel Labath [Mon, 14 May 2018 11:35:44 +0000 (11:35 +0000)]
Revert "[CodeGen] Disable aggressive structor optimizations at -O0"

It breaks the sanitizer build
<http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/23739>

This reverts commit r332228.

llvm-svn: 332232

6 years ago[llvm-exegesis] Revert accidentally commited code.
Clement Courbet [Mon, 14 May 2018 11:35:37 +0000 (11:35 +0000)]
[llvm-exegesis] Revert accidentally commited code.

llvm-svn: 332231

6 years ago[llvm-exegesis] Fix a warning in r332221
Clement Courbet [Mon, 14 May 2018 11:31:02 +0000 (11:31 +0000)]
[llvm-exegesis] Fix a warning in r332221

comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp:60:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
    ASSERT_EQ(FromDiskVector.size(), 1);

llvm-svn: 332230

6 years ago[llvm-exegesis] Add an analysis mode.
Clement Courbet [Mon, 14 May 2018 11:30:56 +0000 (11:30 +0000)]
[llvm-exegesis] Add an analysis mode.

The analysis mode gives the user a clustered view of the measurement results and
highlights any inconsistencies with the checked-in data.

llvm-svn: 332229

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0
Pavel Labath [Mon, 14 May 2018 11:02:23 +0000 (11:02 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0

Summary:
Removing the full structor and replacing all usages with the base one
can degrade debug quality as it will leave the debugger unable to locate
the full object structor. This is apparent when evaluating an expression
in the debugger which requires constructing an object of class which has
had this optimization applied to it.  When compiling the expression, we
pretend that the class and its methods have been defined in another
compilation unit, so the expression compiler assumes the structor
definition must be available. This didn't use to be the case for
structors with internal linkage. Less aggressive optimizations like
emitting the full structor as an alias remain in place, as they do not
cause the structor symbol to disappear completely.

This improves debug quality on non-darwin platforms (darwin does not
have -mconstructor-aliases on by default, so it is spared these
problems) and enable us to remove some workarounds from LLDB which attempt to
mitigate this issue.

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

llvm-svn: 332228

6 years ago[mips] Correct the predicates of indexed floating point stores and loads.
Simon Dardis [Mon, 14 May 2018 10:53:15 +0000 (10:53 +0000)]
[mips] Correct the predicates of indexed floating point stores and loads.

Also, fix the register class for microMIPS.

Reviewers: atanasyan, abeserminji, smaksimovic

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

llvm-svn: 332227

6 years ago[clangd] Don't query index when completing inside classes
Ilya Biryukov [Mon, 14 May 2018 10:50:04 +0000 (10:50 +0000)]
[clangd] Don't query index when completing inside classes

Summary:
We used to query the index when completing after class qualifiers,
e.g. 'ClassName::^'. We should not do that for the same reasons we
don't query the index for member access expressions.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: klimek, MaskRay, jkorous, cfe-commits

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

llvm-svn: 332226

6 years ago[clang-format] Continue after non-scope-closers in getLengthToMatchingParen
Krasimir Georgiev [Mon, 14 May 2018 10:33:40 +0000 (10:33 +0000)]
[clang-format] Continue after non-scope-closers in getLengthToMatchingParen

Summary:
This fixes a regression introduced by `r331857` where we stop the search for
the End token as soon as we hit a non-scope-closer, which prematurely stops before
semicolons for example, which should otherwise be considered as part of the unbreakable tail.

Subscribers: klimek, cfe-commits

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

llvm-svn: 332225

6 years ago[ELF] Do not error for missing version when symbol has local version.
Peter Smith [Mon, 14 May 2018 10:13:56 +0000 (10:13 +0000)]
[ELF] Do not error for missing version when symbol has local version.

If a symbol with an undefined version in a DSO is not going to be
exported into the dynamic symbol table then do not give an error message
for the missing version. This can happen with the --exclude-libs option
which implicitly gives all symbols in a static library the local version.
This matches the behavior of ld.gold and is exploited by the Bionic
dynamic linker on Arm.

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

llvm-svn: 332224

6 years ago[clang-tidy] Add terminating continue check
Gabor Horvath [Mon, 14 May 2018 10:10:02 +0000 (10:10 +0000)]
[clang-tidy] Add terminating continue check

Patch by: Daniel Kolozsvari!

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

llvm-svn: 332223

6 years ago[RISCV][NFC] Use more appropriate label for CHECK lines
Alex Bradbury [Mon, 14 May 2018 09:14:43 +0000 (09:14 +0000)]
[RISCV][NFC] Use more appropriate label for CHECK lines

'CC1' was a misleading prefix. Committing so as to simplify the diff for a
patch I'm about to put up for review.

llvm-svn: 332222

6 years ago[llvm-exegesis] Allow lists of BenchmarkResults to be parsed as std::vector<Benchmark...
Clement Courbet [Mon, 14 May 2018 09:01:22 +0000 (09:01 +0000)]
[llvm-exegesis] Allow lists of BenchmarkResults to be parsed as std::vector<BenchmarkResult>.

llvm-svn: 332221

6 years agoTest commit access.
Nicola Zaghen [Mon, 14 May 2018 08:24:29 +0000 (08:24 +0000)]
Test commit access.

Remove trailing whitespace.

llvm-svn: 332220

6 years ago[LLVM-C] Add Bindings For Module Flags
Robert Widmann [Mon, 14 May 2018 08:09:00 +0000 (08:09 +0000)]
[LLVM-C] Add Bindings For Module Flags

Summary:
The first foray into merging debug info into the echo tests.

- Add bindings to Module::getModuleFlagsMetadata() in the form of LLVMCopyModuleFlagsMetadata
- Add the opaque type LLVMModuleFlagEntry to represent Module::ModuleFlagEntry
- Add accessors for LLVMModuleFlagEntry's behavior, key, and metadata node.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: aprantl, JDevlieghere, llvm-commits, harlanhaskins

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

llvm-svn: 332219

6 years ago[llvm-ar] Make PositionalArgs static.
Fangrui Song [Mon, 14 May 2018 05:56:48 +0000 (05:56 +0000)]
[llvm-ar] Make PositionalArgs static.

llvm-svn: 332216