platform/upstream/llvm.git
5 years agoImport lit.llvm after rL341130
Fangrui Song [Fri, 31 Aug 2018 00:26:46 +0000 (00:26 +0000)]
Import lit.llvm after rL341130

llvm-svn: 341152

5 years agoImport lit.llvm after rC341132
Fangrui Song [Fri, 31 Aug 2018 00:24:36 +0000 (00:24 +0000)]
Import lit.llvm after rC341132

llvm-svn: 341151

5 years agoImport lit.llvm after rLLD341134
Fangrui Song [Fri, 31 Aug 2018 00:23:09 +0000 (00:23 +0000)]
Import lit.llvm after rLLD341134

llvm-svn: 341150

5 years agoImport lit.llvm after rL341135
Fangrui Song [Fri, 31 Aug 2018 00:22:20 +0000 (00:22 +0000)]
Import lit.llvm after rL341135

llvm-svn: 341149

5 years ago[PPC64] Improve a test ppc64-toc-rel.s
Fangrui Song [Fri, 31 Aug 2018 00:16:22 +0000 (00:16 +0000)]
[PPC64] Improve a test ppc64-toc-rel.s

Deduplicate dump of .text .data for little-endian and big-endian
Fix a RELOCS-NE check line typo

llvm-svn: 341148

5 years agoRevert "[NFC] Add severe validation of InstructionPrecedenceTracking" for discussion
Max Kazantsev [Fri, 31 Aug 2018 00:01:54 +0000 (00:01 +0000)]
Revert "[NFC] Add severe validation of InstructionPrecedenceTracking" for discussion

llvm-svn: 341147

5 years agoRemove vestiges of configure buildsystem
Stephen Kelly [Thu, 30 Aug 2018 23:41:03 +0000 (23:41 +0000)]
Remove vestiges of configure buildsystem

Summary:

Subscribers: mgorny, cfe-commits

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

llvm-svn: 341146

5 years agoAdd preload option to clang-query
Stephen Kelly [Thu, 30 Aug 2018 23:25:44 +0000 (23:25 +0000)]
Add preload option to clang-query

Summary: This allows loading a file with pre-defined let commands for example.

Subscribers: cfe-commits

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

llvm-svn: 341145

5 years agoExtract runCommandsInFile method
Stephen Kelly [Thu, 30 Aug 2018 23:25:38 +0000 (23:25 +0000)]
Extract runCommandsInFile method

Subscribers: cfe-commits

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

llvm-svn: 341144

5 years ago[hwasan] fix the linux-only pthread_create interceptor and reinstate the two threaded...
Kostya Serebryany [Thu, 30 Aug 2018 23:22:26 +0000 (23:22 +0000)]
[hwasan] fix the linux-only pthread_create interceptor and reinstate the two threaded tests

llvm-svn: 341143

5 years agoAllow binding to NamedValue resulting from let expression
Stephen Kelly [Thu, 30 Aug 2018 23:11:09 +0000 (23:11 +0000)]
Allow binding to NamedValue resulting from let expression

Subscribers: cfe-commits

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

llvm-svn: 341142

5 years agoExtract parseBindID method
Stephen Kelly [Thu, 30 Aug 2018 23:11:01 +0000 (23:11 +0000)]
Extract parseBindID method

Subscribers: cfe-commits

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

llvm-svn: 341141

5 years agoAdd dump() method for SourceRange
Stephen Kelly [Thu, 30 Aug 2018 23:10:52 +0000 (23:10 +0000)]
Add dump() method for SourceRange

Subscribers: cfe-commits

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

llvm-svn: 341140

5 years ago[PPC64] Remove unused -z notext from a test
Fangrui Song [Thu, 30 Aug 2018 23:01:00 +0000 (23:01 +0000)]
[PPC64] Remove unused -z notext from a test

llvm-svn: 341139

5 years ago[NFC] adding initial intersect test for Node to Instruction association
Michael Berg [Thu, 30 Aug 2018 22:43:34 +0000 (22:43 +0000)]
[NFC] adding initial intersect test for Node to Instruction association

llvm-svn: 341138

5 years ago[Hexagon] Check validity of register class when generating bitsplit
Krzysztof Parzyszek [Thu, 30 Aug 2018 22:26:43 +0000 (22:26 +0000)]
[Hexagon] Check validity of register class when generating bitsplit

llvm-svn: 341137

5 years ago[ARM] Enable GEP offset splitting for 32-bit ARM.
Eli Friedman [Thu, 30 Aug 2018 22:18:27 +0000 (22:18 +0000)]
[ARM] Enable GEP offset splitting for 32-bit ARM.

It has essentially the same benefit it has on 64-bit ARM: it
substantially reduces the number of constants used by large GEP
operations. Seems to be generally helpful across a few different
codebases I've tried.

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

llvm-svn: 341136

5 years agoRemove LIT_SITE_CFG_IN_FOOTER, llvm
Nico Weber [Thu, 30 Aug 2018 22:13:34 +0000 (22:13 +0000)]
Remove LIT_SITE_CFG_IN_FOOTER, llvm

It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

llvm-svn: 341135

5 years agoRemove LIT_SITE_CFG_IN_FOOTER, lld
Nico Weber [Thu, 30 Aug 2018 22:12:16 +0000 (22:12 +0000)]
Remove LIT_SITE_CFG_IN_FOOTER, lld

It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

llvm-svn: 341134

5 years ago[hwasan] use thread-local ring buffers to properly report heap-use-after-free
Kostya Serebryany [Thu, 30 Aug 2018 22:11:56 +0000 (22:11 +0000)]
[hwasan] use thread-local ring buffers to properly report heap-use-after-free

llvm-svn: 341133

5 years agoRemove LIT_SITE_CFG_IN_FOOTER, clang
Nico Weber [Thu, 30 Aug 2018 22:11:16 +0000 (22:11 +0000)]
Remove LIT_SITE_CFG_IN_FOOTER, clang

It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

llvm-svn: 341132

5 years ago[WebAssembly] Update utility functions with SIMD types
Thomas Lively [Thu, 30 Aug 2018 22:10:43 +0000 (22:10 +0000)]
[WebAssembly] Update utility functions with SIMD types

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 341131

5 years agoRemove LIT_SITE_CFG_IN_FOOTER, clang-tools-extra
Nico Weber [Thu, 30 Aug 2018 22:10:13 +0000 (22:10 +0000)]
Remove LIT_SITE_CFG_IN_FOOTER, clang-tools-extra

It's always replaced with the same (short) static string, so just put that
there directly.

No intended behavior change.
https://reviews.llvm.org/D51357

llvm-svn: 341130

5 years ago[hwasan] temporarily remove two tests to silence the bots
Kostya Serebryany [Thu, 30 Aug 2018 22:07:09 +0000 (22:07 +0000)]
[hwasan] temporarily remove two tests to silence the bots

llvm-svn: 341129

5 years ago[WebAssembly] Vector conversions
Thomas Lively [Thu, 30 Aug 2018 21:43:51 +0000 (21:43 +0000)]
[WebAssembly] Vector conversions

Summary:
Lowers away bitconverts between vector types. This CL depends
on D51383.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 341128

5 years ago[WebAssembly] SIMD loads and stores
Thomas Lively [Thu, 30 Aug 2018 21:36:48 +0000 (21:36 +0000)]
[WebAssembly] SIMD loads and stores

Summary: Reuse the patterns from WebAssemblyInstrMemory.td.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 341127

5 years agoFixed comment for UserExpression::Complete [NFC]
Raphael Isemann [Thu, 30 Aug 2018 21:31:04 +0000 (21:31 +0000)]
Fixed comment for UserExpression::Complete [NFC]

llvm-svn: 341126

5 years agoAdd support for SEH unwinding on Windows.
Charles Davis [Thu, 30 Aug 2018 21:29:00 +0000 (21:29 +0000)]
Add support for SEH unwinding on Windows.

Summary:
I've tested this implementation on x86-64 to ensure that it works. All
`libc++abi` tests pass, as do all `libc++` exception-related tests. ARM
still remains to be implemented (@compnerd?).

Special thanks to KJK::Hyperion for his excellent series of articles on
how EH works on x86-64 Windows. (Seriously, check it out. It's awesome.)

I'm actually not sure if this should go in as is. I particularly don't
like that I duplicated the UnwindCursor class for this special case.

Reviewers: mstorsjo, rnk, compnerd, smeenai, javed.absar

Subscribers: mgorny, kristof.beyls, christof, chrib, cfe-commits, compnerd, llvm-commits

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

llvm-svn: 341125

5 years agoUse a CompletionRequest in the expression command completion [NFC]
Raphael Isemann [Thu, 30 Aug 2018 21:26:32 +0000 (21:26 +0000)]
Use a CompletionRequest in the expression command completion [NFC]

The patch was originally written before we had a CompletionRequest,
so it still used a StringList to pass back the completions to
the request.

llvm-svn: 341124

5 years agodsymutil: Avoid pruning non-type forward declarations inside DW_TAG_module
Adrian Prantl [Thu, 30 Aug 2018 21:21:16 +0000 (21:21 +0000)]
dsymutil: Avoid pruning non-type forward declarations inside DW_TAG_module
forward declarations.

Especially with template instantiations, there are legitimate reasons
why for declarations might be emitted into a DW_TAG_module skeleton /
forward-declaration sub-tree, that are not forward declarations in the
sense of that there is a more complete definition over in a .pcm file.

The example in the testcase is a constant DW_TAG_member of a
DW_TAG_class template instatiation.

rdar://problem/43623196

llvm-svn: 341123

5 years agoRemove some debugging code that was accidentally left in.
Zachary Turner [Thu, 30 Aug 2018 21:00:57 +0000 (21:00 +0000)]
Remove some debugging code that was accidentally left in.

llvm-svn: 341122

5 years agoMove NoBuiltin=true closer to the other LangOpts code [NFC]
Raphael Isemann [Thu, 30 Aug 2018 20:56:58 +0000 (20:56 +0000)]
Move NoBuiltin=true closer to the other LangOpts code [NFC]

llvm-svn: 341121

5 years agoAdd a utility script to stress test the demangler.
Zachary Turner [Thu, 30 Aug 2018 20:53:48 +0000 (20:53 +0000)]
Add a utility script to stress test the demangler.

llvm-svn: 341120

5 years ago[MS Demangler] Add support for $$Z parameter pack separator.
Zachary Turner [Thu, 30 Aug 2018 20:53:29 +0000 (20:53 +0000)]
[MS Demangler] Add support for $$Z parameter pack separator.

$$Z appears between adjacent expanded parameter packs in the
same template instantiation.  We don't need to print it, it's
only there to disambiguate between manglings that would otherwise
be ambiguous.  So we just need to parse it and throw it away.

llvm-svn: 341119

5 years agoRevert the tests that should've been reverted in rL341115
Artem Belevich [Thu, 30 Aug 2018 20:53:15 +0000 (20:53 +0000)]
Revert the tests that should've been reverted in rL341115

llvm-svn: 341118

5 years ago[MS ABI] Fix mangling issue with dynamic initializer stubs.
Zachary Turner [Thu, 30 Aug 2018 20:53:11 +0000 (20:53 +0000)]
[MS ABI] Fix mangling issue with dynamic initializer stubs.

There are two types of dynamic initializer stubs.  There's

  `dynamic initializer for 'x''(void)

and

  `dynamic initializer for `static Foo::Bar StaticDataMember''(void)

The second case is disambiguated from the first by the presence of
a ? after the operator code.  So the first will appear something like
?__E<name> while the second will appear something like ?__E?<name>.
clang-cl was mangling these both the same though.  This patch
matches behavior with cl.

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

llvm-svn: 341117

5 years agoSafeStack: Prevent OOB reads with mem intrinsics
Vlad Tsyrklevich [Thu, 30 Aug 2018 20:44:51 +0000 (20:44 +0000)]
SafeStack: Prevent OOB reads with mem intrinsics

Summary:
Currently, the SafeStack analysis disallows out-of-bounds writes but not
out-of-bounds reads for mem intrinsics like llvm.memcpy. This could
cause leaks of pointers to the safe stack by leaking spilled registers/
frame pointers. Check for allocas used as source or destination pointers
to mem intrinsics.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: pcc, llvm-commits, kcc

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

llvm-svn: 341116

5 years agoReverted the "[CUDA/OpenMP] Define only some host macros during device compilation"
Artem Belevich [Thu, 30 Aug 2018 20:43:39 +0000 (20:43 +0000)]
Reverted the "[CUDA/OpenMP] Define only some host macros during device compilation"

The changes were breaking CUDA compilation.

Reverted revisions:
  r340681 D50845
   [CUDA/OpenMP] Define only some host macros during device compilation
  r340772 D51312
    [OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading
  r340967 D51441
     Add predefined macro __gnu_linux__ for proper aux-triple

llvm-svn: 341115

5 years agoRevert r341107. That change breaks lto-android in a way is untested.
Sterling Augustine [Thu, 30 Aug 2018 20:42:49 +0000 (20:42 +0000)]
Revert r341107. That change breaks lto-android in a way is untested.

llvm-svn: 341114

5 years agoHashing: use 64-bit seed for hashing on all platforms.
Tim Northover [Thu, 30 Aug 2018 20:28:32 +0000 (20:28 +0000)]
Hashing: use 64-bit seed for hashing on all platforms.

get_execution_seed returns a size_t which varies across platforms, but its
users actually always feed it into a uint64_t role so it makes sense to be
consistent.

Mostly this is just a tidy-up, but it also apparently allows PCH files to be
shared between Clang compilers built for 32-bit and 64-bit hosts.

llvm-svn: 341113

5 years agoAdjusting some comments in ClangExpressionParser.cpp
Raphael Isemann [Thu, 30 Aug 2018 20:19:57 +0000 (20:19 +0000)]
Adjusting some comments in ClangExpressionParser.cpp

llvm-svn: 341112

5 years ago[hwasan] simplify the thread hangling: instead of the ThreadRegistry (too heavy)...
Kostya Serebryany [Thu, 30 Aug 2018 20:15:39 +0000 (20:15 +0000)]
[hwasan] simplify the thread hangling: instead of the ThreadRegistry (too heavy) simply maintain a linked list of Threads

llvm-svn: 341111

5 years ago[cxx_status] Use the correct color for a feature in "SVN" status
Richard Smith [Thu, 30 Aug 2018 20:15:28 +0000 (20:15 +0000)]
[cxx_status] Use the correct color for a feature in "SVN" status

llvm-svn: 341110

5 years agoAdded missing include to <cctype> for 'std::isalnum'
Raphael Isemann [Thu, 30 Aug 2018 20:14:22 +0000 (20:14 +0000)]
Added missing include to <cctype> for 'std::isalnum'

Should fix the failing Windows bots.

llvm-svn: 341109

5 years ago[X86] Add -x86-experimental-vector-widening-legalization command lines to vector...
Craig Topper [Thu, 30 Aug 2018 20:10:10 +0000 (20:10 +0000)]
[X86] Add -x86-experimental-vector-widening-legalization command lines to vector-idiv-v2i32.ll

If we're legalizing via widening already, then the type legalizer will scalarize the divs/rems as i32.

llvm-svn: 341108

5 years agoRefactor Addlibgcc to make the when and what logic more straightfoward.
Sterling Augustine [Thu, 30 Aug 2018 20:07:23 +0000 (20:07 +0000)]
Refactor Addlibgcc to make the when and what logic more straightfoward.

No functional change. A forthcoming change will add support
for -shared-libgcc.

llvm-svn: 341107

5 years agoChange %clang++ to %clangxx in test run line as it was expanding to clang.exe++ on...
Douglas Yung [Thu, 30 Aug 2018 19:52:57 +0000 (19:52 +0000)]
Change %clang++ to %clangxx in test run line as it was expanding to clang.exe++ on Windows.

llvm-svn: 341106

5 years agoFixed code style for the CodeCompletion members [NFC]
Raphael Isemann [Thu, 30 Aug 2018 19:47:53 +0000 (19:47 +0000)]
Fixed code style for the CodeCompletion members [NFC]

This code is in LLDB, so it should also follow the LLDB code style
and use the m_ prefix for members.

llvm-svn: 341105

5 years ago [RISCV] Fixed SmallVector.h Assertion `idx < size()'
Ana Pazos [Thu, 30 Aug 2018 19:43:19 +0000 (19:43 +0000)]
 [RISCV] Fixed SmallVector.h Assertion `idx < size()'

Summary:

RISCVAsmParser needs to handle the case the error message is of specific type, other than the generic Match_InvalidOperand, and the corresponding
operand is missing.

This bug was uncovered by a LLVM MC Assembler Protocol Buffer Fuzzer  for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: llvm-commits, jocewei, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX

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

llvm-svn: 341104

5 years ago[DAGCombiner] Fix bad identation. NFC
Craig Topper [Thu, 30 Aug 2018 19:35:40 +0000 (19:35 +0000)]
[DAGCombiner] Fix bad identation. NFC

llvm-svn: 341103

5 years ago[X86] Weaken an overly aggressive assert.
Craig Topper [Thu, 30 Aug 2018 19:35:38 +0000 (19:35 +0000)]
[X86] Weaken an overly aggressive assert.

This assert tried to check that AND constants are only on the RHS. But its possible for both operands to be constants if one is opaque which will prevent the AND from being constant folded.

Fixes PR38771

llvm-svn: 341102

5 years ago[ARM] Adjust the feature set for Exynos
Evandro Menezes [Thu, 30 Aug 2018 19:22:00 +0000 (19:22 +0000)]
[ARM] Adjust the feature set for Exynos

Enable `FeatureUseAA` for all Exynos processors.

llvm-svn: 341101

5 years agoUpdate FIXME as requested in code review.
Richard Smith [Thu, 30 Aug 2018 19:19:15 +0000 (19:19 +0000)]
Update FIXME as requested in code review.

llvm-svn: 341100

5 years agoAdd test file missed from r341097.
Richard Smith [Thu, 30 Aug 2018 19:17:11 +0000 (19:17 +0000)]
Add test file missed from r341097.

llvm-svn: 341099

5 years agoAdd missing -Wc++11-compat / -Wc++14-compat warnings for:
Richard Smith [Thu, 30 Aug 2018 19:16:35 +0000 (19:16 +0000)]
Add missing -Wc++11-compat / -Wc++14-compat warnings for:

 * generic lambdas
 * return type deduction
 * class template argument deduction

llvm-svn: 341098

5 years agoImprove attribute documentation to list which spellings are used in which syntaxes.
Richard Smith [Thu, 30 Aug 2018 19:16:33 +0000 (19:16 +0000)]
Improve attribute documentation to list which spellings are used in which syntaxes.

Summary:
Instead of listing all the spellings (including attribute namespaces) in
the section heading, only list the actual attribute names there, and
list the spellings in the supported syntaxes table.

This allows us to properly describe things like [[fallthrough]], for
which we allow a clang:: prefix in C++ but not in C, and AlwaysInline,
which has one spelling as a GNU attribute and a different spelling as a
keyword, without needing to repeat the syntax description in the
documentation text.

Sample rendering: https://pste.eu/p/T1ZV.html

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 341097

5 years agoFix deadlock in gdb-client tests
Pavel Labath [Thu, 30 Aug 2018 19:14:02 +0000 (19:14 +0000)]
Fix deadlock in gdb-client tests

Using a listen queue of length 0 caused a deadlock on my machine in the
gdb-client tests while attempting to establish the loopback socket
connection.

I am not sure if this is down to a different python or kernel version,
but in either case, having queue of length zero sounds like a bad idea,
so I'm bumping that to one (which also fixes the deadlock).

llvm-svn: 341096

5 years ago[InstCombine] Expand the simplification of pow() into exp2()
Evandro Menezes [Thu, 30 Aug 2018 19:04:51 +0000 (19:04 +0000)]
[InstCombine] Expand the simplification of pow() into exp2()

Generalize the simplification of `pow(2.0, y)` to `pow(2.0 ** n, y)` for all
scalar and vector types.

This improvement helps some benchmarks in SPEC CPU2000 and CPU2006, such as
252.eon, 447.dealII, 453.povray.  Otherwise, no significant regressions on
x86-64 or A64.

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

llvm-svn: 341095

5 years ago[SROA] Fix alignment for uses of PHI nodes.
Eli Friedman [Thu, 30 Aug 2018 18:59:24 +0000 (18:59 +0000)]
[SROA] Fix alignment for uses of PHI nodes.

Splitting an alloca can decrease the alignment of GEPs into the
partition.  Normally, rewriting accounts for this, but the code was
missing for uses of PHI nodes and select instructions.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38707 .

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

llvm-svn: 341094

5 years ago[OPENMP] Fix PR38710: static functions are not emitted as implicitly
Alexey Bataev [Thu, 30 Aug 2018 18:56:11 +0000 (18:56 +0000)]
[OPENMP] Fix PR38710: static functions are not emitted as implicitly
'declare target'.

All the functions, referenced in implicit|explicit target regions must
be emitted during code emission for the device.

llvm-svn: 341093

5 years ago[analyzer] InnerPointerChecker: Fix a segfault when checking symbolic strings.
Artem Dergachev [Thu, 30 Aug 2018 18:45:05 +0000 (18:45 +0000)]
[analyzer] InnerPointerChecker: Fix a segfault when checking symbolic strings.

Return value of dyn_cast_or_null should be checked before use.
Otherwise we may put a null pointer into the map as a key and eventually
crash in checkDeadSymbols.

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

llvm-svn: 341092

5 years agoReverting r340807.
Andrew Kaylor [Thu, 30 Aug 2018 18:37:18 +0000 (18:37 +0000)]
Reverting r340807.

This patch restores the old behavior of getAllocationDataForFunction in MemoryBuiltins.cpp.

llvm-svn: 341091

5 years ago[Xray] Darwin fix variable typo
David Carlier [Thu, 30 Aug 2018 18:12:47 +0000 (18:12 +0000)]
[Xray] Darwin fix variable typo

llvm-svn: 341090

5 years agoMove Predicate.h from Host to Utility
Raphael Isemann [Thu, 30 Aug 2018 17:51:10 +0000 (17:51 +0000)]
Move Predicate.h from Host to Utility

Summary:
This class was initially in Host because its implementation used to be
very OS-specific. However, with C++11, it has become a very simple
std::condition_variable wrapper, with no host-specific code.

It is also a general purpose utility class, so it makes sense for it to
live in a place where it can be used by everyone.

This has no effect on the layering right now, but it enables me to later
move the Listener+Broadcaster+Event combo to a lower layer, which is
important, as these are used in a lot of places (notably for launching a
process in Host code).

Reviewers: jingham, zturner, teemperor

Reviewed By: zturner

Subscribers: xiaobai, mgorny, lldb-commits

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

llvm-svn: 341089

5 years ago[X86] Add kshift test cases for D51401. NFC
Craig Topper [Thu, 30 Aug 2018 17:51:02 +0000 (17:51 +0000)]
[X86] Add kshift test cases for D51401. NFC

llvm-svn: 341088

5 years agoAllow inconsistent offsets for 'noreturn' basic blocks when '-verify-cfiinstrs'
Vladimir Stefanovic [Thu, 30 Aug 2018 17:31:38 +0000 (17:31 +0000)]
Allow inconsistent offsets for 'noreturn' basic blocks when '-verify-cfiinstrs'

With r295105, some 'noreturn' blocks (those that don't return and have no
successors) may be merged.
If such blocks' predecessors have different outgoing offset or register, don't
report an error in CFIInstrInserter verify().

Thanks to Vlad Tsyrklevich for reporting the issue.

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

llvm-svn: 341087

5 years agoAdded initial code completion support for the `expr` command
Raphael Isemann [Thu, 30 Aug 2018 17:29:37 +0000 (17:29 +0000)]
Added initial code completion support for the `expr` command

Summary:
This patch adds initial code completion support for the `expr` command.

We now have a completion handler in the expression CommandObject that
essentially just attempts to parse the given user expression with Clang with
an attached code completion consumer. We filter and prepare the
code completions provided by Clang and send them back to the completion
API.

The current completion is limited to variables that are in the current scope.
This includes local variables and all types used by local variables. We however
don't do any completion of symbols that are not used in the local scope (or
in some other way already in the ASTContext).

This is partly because there is not yet any code that manually searches for additiona
information in the debug information. Another cause is that for some reason the existing
code for loading these additional symbols when requested by Clang doesn't seem to work.
This will be fixed in a future patch.

Reviewers: jingham, teemperor

Reviewed By: teemperor

Subscribers: labath, aprantl, JDevlieghere, friss, lldb-commits

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

llvm-svn: 341086

5 years ago[LLVM-C] Add Bindings For Named Metadata
Robert Widmann [Thu, 30 Aug 2018 17:09:43 +0000 (17:09 +0000)]
[LLVM-C] Add Bindings For Named Metadata

Summary: Add a new type for named metadata nodes.  Use this to implement iterators and accessors for NamedMDNodes and extend the echo test to use them to copy module-level debug information.

Reviewers: whitequark, deadalnix, aprantl, dexonsmith

Reviewed By: whitequark

Subscribers: Wallbraker, JDevlieghere, llvm-commits, harlanhaskins

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

llvm-svn: 341085

5 years ago[IR] fix declaration of shuffle mask
Sanjay Patel [Thu, 30 Aug 2018 16:44:07 +0000 (16:44 +0000)]
[IR] fix declaration of shuffle mask

An address sanitizer bot flagged this as a potential bug.

llvm-svn: 341084

5 years agoTest the cross-product of how libgcc-related arguments are passed to the linker.
Sterling Augustine [Thu, 30 Aug 2018 16:37:06 +0000 (16:37 +0000)]
Test the cross-product of how libgcc-related arguments are passed to the linker.

llvm-svn: 341083

5 years ago[libFuzzer] Port to Windows
Matt Morehouse [Thu, 30 Aug 2018 15:54:44 +0000 (15:54 +0000)]
[libFuzzer] Port to Windows

Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

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

llvm-svn: 341082

5 years ago[WebAssembly] Made disassembler only use stack instructions.
Wouter van Oortmerssen [Thu, 30 Aug 2018 15:40:53 +0000 (15:40 +0000)]
[WebAssembly] Made disassembler only use stack instructions.

Summary:
Now uses the StackBased bit from the tablegen defs to identify
stack instructions (and ignore register based or non-wasm instructions).

Also changed how we store operands, since we now have up to 16 of them
per instruction. To not cause static data bloat, these are compressed
into a tiny table.

+ a few other cleanups.

Tested:
- MCTest
- llvm-lit -v `find test -name WebAssembly`

Reviewers: dschuff, jgravelle-google, sunfish, tlively

Subscribers: sbc100, aheejin, llvm-commits

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

llvm-svn: 341081

5 years agoRemove redundant initialization
Adrian Prantl [Thu, 30 Aug 2018 15:39:08 +0000 (15:39 +0000)]
Remove redundant initialization

llvm-svn: 341080

5 years agoMove test/Analysis/DivergenceAnalysis/AMDGPU/loads.ll
Nicolai Haehnle [Thu, 30 Aug 2018 15:24:00 +0000 (15:24 +0000)]
Move test/Analysis/DivergenceAnalysis/AMDGPU/loads.ll

Should fix failures of buildbots that don't build the AMDGPU backend.

Change-Id: I01cb84b4b47803b10c5b21ea0353546239860a51
llvm-svn: 341079

5 years agoSupport setting a breakpoint by FileSpec+Line+Column in the SBAPI.
Adrian Prantl [Thu, 30 Aug 2018 15:11:00 +0000 (15:11 +0000)]
Support setting a breakpoint by FileSpec+Line+Column in the SBAPI.

This patch extends the SBAPI to allow for setting a breakpoint not
only at a specific line, but also at a specific (minimum) column. When
a column is specified, it will try to find an exact match or the
closest match on the same line that comes after the specified
location.

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

llvm-svn: 341078

5 years ago[HIP] Add -fvisibility hidden option to clang
Yaxun Liu [Thu, 30 Aug 2018 15:10:20 +0000 (15:10 +0000)]
[HIP] Add -fvisibility hidden option to clang

AMDGPU target need -fvisibility hidden option for clang to
work around a limitation of no PLT support, otherwise there is compilation
error at -O0.

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

llvm-svn: 341077

5 years ago[clangd] Run SignatureHelp using an up-to-date preamble, waiting if needed.
Sam McCall [Thu, 30 Aug 2018 15:07:34 +0000 (15:07 +0000)]
[clangd] Run SignatureHelp using an up-to-date preamble, waiting if needed.

Summary:
After code completion inserts a header, running signature help using the old
preamble will usually fail. So we add support for consistent preamble reads.

Reviewers: ilya-biryukov

Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 341076

5 years ago[IR] add shuffle queries for identity extend/extract
Sanjay Patel [Thu, 30 Aug 2018 15:05:38 +0000 (15:05 +0000)]
[IR] add shuffle queries for identity extend/extract

This was one of the potential follow-ups suggested in D48236,
and these will be used to make matching the patterns in PR38691 cleaner:
https://bugs.llvm.org/show_bug.cgi?id=38691

About the vocabulary: in the DAG, these would be concat_vector with an
undef operand or extract_subvector. Alternate names are discussed in the
review, but I think these are familiar/good enough to proceed. Once we
have uses of them in code, we might adjust if there are better options.

https://reviews.llvm.org/D51392

llvm-svn: 341075

5 years ago[Sema][NFC] Trivial cleanup in ActOnCallExpr
Jan Korous [Thu, 30 Aug 2018 14:46:48 +0000 (14:46 +0000)]
[Sema][NFC] Trivial cleanup in ActOnCallExpr

Use logical or operator instead of a bool variable and if/else.

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

llvm-svn: 341074

5 years ago[OPENMP][NVPTX] Add options -f[no-]openmp-cuda-force-full-runtime.
Alexey Bataev [Thu, 30 Aug 2018 14:45:24 +0000 (14:45 +0000)]
[OPENMP][NVPTX] Add options -f[no-]openmp-cuda-force-full-runtime.

Added options -f[no-]openmp-cuda-force-full-runtime to [not] force use
of the full runtime for OpenMP offloading to CUDA devices.

llvm-svn: 341073

5 years agoMake TargetInstrInfo::isCopyInstr return true for regular COPY-instructions
Alexander Ivchenko [Thu, 30 Aug 2018 14:32:47 +0000 (14:32 +0000)]
Make TargetInstrInfo::isCopyInstr return true for regular COPY-instructions

..Move all target-dependent checks into new isCopyInstrImpl method.

This change allows us to treat MoveReg-type instructions and generic
COPY instruction in the same way

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

llvm-svn: 341072

5 years ago[NFC] Rename the DivergenceAnalysis to LegacyDivergenceAnalysis
Nicolai Haehnle [Thu, 30 Aug 2018 14:21:36 +0000 (14:21 +0000)]
[NFC] Rename the DivergenceAnalysis to LegacyDivergenceAnalysis

Summary:
This is patch 1 of the new DivergenceAnalysis (https://reviews.llvm.org/D50433).

The purpose of this patch is to free up the name DivergenceAnalysis for the new generic
implementation. The generic implementation class will be shared by specialized
divergence analysis classes.

Patch by: Simon Moll

Reviewed By: nhaehnle

Subscribers: jvesely, jholewinski, arsenm, nhaehnle, mgorny, jfb, llvm-commits

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

Change-Id: Ie8146b11be2c50d5312f30e11c7a3036a15b48cb
llvm-svn: 341071

5 years agoMore build fix for r341064.
Alexandre Ganea [Thu, 30 Aug 2018 14:05:49 +0000 (14:05 +0000)]
More build fix for r341064.

llvm-svn: 341070

5 years ago[Sparc] Use ANDN instead of AND if constant can be encoded more efficiently
Daniel Cederman [Thu, 30 Aug 2018 14:05:26 +0000 (14:05 +0000)]
[Sparc] Use ANDN instead of AND if constant can be encoded more efficiently

Summary:
In the case of (and reg, constant) or (or reg, constant), it can be
beneficial to use a ANDNrr/ORNrr instruction instead of ANDrr/ORrr,
if the complement of the constant can be encoded using a single SETHI
instruction instead of a SETHI/ORri pair.

If the constant has more than one use, it is probably better to keep it
in its original form.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 341069

5 years ago[AMDGPU] Preliminary patch for divergence driven instruction selection. Operands...
Alexander Timofeev [Thu, 30 Aug 2018 13:55:04 +0000 (13:55 +0000)]
[AMDGPU] Preliminary patch for divergence driven instruction selection. Operands Folding 1.

Reviewers: rampitec

Differential revision: https://reviews/llvm/org/D51316

llvm-svn: 341068

5 years agoBuild fix for r341064. Temporarily disable compile-time validation for createFileError().
Alexandre Ganea [Thu, 30 Aug 2018 13:36:07 +0000 (13:36 +0000)]
Build fix for r341064. Temporarily disable compile-time validation for createFileError().

llvm-svn: 341067

5 years ago[clangd] Remove UB introduced in rL341057
Kirill Bobyrev [Thu, 30 Aug 2018 13:30:34 +0000 (13:30 +0000)]
[clangd] Remove UB introduced in rL341057

llvm-svn: 341066

5 years ago[clangd] Report position of opening paren in singature help
Ilya Biryukov [Thu, 30 Aug 2018 13:14:31 +0000 (13:14 +0000)]
[clangd] Report position of opening paren in singature help

Summary: Only accessible via the C++ API at the moment.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 341065

5 years ago[Error] Add FileError helper; upgrade StringError behavior
Alexandre Ganea [Thu, 30 Aug 2018 13:10:42 +0000 (13:10 +0000)]
[Error] Add FileError helper; upgrade StringError behavior

FileError is meant to encapsulate both an Error and a file name/path. It should be used in cases where an Error occurs deep down the call chain, and we want to return it to the caller along with the file name.

StringError was updated to display the error messages in different ways. These can be:

1. display the error_code message, and convert to the same error_code (ECError behavior)
2. display an arbitrary string, and convert to a provided error_code (current StringError behavior)
3. display both an error_code message and a string, in this order; and convert to the same error_code

These behaviors can be triggered depending on the constructor. The goal is to use StringError as a base class, when a library needs to provide a explicit Error type.

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

llvm-svn: 341064

5 years ago[CodeComplete] Report location of opening parens for signature help
Ilya Biryukov [Thu, 30 Aug 2018 13:08:03 +0000 (13:08 +0000)]
[CodeComplete] Report location of opening parens for signature help

Summary: Used in clangd.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, kadircet, cfe-commits

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

llvm-svn: 341063

5 years ago[CodeGen] emit inline asm clobber list warnings for reserved (cont)
Ties Stuij [Thu, 30 Aug 2018 12:52:35 +0000 (12:52 +0000)]
[CodeGen] emit inline asm clobber list warnings for reserved (cont)

Summary:
This is a continuation of https://reviews.llvm.org/D49727
Below the original text, current changes in the comments:

Currently, in line with GCC, when specifying reserved registers like sp or pc on an inline asm() clobber list, we don't always preserve the original value across the statement. And in general, overwriting reserved registers can have surprising results.

For example:

  extern int bar(int[]);

  int foo(int i) {
    int a[i]; // VLA
    asm volatile(
        "mov r7, #1"
      :
      :
      : "r7"
    );

    return 1 + bar(a);
  }

Compiled for thumb, this gives:

  $ clang --target=arm-arm-none-eabi -march=armv7a -c test.c -o - -S -O1 -mthumb
  ...
  foo:
          .fnstart
  @ %bb.0:                                @ %entry
          .save   {r4, r5, r6, r7, lr}
          push    {r4, r5, r6, r7, lr}
          .setfp  r7, sp, #12
          add     r7, sp, #12
          .pad    #4
          sub     sp, #4
          movs    r1, #7
          add.w   r0, r1, r0, lsl #2
          bic     r0, r0, #7
          sub.w   r0, sp, r0
          mov     sp, r0
          @APP
          mov.w   r7, #1
          @NO_APP
          bl      bar
          adds    r0, #1
          sub.w   r4, r7, #12
          mov     sp, r4
          pop     {r4, r5, r6, r7, pc}
  ...

r7 is used as the frame pointer for thumb targets, and this function needs to restore the SP from the FP because of the variable-length stack allocation a. r7 is clobbered by the inline assembly (and r7 is included in the clobber list), but LLVM does not preserve the value of the frame pointer across the assembly block.

This type of behavior is similar to GCC's and has been discussed on the bugtracker: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11807 . No consensus seemed to have been reached on the way forward. Clang behavior has briefly been discussed on the CFE mailing (starting here: http://lists.llvm.org/pipermail/cfe-dev/2018-July/058392.html). I've opted for following Eli Friedman's advice to print warnings when there are reserved registers on the clobber list so as not to diverge from GCC behavior for now.

The patch uses MachineRegisterInfo's target-specific knowledge of reserved registers, just before we convert the inline asm string in the AsmPrinter.

If we find a reserved register, we print a warning:

  repro.c:6:7: warning: inline asm clobber list contains reserved registers: R7 [-Winline-asm]
        "mov r7, #1"
        ^

Reviewers: efriedma, olista01, javed.absar

Reviewed By: efriedma

Subscribers: eraman, kristof.beyls, llvm-commits

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

llvm-svn: 341062

5 years ago[clang-tidy] Use simple string matching instead of Regex
Kirill Bobyrev [Thu, 30 Aug 2018 12:42:19 +0000 (12:42 +0000)]
[clang-tidy] Use simple string matching instead of Regex

Instead of parsing and compiling the `llvm::Regex` each time, it's
faster to use basic string matching for filename prefix check.

Reviewed by: hokein

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

llvm-svn: 341061

5 years ago[clangd] Fix tests after rL341057
Kirill Bobyrev [Thu, 30 Aug 2018 12:29:36 +0000 (12:29 +0000)]
[clangd] Fix tests after rL341057

Since OR iterator children are not longer sorted by the estimated size,
string representation should be different.

llvm-svn: 341060

5 years ago[AArch64] Optimise load(adr address) to ldr address
David Green [Thu, 30 Aug 2018 11:55:16 +0000 (11:55 +0000)]
[AArch64] Optimise load(adr address) to ldr address

Providing that the load is known to be 4 byte aligned, we can optimise a
ldr(adr address) to just ldr address.

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

llvm-svn: 341058

5 years ago[clangd] Implement iterator cost
Kirill Bobyrev [Thu, 30 Aug 2018 11:23:58 +0000 (11:23 +0000)]
[clangd] Implement iterator cost

This patch introduces iterator cost concept to improve the performance
of Dex query iterators (mainly, AND iterator). Benchmarks show that the
queries become ~10% faster.

Before

```
-------------------------------------------------------
Benchmark                Time           CPU Iteration
-------------------------------------------------------
DexAdHocQueries    5883074 ns    5883018 ns        117
DexRealQ         959904457 ns  959898507 ns          1
```

After

```
-------------------------------------------------------
Benchmark                Time           CPU Iteration
-------------------------------------------------------
DexAdHocQueries    5238403 ns    5238361 ns        130
DexRealQ         873275207 ns  873269453 ns          1
```

Reviewed by: sammccall

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

llvm-svn: 341057

5 years ago[llvm-mca] correctly initialize field 'CycleRetired' in the TimelineView.
Andrea Di Biagio [Thu, 30 Aug 2018 11:17:58 +0000 (11:17 +0000)]
[llvm-mca] correctly initialize field 'CycleRetired' in the TimelineView.

This fixes a [-Wmissing-field-initializers] warning reported by buildbot
lld-x86_64-darwin13, build #25152.

llvm-svn: 341056

5 years ago[llvm-mca] Report the number of dispatched micro opcodes in the DispatchStatistics...
Andrea Di Biagio [Thu, 30 Aug 2018 10:50:20 +0000 (10:50 +0000)]
[llvm-mca] Report the number of dispatched micro opcodes in the DispatchStatistics view.

This patch introduces the following changes to the DispatchStatistics view:
 * DispatchStatistics now reports the number of dispatched opcodes instead of
   the number of dispatched instructions.
 * The "Dynamic Dispatch Stall Cycles" table now also reports the percentage of
   stall cycles against the total simulated cycles.

This change allows users to easily compare dispatch group sizes with the
processor DispatchWidth.
Before this change, it was difficult to correlate the two numbers, since
DispatchStatistics view reported numbers of instructions (instead of opcodes).
DispatchWidth defines the maximum size of a dispatch group in terms of number of
micro opcodes.

The other change introduced by this patch is related to how DispatchStage
generates "instruction dispatch" events.
In particular:
 * There can be multiple dispatch events associated with a same instruction
 * Each dispatch event now encapsulates the number of dispatched micro opcodes.

The number of micro opcodes declared by an instruction may exceed the processor
DispatchWidth. Therefore, we cannot assume that instructions are always fully
dispatched in a single cycle.
DispatchStage knows already how to handle instructions declaring a number of
opcodes bigger that DispatchWidth. However, DispatchStage always emitted a
single instruction dispatch event (during the first simulated dispatch cycle)
for instructions dispatched.

With this patch, DispatchStage now correctly notifies multiple dispatch events
for instructions that cannot be dispatched in a single cycle.

A few views had to be modified. Views can no longer assume that there can only
be one dispatch event per instruction.

Tests (and docs) have been updated.

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

llvm-svn: 341055

5 years ago[NFC] Whitespace fix
Max Kazantsev [Thu, 30 Aug 2018 10:42:08 +0000 (10:42 +0000)]
[NFC] Whitespace fix

llvm-svn: 341054

5 years ago[RISCV] Fix r341050
Alex Bradbury [Thu, 30 Aug 2018 10:39:30 +0000 (10:39 +0000)]
[RISCV] Fix r341050

A few stray lines were accidentally committed. Remove these.

llvm-svn: 341053

5 years agoFix "Q" and "R" inline assembly template modifiers for big-endian Arm
Florian Hahn [Thu, 30 Aug 2018 10:28:23 +0000 (10:28 +0000)]
Fix "Q" and "R" inline assembly template modifiers for big-endian Arm

Consider the endianness of the target when printing register names.  This is in line with the documentation at http://llvm.org/docs/LangRef.html#asm-template-argument-modifiers

Patch by Jackson Woodruff <jackson.woodruff@arm.com>

Reviewers: t.p.northover, echristo, javed.absar, efriedma

Reviewed By: efriedma

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

llvm-svn: 341052