platform/upstream/llvm.git
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

6 years agoCorrect compatibility with the GNU Assembler's handling of comparison ops
Bill Wendling [Mon, 14 May 2018 05:25:36 +0000 (05:25 +0000)]
Correct compatibility with the GNU Assembler's handling of comparison ops

GAS returns -1 for a comparison operator if the result is true and 0 if false.

  https://www.sourceware.org/binutils/docs-2.12/as.info/Infix-Ops.html#Infix%20Ops

llvm-svn: 332215

6 years ago[X86] Add fast isel test cases for the clang output for 512-bit cvtps2pd related...
Craig Topper [Mon, 14 May 2018 05:09:41 +0000 (05:09 +0000)]
[X86] Add fast isel test cases for the clang output for 512-bit cvtps2pd related intrinsics.

llvm-svn: 332214

6 years ago[X86] Use select instrution and fpextend in the implementation of _mm512_mask_cvtps_p...
Craig Topper [Mon, 14 May 2018 04:57:46 +0000 (04:57 +0000)]
[X86] Use select instrution and fpextend in the implementation of _mm512_mask_cvtps_pd and _mm512_maskz_cvtps_pd.

llvm-svn: 332213

6 years ago[XRay][compiler-rt] Relocate a DCHECK to the correct location.
Dean Michael Berris [Mon, 14 May 2018 04:21:12 +0000 (04:21 +0000)]
[XRay][compiler-rt] Relocate a DCHECK to the correct location.

Fixes a bad DCHECK where the condition being checked is still valid (for
iterators pointing to sentinels).

Follow-up to D45756.

llvm-svn: 332212

6 years ago[XRay][compiler-rt] Fixup: Use proper string comparison for DCHECK
Dean Michael Berris [Mon, 14 May 2018 04:14:39 +0000 (04:14 +0000)]
[XRay][compiler-rt] Fixup: Use proper string comparison for DCHECK

Fixes the sanitizer build.

Follow-up to D46574.

llvm-svn: 332211

6 years ago[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.
Craig Topper [Mon, 14 May 2018 04:05:06 +0000 (04:05 +0000)]
[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.

If we're using default rounding mode we can let __builtin_convertvector to generate an fpextend. This matches 128 and 256 bit.

If we're using the version that takes an explicit rounding mode argument we would need to look at the immediate to see if its CUR_DIRECTION.

llvm-svn: 332210

6 years ago[XRay][compiler-rt] Fixup: Avoid C++11 narrowing in non-x86_64
Dean Michael Berris [Mon, 14 May 2018 03:55:12 +0000 (03:55 +0000)]
[XRay][compiler-rt] Fixup: Avoid C++11 narrowing in non-x86_64

This should fix non-x86_64 builds where size_t != atomic_uint64_t::Type.

Follow-up to D46574.

llvm-svn: 332209

6 years ago[XRay][compiler-rt] Support in-memory processing of FDR mode logs
Dean Michael Berris [Mon, 14 May 2018 03:35:01 +0000 (03:35 +0000)]
[XRay][compiler-rt] Support in-memory processing of FDR mode logs

Summary:
This change allows for handling the in-memory data associated with the
FDR mode implementation through the new `__xray_log_process_buffers`
API. With this change, we can now allow users to process the data
in-memory of the process instead of through writing files.

This for example allows users to stream the data of the FDR logging
implementation through network sockets, or through other mechanisms
instead of saving them to local files.

We introduce an FDR-specific flag, for "no_file_flush" which lets the
flushing logic skip opening/writing to files.

This option can be defaulted to `true` when building the compiler-rt
XRay runtime through the `XRAY_FDR_OPTIONS` preprocessor macro.

Reviewers: kpw, echristo, pelikan, eizan

Subscribers: llvm-commits

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

llvm-svn: 332208

6 years ago[X86] Cleanup a multiclass that doesn't need as many parameters after recent intrinsi...
Craig Topper [Mon, 14 May 2018 00:17:52 +0000 (00:17 +0000)]
[X86] Cleanup a multiclass that doesn't need as many parameters after recent intrinsic removals.

llvm-svn: 332207

6 years ago[X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use uitofp+insertelement instead.
Craig Topper [Mon, 14 May 2018 00:06:49 +0000 (00:06 +0000)]
[X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use uitofp+insertelement instead.

llvm-svn: 332206

6 years ago[X86] Add patterns for combining movss+uint_to_fp into the intrinsic instructions...
Craig Topper [Sun, 13 May 2018 23:24:21 +0000 (23:24 +0000)]
[X86] Add patterns for combining movss+uint_to_fp into the intrinsic instructions under AVX512.

This matches what we do for sint_to_fp.

llvm-svn: 332205

6 years ago[X86] Add fast-isel test cases for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and...
Craig Topper [Sun, 13 May 2018 23:24:19 +0000 (23:24 +0000)]
[X86] Add fast-isel test cases for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu64_ss.

llvm-svn: 332204

6 years ago[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu6...
Craig Topper [Sun, 13 May 2018 23:03:30 +0000 (23:03 +0000)]
[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu64_ss.

We can use direct C code for these that will use uitofp and insertelement instructions.

For the versions that take an explicit rounding mode we can't do this.

llvm-svn: 332203

6 years ago[X86] Extend instcombine folds for pclmuldq intrinsics to the 256 and 512 bit version.
Craig Topper [Sun, 13 May 2018 21:56:32 +0000 (21:56 +0000)]
[X86] Extend instcombine folds for pclmuldq intrinsics to the 256 and 512 bit version.

llvm-svn: 332202

6 years agoUse const_iterator in DWARFUnit
Jan Kratochvil [Sun, 13 May 2018 19:04:17 +0000 (19:04 +0000)]
Use const_iterator in DWARFUnit

Function DWARFUnit::GetDIE is using m_die_array only for reading so it can use
DWARFDebugInfoEntry::const_iterator.

llvm-svn: 332201

6 years agoRevert "Protect DWARFCompileUnit::m_die_array by a new mutex"
Jan Kratochvil [Sun, 13 May 2018 18:38:28 +0000 (18:38 +0000)]
Revert "Protect DWARFCompileUnit::m_die_array by a new mutex"

Pavel Labath found this patch is incomplete and racy.  I think there needs to
be some more mutexes even before considering DW_TAG_partial_unit.

This reverts commit 331229 which was: https://reviews.llvm.org/D40470

llvm-svn: 332200

6 years ago[X86] Add missing test for the InstCombines of pclmulqdq.
Craig Topper [Sun, 13 May 2018 18:26:06 +0000 (18:26 +0000)]
[X86] Add missing test for the InstCombines of pclmulqdq.

Apparently this test was lost when r293151 was committed. It was present in the review, but not the commit.

llvm-svn: 332199

6 years ago[X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.
Craig Topper [Sun, 13 May 2018 18:03:59 +0000 (18:03 +0000)]
[X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.

llvm-svn: 332198

6 years agoFollow-up to rL332176 by adding a test case for PR37264.
Dimitry Andric [Sun, 13 May 2018 14:32:23 +0000 (14:32 +0000)]
Follow-up to rL332176 by adding a test case for PR37264.

Noticed by Simon Pilgrim.

llvm-svn: 332197

6 years agoAMDGPU: Rename OpenCL lowering pass to be R600 specific.
Matt Arsenault [Sun, 13 May 2018 10:04:48 +0000 (10:04 +0000)]
AMDGPU: Rename OpenCL lowering pass to be R600 specific.

This pass is
  a) broken.
  b) r600 specific.

Fixing (a) is a bit more non-trivial, but fixing (b)
is easy. Move this pass to being R600 only for now.

This pass does pass all the unit tests, however clang
no longer generates code that looks like the unit test
input, so fixing the pass requires fixing the tests and
the pass as one, and checking it works with clang still.

Patch by Dave Airlie

llvm-svn: 332196

6 years agoAMDGPU: Make undef legal for v2i16/v2f16
Matt Arsenault [Sun, 13 May 2018 10:04:38 +0000 (10:04 +0000)]
AMDGPU: Make undef legal for v2i16/v2f16

This is apparently necessary to stop undef from being
turned into a build_vector of 0s.

llvm-svn: 332195

6 years agoAdded atomic_fetch_min, max, umin, umax intrinsics to clang.
Elena Demikhovsky [Sun, 13 May 2018 07:45:58 +0000 (07:45 +0000)]
Added atomic_fetch_min, max, umin, umax intrinsics to clang.

These intrinsics work exactly as all other atomic_fetch_* intrinsics and allow to create *atomicrmw* with ordering.
Updated the clang-extensions document.

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

llvm-svn: 332193

6 years agoFixing build bot error: adding const qualifiers to std::sort lambda.
Puyan Lotfi [Sun, 13 May 2018 06:50:55 +0000 (06:50 +0000)]
Fixing build bot error: adding const qualifiers to std::sort lambda.

Errors were not reproducible on clang-6.0 on ubuntu 16.04.

llvm-svn: 332192

6 years ago[NFC] MIR-Canon: switching to a stable string sorting of instructions.
Puyan Lotfi [Sun, 13 May 2018 06:07:20 +0000 (06:07 +0000)]
[NFC] MIR-Canon: switching to a stable string sorting of instructions.

llvm-svn: 332191

6 years ago[sanitizer] Replace #if SANITIZER_NETBSD with #if SANITIZER_INTERCEPT___LIBC_MUTEX
Vitaly Buka [Sun, 13 May 2018 05:55:45 +0000 (05:55 +0000)]
[sanitizer] Replace #if SANITIZER_NETBSD with #if SANITIZER_INTERCEPT___LIBC_MUTEX

llvm-svn: 332190

6 years ago[X86] Add some load folding patterns for cvtsi2ss/sd into intrinsic instructions.
Craig Topper [Sun, 13 May 2018 01:54:33 +0000 (01:54 +0000)]
[X86] Add some load folding patterns for cvtsi2ss/sd into intrinsic instructions.

llvm-svn: 332189

6 years ago[X86] Remove some unused CHECK lines from tests.
Craig Topper [Sun, 13 May 2018 00:58:23 +0000 (00:58 +0000)]
[X86] Remove some unused CHECK lines from tests.

llvm-svn: 332188

6 years ago[X86] Remove an autoupgrade legacy cvtss2sd intrinsics.
Craig Topper [Sun, 13 May 2018 00:29:40 +0000 (00:29 +0000)]
[X86] Remove an autoupgrade legacy cvtss2sd intrinsics.

llvm-svn: 332187

6 years ago[X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what clang has...
Craig Topper [Sat, 12 May 2018 23:14:39 +0000 (23:14 +0000)]
[X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what clang has used for a very long time.

llvm-svn: 332186

6 years ago[x86] Remove a comment obviated by r330269. Should have deleted the
Chandler Carruth [Sat, 12 May 2018 21:28:53 +0000 (21:28 +0000)]
[x86] Remove a comment obviated by r330269. Should have deleted the
comment in the same revision but missed it.

Thanks to Dimitry Andric for catching this!

llvm-svn: 332177

6 years agoClear converters map after X86 Domain Reassignment to avoid crashes
Dimitry Andric [Sat, 12 May 2018 19:59:54 +0000 (19:59 +0000)]
Clear converters map after X86 Domain Reassignment to avoid crashes

Summary:
As reported in PR37264, in some cases the X86 Domain Reassignment
`runOnMachineFunction()` is called twice.  Because it only deletes the
`.second` members of its `InstrConverterBaseMap`, and does not clean up
the map itself, this can lead to double frees and crashes.

Use `DeleteContainerSeconds()` instead, so the `Converters` map can
safely be reinitialized and its members re-deleted for each X86 Domain
Reassignment pass.

Reviewers: guyblank, craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

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

llvm-svn: 332176

6 years ago[NFC] Remove inaccurate comment
JF Bastien [Sat, 12 May 2018 19:39:34 +0000 (19:39 +0000)]
[NFC] Remove inaccurate comment

Summary:
r271558 moved getManagedStaticMutex's mutex from a function-local
static to using call_once, but left a comment added in r211424. That comment is
now erroneous, remove it.

Reviewers: zturner, chandlerc

Subscribers: aheejin, llvm-commits

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

llvm-svn: 332175