platform/upstream/llvm.git
5 years agoFix gcc "-Wdangling-else" warning. NFCI.
Simon Pilgrim [Tue, 30 Apr 2019 10:57:37 +0000 (10:57 +0000)]
Fix gcc "-Wdangling-else" warning. NFCI.

llvm-svn: 359551

5 years agoFix gcc "-Wdangling-else" warnings. NFCI.
Simon Pilgrim [Tue, 30 Apr 2019 10:57:02 +0000 (10:57 +0000)]
Fix gcc "-Wdangling-else" warnings. NFCI.

llvm-svn: 359550

5 years agoUpdate checks in an instcombine test, NFC
Jeremy Morse [Tue, 30 Apr 2019 10:56:33 +0000 (10:56 +0000)]
Update checks in an instcombine test, NFC

This reduces the delta in some incoming work that changes this test.

llvm-svn: 359549

5 years agoFix Wpedantic "default argument specified for lambda parameter" warning. NFCI.
Simon Pilgrim [Tue, 30 Apr 2019 10:35:37 +0000 (10:35 +0000)]
Fix Wpedantic "default argument specified for lambda parameter" warning. NFCI.

llvm-svn: 359548

5 years ago[ARM] Implement TTI::getMemcpyCost
Sjoerd Meijer [Tue, 30 Apr 2019 10:28:50 +0000 (10:28 +0000)]
[ARM] Implement TTI::getMemcpyCost

This implements TargetTransformInfo method getMemcpyCost, which estimates the
number of instructions to which a memcpy instruction expands to.

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

llvm-svn: 359547

5 years agoSort containers alphabetically in CxxModuleHandler [NFC]
Raphael Isemann [Tue, 30 Apr 2019 10:27:31 +0000 (10:27 +0000)]
Sort containers alphabetically in CxxModuleHandler [NFC]

llvm-svn: 359546

5 years agoFix for bug 41512: lower INSERT_VECTOR_ELT(ZeroVec, 0, Elt) to SCALAR_TO_VECTOR(Elt...
Simon Pilgrim [Tue, 30 Apr 2019 10:18:25 +0000 (10:18 +0000)]
Fix for bug 41512: lower INSERT_VECTOR_ELT(ZeroVec, 0, Elt) to SCALAR_TO_VECTOR(Elt) for all SSE flavors

Current LLVM uses pxor+pinsrb on SSE4+ for INSERT_VECTOR_ELT(ZeroVec, 0, Elt) insead of much simpler movd.
INSERT_VECTOR_ELT(ZeroVec, 0, Elt) is idiomatic construct which is used e.g. for _mm_cvtsi32_si128(Elt) and for lowest element initialization in _mm_set_epi32.
So such inefficient lowering leads to significant performance digradations in ceratin cases switching from SSSE3 to SSE4.
https://bugs.llvm.org/show_bug.cgi?id=41512

Here INSERT_VECTOR_ELT(ZeroVec, 0, Elt) is simply converted to SCALAR_TO_VECTOR(Elt) when applicable since latter is closer match to desired behavior and always efficiently lowered to movd and alike.

Committed on behalf of @Serge_Preis (Serge Preis)

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

llvm-svn: 359545

5 years agoRevert r359520
David Bolvansky [Tue, 30 Apr 2019 10:09:28 +0000 (10:09 +0000)]
Revert r359520

llvm-svn: 359544

5 years ago[TargetLowering] findOptimalMemOpLowering. NFCI.
Sjoerd Meijer [Tue, 30 Apr 2019 10:09:15 +0000 (10:09 +0000)]
[TargetLowering] findOptimalMemOpLowering. NFCI.

This was a local static funtion in SelectionDAG, which I've promoted to
TargetLowering so that I can reuse it to estimate the cost of a memory
operation in D59787.

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

llvm-svn: 359543

5 years ago[ARM GlobalISel] Widen small shift operands
Diana Picus [Tue, 30 Apr 2019 09:24:43 +0000 (09:24 +0000)]
[ARM GlobalISel] Widen small shift operands

The legalizer was already widening the shift amount. Add tests for that
behaviour, and also support widening the shifted value.

llvm-svn: 359542

5 years ago[AsmPrinter] Make AsmPrinter::HandlerInfo::Handler a unique_ptr
Fangrui Song [Tue, 30 Apr 2019 09:14:02 +0000 (09:14 +0000)]
[AsmPrinter] Make AsmPrinter::HandlerInfo::Handler a unique_ptr

Handlers.clear() in AsmPrinter::doFinalization() will destroy these handlers.
A unique_ptr makes the ownership clearer.

llvm-svn: 359541

5 years ago[ARM GlobalISel] Be more careful about bailing out
Diana Picus [Tue, 30 Apr 2019 09:05:25 +0000 (09:05 +0000)]
[ARM GlobalISel] Be more careful about bailing out

Bail out on function arguments/returns with types aggregating an
unsupported type. This fixes cases where we would happily and
incorrectly lower functions taking e.g. [1 x i64] parameters, when we
don't even support plain i64 yet.

llvm-svn: 359540

5 years ago[analyzer][UninitializedObjectChecker] PR41611: Regard vector types as primitive
Kristof Umann [Tue, 30 Apr 2019 08:47:56 +0000 (08:47 +0000)]
[analyzer][UninitializedObjectChecker] PR41611: Regard vector types as primitive

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

Similarly to D61106, the checker ran over an llvm_unreachable for vector types:

struct VectorSizeLong {
  VectorSizeLong() {}
  __attribute__((__vector_size__(16))) long x;
};

void __vector_size__LongTest() {
  VectorSizeLong v;
}
Since, according to my short research,

"The vector_size attribute is only applicable to integral and float scalars,
although arrays, pointers, and function return values are allowed in conjunction
with this construct."
[src: https://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Vector-Extensions.html#Vector-Extensions]

vector types are safe to regard as primitive.

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

llvm-svn: 359539

5 years agoInstantiate 'std' templates explicitly in the expression evaluator
Raphael Isemann [Tue, 30 Apr 2019 08:41:35 +0000 (08:41 +0000)]
Instantiate 'std' templates explicitly in the expression evaluator

Summary:
This patch is a follow-up for D58125. It implements the manual instantiation and merging of 'std' templates like
`std::vector` and `std::shared_ptr` with information from the debug info AST. This (finally) allows using these classes
in the expression evaluator like every other class (i.e. things like `vec.size()` and shared_ptr debugging now works, yay!).

The main logic is the `CxxModuleHandler` which intercept the ASTImporter import process and replaces any `std` decls
by decls from the C++ module. The decls from the C++ module are "imported" by just deserializing them directly in
the expression evaluation context. This is mostly because we don't want to rely on the ASTImporter to correctly import
these declarations, but in the future we should also move to the ASTImporter for that.

This patch doesn't contain the automatic desugaring for result variables. This means that if you call for example
`size` of `std::vector` you maybe get some very verbose typedef'd type as the variable type, e.g.
`std::vector<int, std::allocator<int>>::value_type`.

This is not only unreadable, it also means that our ASTImporter has to import all these types and associated
decls into the persisent variable context. This currently usually leads to some assertion getting triggered
in Clang when the ASTImporter either makes a mistake during importing or our debug info AST is inconsitent.
The current workaround I use in the tests is to just cast the result to it's actual type (e.g. `size_t` or `int`) to prevent
the ASTImporter from having to handle all these complicated decls.

The automatic desugaring will be a future patch because I'm not happy yet with the current code for that and because
I anticipate that this will be a controversial patch.

Reviewers: aprantl, shafik, jingham, martong, serge-sans-paille

Reviewed By: martong

Subscribers: balazske, rnkovacs, mgorny, mgrang, abidh, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

llvm-svn: 359538

5 years ago[TargetLowering] Change getOptimalMemOpType to take a function attribute list
Sjoerd Meijer [Tue, 30 Apr 2019 08:38:12 +0000 (08:38 +0000)]
[TargetLowering] Change getOptimalMemOpType to take a function attribute list

The MachineFunction wasn't used in getOptimalMemOpType, but more importantly,
this allows reuse of findOptimalMemOpLowering that is calling getOptimalMemOpType.

This is the groundwork for the changes in D59766 and D59787, that allows
implementation of TTI::getMemcpyCost.

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

llvm-svn: 359537

5 years agoMSan: handle llvm.lifetime.start intrinsic
Alexander Potapenko [Tue, 30 Apr 2019 08:35:14 +0000 (08:35 +0000)]
MSan: handle llvm.lifetime.start intrinsic

Summary:
When a variable goes into scope several times within a single function
or when two variables from different scopes share a stack slot it may
be incorrect to poison such scoped locals at the beginning of the
function.
In the former case it may lead to false negatives (see
https://github.com/google/sanitizers/issues/590), in the latter - to
incorrect reports (because only one origin remains on the stack).

If Clang emits lifetime intrinsics for such scoped variables we insert
code poisoning them after each call to llvm.lifetime.start().
If for a certain intrinsic we fail to find a corresponding alloca, we
fall back to poisoning allocas for the whole function, as it's now
impossible to tell which alloca was missed.

The new instrumentation may slow down hot loops containing local
variables with lifetime intrinsics, so we allow disabling it with
-mllvm -msan-handle-lifetime-intrinsics=false.

Reviewers: eugenis, pcc

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 359536

5 years ago[DebugInfo] DW_OP_deref_size in PrologEpilogInserter.
Markus Lavin [Tue, 30 Apr 2019 07:58:57 +0000 (07:58 +0000)]
[DebugInfo] DW_OP_deref_size in PrologEpilogInserter.

The PrologEpilogInserter need to insert a DW_OP_deref_size before
prepending a memory location expression to an already implicit
expression to avoid having the existing expression act on the memory
address instead of the value behind it.

The reason for using DW_OP_deref_size and not plain DW_OP_deref is that
big-endian targets need to read the right size as simply truncating a
larger read would yield the wrong result (LSB bytes are not at the lower
address).

This re-commit fixes issues reported in the first one. Namely deref was
inserted under wrong conditions and additionally the deref_size argument
was incorrectly encoded.

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

llvm-svn: 359535

5 years agoUpdate DemangleConfig.h to better mangle LLVM's version.
Eric Fiselier [Tue, 30 Apr 2019 06:38:24 +0000 (06:38 +0000)]
Update DemangleConfig.h to better mangle LLVM's version.

There's no need for the demangling bits to depend on libc++ internals,
in the same way they don't when compiled as part of LLVM.

llvm-svn: 359534

5 years ago[NFC][PowerPC] Use -check-prefixes to simplify the check in code-align.ll
Kang Zhang [Tue, 30 Apr 2019 03:39:05 +0000 (03:39 +0000)]
[NFC][PowerPC] Use -check-prefixes to simplify the check in code-align.ll

Summary:
When checking the same output, we can use the `-check-prefixes` to simplify the check.
For example, if we want to check below output.
```
; GENERIC-LABEL: .globl  foo
; BASIC-LABEL: .globl  foo
; PWR-LABEL: .globl  foo
; GENERIC: .p2align  2
; BASIC: .p2align  4
; PWR: .p2align  4
; GENERIC: @foo
; BASIC: @foo
; PWR: @foo

```
If we use `-check-prefixes`
```
... -check-prefixes=CHECK,GENERAL
... -check-prefixes=CHECK,BASIC
... -check-prefixes=CHECK,PWR
```
Above check can be simplify to:
```
; CHECK-LABEL: .globl  foo
; GENERIC: .p2align  2
; BASIC: .p2align  4
; PWR: .p2align  4
; CHECK: @foo
```

Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D61227

llvm-svn: 359533

5 years ago[DAGCombiner] Do not generate ISD::ADDE node if adde is not legal for the target...
Zi Xuan Wu [Tue, 30 Apr 2019 03:01:14 +0000 (03:01 +0000)]
[DAGCombiner] Do not generate ISD::ADDE node if adde is not legal for the target when combine ISD::TRUNC node

Do not combine (trunc adde(X, Y, Carry)) into (adde trunc(X), trunc(Y), Carry),
if adde is not legal for the target. Even it's at type-legalize phase.
Because adde is special and will not be legalized at operation-legalize phase later.

This fixes: PR40922
https://bugs.llvm.org/show_bug.cgi?id=40922

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

llvm-svn: 359532

5 years ago[analyzer] Treat functions without run-time branches as "small".
Artem Dergachev [Tue, 30 Apr 2019 03:01:02 +0000 (03:01 +0000)]
[analyzer] Treat functions without run-time branches as "small".

Currently we always inline functions that have no branches, i.e. have exactly
three CFG blocks: ENTRY, some code, EXIT. This makes sense because when there
are no branches, it means that there's no exponential complexity introduced
by inlining such function. Such functions also don't trigger various fundamental
problems with our inlining mechanism, such as the problem of inlined
defensive checks.

Sometimes the CFG may contain more blocks, but in practice it still has
linear structure because all directions (except, at most, one) of all branches
turned out to be unreachable. When this happens, still treat the function
as "small". This is useful, in particular, for dealing with C++17 if constexpr.

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

llvm-svn: 359531

5 years ago[analyzer] SmartPtrModeling: Fix a null dereference.
Artem Dergachev [Tue, 30 Apr 2019 03:00:57 +0000 (03:00 +0000)]
[analyzer] SmartPtrModeling: Fix a null dereference.

Don't crash when trying to model a call in which the callee is unknown
in compile time, eg. a pointer-to-member call.

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

llvm-svn: 359530

5 years ago[ORC] Fix an ambiguous call in a unit test.
Lang Hames [Tue, 30 Apr 2019 02:43:01 +0000 (02:43 +0000)]
[ORC] Fix an ambiguous call in a unit test.

llvm-svn: 359529

5 years ago[PECOFF] Implementation of ObjectFilePECOFF:: GetUUID()
Aaron Smith [Tue, 30 Apr 2019 01:41:33 +0000 (01:41 +0000)]
[PECOFF] Implementation of ObjectFilePECOFF:: GetUUID()

Summary:
Provide an implementation of GetUUID() for remote debugging scenarios.

Return a PDB's GUID (or PDB70's Signature) as the UUID.

Reviewers: amccarth, labath

Reviewed By: labath

Subscribers: amccarth, clayborg, Hui, labath, lldb-commits

Tags: #lldb

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

llvm-svn: 359528

5 years ago[clangd] Fix GN build
Vitaly Buka [Tue, 30 Apr 2019 01:35:42 +0000 (01:35 +0000)]
[clangd] Fix GN build

llvm-svn: 359527

5 years agoImplement LWG 2960: nonesuch is insufficiently useless
Marshall Clow [Tue, 30 Apr 2019 00:54:38 +0000 (00:54 +0000)]
Implement LWG 2960: nonesuch is insufficiently useless

llvm-svn: 359526

5 years agoMark LWG#2977 as 'Nothing to do'. NFC
Marshall Clow [Tue, 30 Apr 2019 00:54:26 +0000 (00:54 +0000)]
Mark LWG#2977 as 'Nothing to do'. NFC

llvm-svn: 359525

5 years ago[NFC] typo
JF Bastien [Tue, 30 Apr 2019 00:19:43 +0000 (00:19 +0000)]
[NFC] typo

llvm-svn: 359524

5 years ago[NFC] typo
JF Bastien [Tue, 30 Apr 2019 00:11:53 +0000 (00:11 +0000)]
[NFC] typo

llvm-svn: 359523

5 years ago[CommandLine} Wire-up cl::list::setDefault() so it will work correctly with cl::Reset...
Don Hinton [Tue, 30 Apr 2019 00:09:49 +0000 (00:09 +0000)]
[CommandLine} Wire-up cl::list::setDefault() so it will work correctly with cl::ResetAllOptionOccurrences() in unittests.  Part 2 of 5

Summary:
With this change, cl::ResetAllOptionOccurrences() clears
cl::list just like cl::opt, allowing users to call
cl::ParseCommandLineOptions() multiple times without interference from
previous calls.

Reviewers: rnk

Reviewed By: rnk

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359522

5 years ago[ORC] Allow JITDylib definition generators to return Errors.
Lang Hames [Tue, 30 Apr 2019 00:03:26 +0000 (00:03 +0000)]
[ORC] Allow JITDylib definition generators to return Errors.

Background: A definition generator can be attached to a JITDylib to generate
new definitions in response to queries. For example: a generator that forwards
calls to dlsym can map symbols from a dynamic library into the JIT process on
demand.

If definition generation fails then the generator should be able to return an
error. This allows the JIT API to distinguish between the case where a
generator does not provide a definition, and the case where it was not able to
determine whether it provided a definition due to an error.

The immediate motivation for this is cross-process symbol lookups: If the
remote-lookup generator is attached to a JITDylib early in the search list, and
if a generator failure is misinterpreted as "no definition in this JITDylib" then
lookup may continue and bind to a different definition in a later JITDylib, which
is a bug.

llvm-svn: 359521

5 years ago[PDB] Fixed null pointer dereference
David Bolvansky [Mon, 29 Apr 2019 23:57:20 +0000 (23:57 +0000)]
[PDB] Fixed null pointer dereference

Reviewers: zturner, rnk

Reviewed By: rnk

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359520

5 years ago[MemorySSA] Invalidate MemorySSA if AA or DT are invalidated.
Alina Sbirlea [Mon, 29 Apr 2019 23:53:04 +0000 (23:53 +0000)]
[MemorySSA] Invalidate MemorySSA if AA or DT are invalidated.

Summary:
MemorySSA keeps internal pointers of AA and DT.
If these get invalidated, so should MemorySSA.

Reviewers: george.burgess.iv, chandlerc

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

llvm-svn: 359519

5 years agoAdd more lld release notes
Nico Weber [Mon, 29 Apr 2019 23:26:21 +0000 (23:26 +0000)]
Add more lld release notes

llvm-svn: 359518

5 years agoAdd __builtin_dcbf support for PPC
Ahsan Saghir [Mon, 29 Apr 2019 23:25:33 +0000 (23:25 +0000)]
Add __builtin_dcbf support for PPC

Summary:
This patch adds support for __builtin_dcbf for PPC.

__builtin_dcbf copies the contents of a modified block from the data cache
to main memory and flushes the copy from the data cache.

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

llvm-svn: 359517

5 years ago[Diagnostics] Support -Wtype-limits for GCC compatibility
David Bolvansky [Mon, 29 Apr 2019 23:24:00 +0000 (23:24 +0000)]
[Diagnostics] Support -Wtype-limits for GCC compatibility

Summary:
GCC's  -Wtype-limits (part of -Wextra):
Warn if a comparison is always true or always false due to the limited range of the data type

Reviewers: rsmith, aaron.ballman, lebedev.ri, thakis

Reviewed By: rsmith

Subscribers: lebedev.ri, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 359516

5 years ago[PDB] Fix hash function used to write /src/headerblock
Nico Weber [Mon, 29 Apr 2019 23:09:35 +0000 (23:09 +0000)]
[PDB] Fix hash function used to write /src/headerblock

lld-link used to write PDB files that DIA couldn't recover natvis
files from if:

- The global strings table was > 64kiB
- There were at least 3 natvis files

The cause was that the hash function for the /src/headerblock stream
was incorrect: It needs to be truncated to 16 bit.

If the global strings table was <= 64kiB, truncating to 16 bit is a
no-op, so this wasn't needed for small programs.

If there are only 1 or 2 natvis files, then the growth strategy in
HashTable::grow() would mean the hash table would have 2 buckets (for 1
natvis file) or 4 buckets (for 4 natvis files), and since the hash
function is used modulo number of buckets, and since 2 and 4 divide
0x10000, the missing `% 0x10000` is a no-op there too. For 3 natvis
files, the hash table grows to 6 buckets, which has a factor that's not
common with 0x10000 and the difference starts to matter.

Fixes PR41626.

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

llvm-svn: 359515

5 years agogn build: Merge r359252
Nico Weber [Mon, 29 Apr 2019 23:06:03 +0000 (23:06 +0000)]
gn build: Merge r359252

llvm-svn: 359514

5 years agoRe-land r359250, [COFF] Statically link certain runtime library functions
Reid Kleckner [Mon, 29 Apr 2019 23:05:47 +0000 (23:05 +0000)]
Re-land r359250, [COFF] Statically link certain runtime library functions

Reverts the revert of r359251, this time with fixed tests.

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

llvm-svn: 359513

5 years agoMake test more robust by writing stdout/stderr to different files.
Douglas Yung [Mon, 29 Apr 2019 22:57:15 +0000 (22:57 +0000)]
Make test more robust by writing stdout/stderr to different files.

Our internal build bots were failing this test randomly as the stderr
output was emitted to the file in the middle of the stdout output
line that the test was checking.

llvm-svn: 359512

5 years ago[ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities.
Lang Hames [Mon, 29 Apr 2019 22:37:27 +0000 (22:37 +0000)]
[ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities.

LLJITBuilder and LLLazyJITBuilder construct LLJIT and LLLazyJIT instances
respectively. Over time these will allow more configurable options to be
added while remaining easy to use in the default case, which for default
in-process JITing is now:

auto J = ExitOnErr(LLJITBuilder.create());

llvm-svn: 359511

5 years ago[JITLink] Move a typedef.
Lang Hames [Mon, 29 Apr 2019 22:37:16 +0000 (22:37 +0000)]
[JITLink] Move a typedef.

The FinalizeContinuation typedef belongs on the Allocation class, not the
allocator.

llvm-svn: 359510

5 years ago[WebAssembly] Make an assertion message prettier. NFC.
Dan Gohman [Mon, 29 Apr 2019 22:37:08 +0000 (22:37 +0000)]
[WebAssembly] Make an assertion message prettier. NFC.

This is a follow-up to https://reviews.llvm.org/D59521.

llvm-svn: 359509

5 years ago[ThinLTO] Adding architecture name into saved object filename
Steven Wu [Mon, 29 Apr 2019 21:39:54 +0000 (21:39 +0000)]
[ThinLTO] Adding architecture name into saved object filename

Summary:
For ThinLTOCodegenerator, it has an option to save the object file
outputs into a directory which is essential for debug info. Tools like lldb
and dsymutil will look for these object files for debug info.

On Darwin platform, you can link fat binaries with one single clang
driver invocation like:
 $ clang -arch x86_64 -arch i386 -Wl,-object_path_lto,$TMPDIR ...
Unfornately, the output object files for one architecture is going to
overwrite the previous ones and one architecture slice will end up with
no debug info. One example for this is to turn on ThinLTO for sanitizer
dylibs in compiler-rt project.

To fix the issue, add the name for the architecture into the name of the
output object file.

rdar://problem/35482935

Reviewers: tejohnson, bd1976llvm, dexonsmith, JDevlieghere

Reviewed By: dexonsmith

Subscribers: mehdi_amini, aprantl, inglorion, eraman, hiraditya, jkorous, dang, llvm-commits

Tags: #llvm

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

llvm-svn: 359508

5 years agoSimplify exclusion of nested classes from extern template instantiation, NFC
Reid Kleckner [Mon, 29 Apr 2019 21:32:05 +0000 (21:32 +0000)]
Simplify exclusion of nested classes from extern template instantiation, NFC

Summary:
This simplifies three checks for MS ABI, Win Itanium, or Win GNU to just
"is Windows".

The question remains, however, if this is really the correct thing to
do. We could, for example, only not consider inner classes to be
externally available if the outer class has a dllexport annotation.
However, I will leave that as future work.

Reviewers: hans, mstorsjo

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 359507

5 years agoWhen skipping code at the start of a file during PCH use, Preprocessor::Lex
Mike Rice [Mon, 29 Apr 2019 21:21:17 +0000 (21:21 +0000)]
When skipping code at the start of a file during PCH use, Preprocessor::Lex
is not used since it consumes all preprocessor directives until it returns
a real token. Using the specific Lexer (i.e. CurLexer->Lex) makes it
possible to stop skipping after an #include or #pragma hdrstop. Previously
the skipping code was only handling CurLexer, now all will be handled
correctly.

Fixes: llvm.org/PR41585

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

llvm-svn: 359506

5 years ago[WebAssembly] Define the signature for __stack_chk_fail
Dan Gohman [Mon, 29 Apr 2019 21:09:44 +0000 (21:09 +0000)]
[WebAssembly] Define the signature for __stack_chk_fail

The WebAssembly backend needs to know the signatures of all runtime
libcall functions. This adds the signature for __stack_chk_fail which was
previously missing.

Also, make the error message for a missing libcall include the name of
the function.

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

Reviewed By: sbc100

llvm-svn: 359505

5 years ago[PowerPC] Try harder to avoid load/move-to VSR for partial vector loads
Roland Froese [Mon, 29 Apr 2019 21:08:35 +0000 (21:08 +0000)]
[PowerPC] Try harder to avoid load/move-to VSR for partial vector loads

Change the PPCISelLowering.cpp function that decides to avoid update form in
favor of partial vector loads to know about newer load types and to not be
confused by the chain operand.

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

llvm-svn: 359504

5 years ago[lit] Check for the psutil module when setting a timeout
Jonas Devlieghere [Mon, 29 Apr 2019 21:03:39 +0000 (21:03 +0000)]
[lit] Check for the psutil module when setting a timeout

Apparently setting the per-test-timeout and not having the psutil
package constitutes to a fatal error. So only set the timeout when the
module is available.

llvm-svn: 359503

5 years ago[ASTImporter] Add an ImportImpl method to allow customizing Import behavior.
Raphael Isemann [Mon, 29 Apr 2019 21:02:35 +0000 (21:02 +0000)]
[ASTImporter] Add an ImportImpl method to allow customizing Import behavior.

Summary:
We are currently implementing support in LLDB that reconstructs the STL templates from
the target program in the expression evaluator. This reconstruction happens during the
import process from our debug info AST into the expression evaluation AST, which means
we need a way to intercept the ASTImporter import process.

This patch adds an protected ImportImpl method that we can overwrite in LLDB to implement
our special importing logic (which is essentially just looking into a C++ module that is attached to
the target context). Because ImportImpl has to call MapImported/AddToLookup for the decls it
creates, this patch also exposes those via a new unified method and checks that we call it when
importing decls.

Reviewers: martong, balazske, a.sidorin, shafik, a_sidorin

Reviewed By: martong, a_sidorin

Subscribers: rnkovacs, cfe-commits, lldb-commits, aprantl

Tags: #clang

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

llvm-svn: 359502

5 years ago[GlobalISel][AArch64] Select llvm.aarch64.crypto.sha1h
Jessica Paquette [Mon, 29 Apr 2019 20:58:17 +0000 (20:58 +0000)]
[GlobalISel][AArch64] Select llvm.aarch64.crypto.sha1h

This was falling back and gives us a reason to create a selectIntrinsic function
which we would need eventually anyway. Update arm64-crypto.ll to show that we
correctly select it.

Also factor out the code for finding an intrinsic ID.

llvm-svn: 359501

5 years agoFix FIXME added in r359339
Reid Kleckner [Mon, 29 Apr 2019 20:44:26 +0000 (20:44 +0000)]
Fix FIXME added in r359339

We have windows.h in asan_win.cc, so we can just use the correct
prototypes for these EH-related interceptors without worrying.

Also fix an unused variable warning while I'm here.

llvm-svn: 359500

5 years agoPacify sanitizer lint script after r359498
Reid Kleckner [Mon, 29 Apr 2019 20:40:08 +0000 (20:40 +0000)]
Pacify sanitizer lint script after r359498

llvm-svn: 359499

5 years ago[AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in asan_malloc_win.cc
Matthew G McGovern [Mon, 29 Apr 2019 20:26:19 +0000 (20:26 +0000)]
[AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in asan_malloc_win.cc

HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user.

_recalloc previously did not zero new memory after reallocation.
https://reviews.llvm.org/D61268

llvm-svn: 359498

5 years ago[UpdateTestChecks] Allow Lbegin_func without a leading period
Martin Storsjo [Mon, 29 Apr 2019 20:25:56 +0000 (20:25 +0000)]
[UpdateTestChecks] Allow Lbegin_func without a leading period

On mingw/i686, local labels don't start with a leading period.

Also escape the leading period, as it previously could match
any char.

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

llvm-svn: 359497

5 years ago[X86] Run CFIInstrInserter on Windows if Dwarf is used
Martin Storsjo [Mon, 29 Apr 2019 20:25:51 +0000 (20:25 +0000)]
[X86] Run CFIInstrInserter on Windows if Dwarf is used

This is necessary since SVN r330706, as tail merging can include
CFI instructions since then.

This fixes PR40322 and PR40012.

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

llvm-svn: 359496

5 years agoFix one more case of passing options with too many dashes.
Don Hinton [Mon, 29 Apr 2019 20:13:35 +0000 (20:13 +0000)]
Fix one more case of passing options with too many dashes.

llvm-svn: 359495

5 years ago[gn] Use label_name rather than target_output_name for objects
Petr Hosek [Mon, 29 Apr 2019 20:04:20 +0000 (20:04 +0000)]
[gn] Use label_name rather than target_output_name for objects

Multiple targets in the same output directory can use the same
target_output_name. The typical example of that is having a shared
and a static library of the same, e.g. libc++.so and libc++.a.
When that's the case, the object files produced for each target
are going to conflict. Using the label_name avoids this conflict
since labels are guaranteed to be unique within a single BUILD.gn
file which corresponds to a single output directory.

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

llvm-svn: 359494

5 years agoFix string UAF in new FileCheck test
Reid Kleckner [Mon, 29 Apr 2019 19:56:46 +0000 (19:56 +0000)]
Fix string UAF in new FileCheck test

llvm-svn: 359493

5 years ago[lit] Fix the timeout.
Jonas Devlieghere [Mon, 29 Apr 2019 19:55:49 +0000 (19:55 +0000)]
[lit] Fix the timeout.

The timeout wasn't working because it's a property of the lit
configuration, not of the configuration in lit.site.cfg. This sets the
property for the correct object.

llvm-svn: 359492

5 years ago[X86][SSE] isHorizontalBinOp - add support for target shuffles
Simon Pilgrim [Mon, 29 Apr 2019 19:52:59 +0000 (19:52 +0000)]
[X86][SSE] isHorizontalBinOp - add support for target shuffles

Add target shuffle decoding to isHorizontalBinOp as well as ISD::VECTOR_SHUFFLE support.

This does mean we can go through bitcasts so we need to bitcast the extracted args to ensure they are the correct type

Fixes PR39936 and should help with PR39920/PR39921

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

llvm-svn: 359491

5 years ago[CMake] Fix subtle CMake bug
Alex Langford [Mon, 29 Apr 2019 19:44:43 +0000 (19:44 +0000)]
[CMake] Fix subtle CMake bug

CMake specifies that the DEPENDS field of add_custom_target is for files
and output of add_custom_command. In order to add a target dependency,
add_dependencies should be used.

llvm-svn: 359490

5 years ago[clangd][xpc] Fix XPC unittests
Jan Korous [Mon, 29 Apr 2019 19:41:30 +0000 (19:41 +0000)]
[clangd][xpc] Fix XPC unittests

Fix build after recent changes in clangd tests & add xpc unittests to
check-clangd target.

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

llvm-svn: 359489

5 years ago[llvm-pdbutil] FunctionDumper::dump(PDBSymbolTypeFunctionArg) - fix null dereference...
Simon Pilgrim [Mon, 29 Apr 2019 19:40:12 +0000 (19:40 +0000)]
[llvm-pdbutil] FunctionDumper::dump(PDBSymbolTypeFunctionArg) - fix null dereference warning

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359488

5 years ago[test] Disable x86-64-gp-write on Darwin
Jonas Devlieghere [Mon, 29 Apr 2019 19:39:09 +0000 (19:39 +0000)]
[test] Disable x86-64-gp-write on Darwin

llvm-svn: 359487

5 years agocomputePolynomialFromPointer - add missing early-out return for non-pointer types.
Simon Pilgrim [Mon, 29 Apr 2019 19:25:16 +0000 (19:25 +0000)]
computePolynomialFromPointer - add missing early-out return for non-pointer types.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359486

5 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Mon, 29 Apr 2019 19:23:44 +0000 (19:23 +0000)]
[InstCombine] reduce code duplication; NFC

Follow-up to:
rL359482

Avoid this potential problem throughout by giving the type a name
and verifying the assumption that both operands are the same type.

llvm-svn: 359485

5 years agoFix additional cases of more that two dashes for options in tests.
Don Hinton [Mon, 29 Apr 2019 18:58:52 +0000 (18:58 +0000)]
Fix additional cases of more that two dashes for options in tests.

llvm-svn: 359484

5 years agoRemove duplicate line. NFCI.
Simon Pilgrim [Mon, 29 Apr 2019 18:58:32 +0000 (18:58 +0000)]
Remove duplicate line. NFCI.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359483

5 years ago[InstCombine] visitFCmpInst - appease copy+paste pattern warning. NFCI.
Simon Pilgrim [Mon, 29 Apr 2019 18:52:19 +0000 (18:52 +0000)]
[InstCombine] visitFCmpInst - appease copy+paste pattern warning. NFCI.

PVS Studio's copy+paste recognizer was seeing this as a typo, technically Op0/Op1 in a fcmp should always be the same type, but we might as well avoid the issue.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359482

5 years ago[globalisel] Improve Legalizer debug output
Daniel Sanders [Mon, 29 Apr 2019 18:45:59 +0000 (18:45 +0000)]
[globalisel] Improve Legalizer debug output

* LegalizeAction should be printed by name rather than number
* Newly created instructions are incomplete at the point the observer first sees
  them. They are therefore recorded in a small vector and printed just before
  the legalizer moves on to another instruction. By this point, the instruction
  must be complete.

llvm-svn: 359481

5 years ago[CommandLine] Don't allow unlimitted dashes for options. Part 1 or 5
Don Hinton [Mon, 29 Apr 2019 18:34:18 +0000 (18:34 +0000)]
[CommandLine] Don't allow unlimitted dashes for options. Part 1 or 5

Summary:
Prior to this patch, the CommandLine parser would strip an
unlimitted number of dashes from options.  This patch limits it to
two.

Reviewers: rnk

Reviewed By: rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 359480

5 years ago[X86] scaleShuffleMask - avoid potential signed overflow warning.
Simon Pilgrim [Mon, 29 Apr 2019 18:32:06 +0000 (18:32 +0000)]
[X86] scaleShuffleMask - avoid potential signed overflow warning.

Use size_t assignment to prevent a bad explicit type conversion warning.

Given the typical size of shuffle masks this was never going to happen, but this at least stops the warning.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359479

5 years ago[TextAPI] Fix Symbol::dump which was failing to append the SymbolKind string.
Simon Pilgrim [Mon, 29 Apr 2019 18:25:04 +0000 (18:25 +0000)]
[TextAPI] Fix Symbol::dump which was failing to append the SymbolKind string.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359478

5 years ago[llvm-mca][x86] Fix MMX PMOVMSKB test
Simon Pilgrim [Mon, 29 Apr 2019 18:24:30 +0000 (18:24 +0000)]
[llvm-mca][x86] Fix MMX PMOVMSKB test

This is defined as part of SSE1, XMM PMOVMSKB doesn't appear until SSE2

llvm-svn: 359477

5 years ago[DAG] Refactor DAGCombiner::ReassociateOps
Bjorn Pettersson [Mon, 29 Apr 2019 17:50:10 +0000 (17:50 +0000)]
[DAG] Refactor DAGCombiner::ReassociateOps

Summary:
Extract the logic for doing reassociations
from DAGCombiner::reassociateOps into a helper
function DAGCombiner::reassociateOpsCommutative,
and use that helper to trigger reassociation
on the original operand order, or the commuted
operand order.

Codegen is not identical since the operand order will
be different when doing the reassociations for the
commuted case. That causes some unfortunate churn in
some test cases. Apart from that this should be NFC.

Reviewers: spatel, craig.topper, tstellar

Reviewed By: spatel

Subscribers: dmgreen, dschuff, jvesely, nhaehnle, javed.absar, sbc100, jgravelle-google, hiraditya, aheejin, llvm-commits

Tags: #llvm

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

llvm-svn: 359476

5 years agoFileCheck [3/12]: Stricter parsing of @LINE expressions
Thomas Preud'homme [Mon, 29 Apr 2019 17:46:26 +0000 (17:46 +0000)]
FileCheck [3/12]: Stricter parsing of @LINE expressions

Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch gives earlier and better
diagnostics for the @LINE expressions.

Rather than detect parsing errors at matching time, this commit adds
enhance parsing to detect issues with @LINE expressions at parse time
and diagnose them more accurately.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

llvm-svn: 359475

5 years ago[TableGen] Fix null pointer dereferencing.
Simon Pilgrim [Mon, 29 Apr 2019 17:41:27 +0000 (17:41 +0000)]
[TableGen] Fix null pointer dereferencing.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359474

5 years agoAvoid "checking a pointer after dereferencing" warning. NFCI.
Simon Pilgrim [Mon, 29 Apr 2019 17:38:18 +0000 (17:38 +0000)]
Avoid "checking a pointer after dereferencing" warning. NFCI.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359473

5 years agoMove if() to newline to stop ambiguity over whether it should be else if. NFCI.
Simon Pilgrim [Mon, 29 Apr 2019 17:34:26 +0000 (17:34 +0000)]
Move if() to newline to stop ambiguity over whether it should be else if. NFCI.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359472

5 years agoFix a stack-smasher in PlatformMacOSX::GetSDKDirectory()
Adrian Prantl [Mon, 29 Apr 2019 17:28:38 +0000 (17:28 +0000)]
Fix a stack-smasher in PlatformMacOSX::GetSDKDirectory()

GetSDKVersion expects the number of version fields not their byte size
and will happily overwrite later contents of the stack.

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

llvm-svn: 359471

5 years ago[clangd] Fix serialization logic for Origin and Flags.
Kadir Cetinkaya [Mon, 29 Apr 2019 17:25:58 +0000 (17:25 +0000)]
[clangd] Fix serialization logic for Origin and Flags.

llvm-svn: 359470

5 years agoFix operator precedence warning. NFCI.
Simon Pilgrim [Mon, 29 Apr 2019 17:04:14 +0000 (17:04 +0000)]
Fix operator precedence warning. NFCI.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359469

5 years ago[LibTooling] Fix unneeded use of unique_ptr where shared_ptr is expected.
Yitzhak Mandelbaum [Mon, 29 Apr 2019 16:57:40 +0000 (16:57 +0000)]
[LibTooling] Fix unneeded use of unique_ptr where shared_ptr is expected.

Summary: This fixes a few places in the Stencil implementation where a unique_ptr is created at a callsite that expects shared_ptr. Since the former implicitly converts to the latter, the code compiles and runs correctly as is.  But, there's no reason to involve unique_ptr -- the current code was leftover from a previous version in which unique_ptr was the expected type.

Reviewers: sbenza

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 359468

5 years agoRemove superfluous break from switch statement. NFCI.
Simon Pilgrim [Mon, 29 Apr 2019 16:45:35 +0000 (16:45 +0000)]
Remove superfluous break from switch statement. NFCI.

Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359467

5 years ago[Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macro
Julian Lettner [Mon, 29 Apr 2019 16:39:18 +0000 (16:39 +0000)]
[Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macro

Note that this change is not strictly NFC since we add the
`(&(name) != &WRAP(name)` part to the conditional for the `_VER` variant
of the macro.

Reviewers: vitalybuka

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

llvm-svn: 359466

5 years ago[Docs] Generate the python reference without building all of LLDB
Jonas Devlieghere [Mon, 29 Apr 2019 16:29:10 +0000 (16:29 +0000)]
[Docs] Generate the python reference without building all of LLDB

As discussed on the mailing list, we should be able to generate the
Python reference without building all of LLDB. To make that possible I
create a dummy python package, which is then parsed by epydoc. The
latter will complain that it couldn't import lldb, but that doesn't
matter as far as generation of the docs is concerned.

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

llvm-svn: 359465

5 years ago[llvm-extract] Expose the group extraction feature of the BlockExtractor
Quentin Colombet [Mon, 29 Apr 2019 16:14:03 +0000 (16:14 +0000)]
[llvm-extract] Expose the group extraction feature of the BlockExtractor

This patch extends the `-bb` option to be able to use the group
extraction feature from the BlockExtractor.
In particular, `-bb=func:bb` is modified to support a list of basic
blocks per function: `-bb=func:bb1[;bb2...]` that will be extracted
together if at all possible (region must be single entry.)

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

llvm-svn: 359464

5 years ago[BlockExtractor] Expose a constructor for the group extraction
Quentin Colombet [Mon, 29 Apr 2019 16:14:02 +0000 (16:14 +0000)]
[BlockExtractor] Expose a constructor for the group extraction

NFC

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

llvm-svn: 359463

5 years ago[BlockExtractor] Change the basic block separator from ',' to ';'
Quentin Colombet [Mon, 29 Apr 2019 16:14:00 +0000 (16:14 +0000)]
[BlockExtractor] Change the basic block separator from ',' to ';'

This change aims at making the file format be compatible with the
way LLVM handles command line options.

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

llvm-svn: 359462

5 years agoAdd AVX support to this test.
Kevin P. Neal [Mon, 29 Apr 2019 16:06:04 +0000 (16:06 +0000)]
Add AVX support to this test.

Requested by Craig Topper and Andrew Kaylor as part of D55897.

llvm-svn: 359461

5 years ago[X86] Remove duplicate string comparison
Simon Pilgrim [Mon, 29 Apr 2019 16:03:35 +0000 (16:03 +0000)]
[X86] Remove duplicate string comparison

Fix typo introduced in rL332824 where we simplified the extact string matches for "avx512.mask.permvar.sf.256" and "avx512.mask.permvar.si.256" to a string startswith test for "avx512.mask.permvar."

llvm-svn: 359460

5 years ago[OPENMP]Fix PR41617: crash on template instantiation.
Alexey Bataev [Mon, 29 Apr 2019 15:51:36 +0000 (15:51 +0000)]
[OPENMP]Fix PR41617: crash on template instantiation.

Fixed the crash on the template instantiation when trying to check the
data locality in the current instantiation scope.

llvm-svn: 359459

5 years agoAdd tests specifically for LWG2164. We already did this; but now we have tests. NFC
Marshall Clow [Mon, 29 Apr 2019 15:38:07 +0000 (15:38 +0000)]
Add tests specifically for LWG2164. We already did this; but now we have tests. NFC

llvm-svn: 359458

5 years ago[AArch64][SVE] Asm: add aliases for unpredicated bitwise logical instructions
Cullen Rhodes [Mon, 29 Apr 2019 15:27:27 +0000 (15:27 +0000)]
[AArch64][SVE] Asm: add aliases for unpredicated bitwise logical instructions

This patch adds aliases for element sizes .B/.H/.S to the
AND/ORR/EOR/BIC bitwise logical instructions. The assembler now accepts
these instructions with all element sizes up to 64-bit (.D). The
preferred disassembly is .D.

llvm-svn: 359457

5 years agoRemove XFAIL: windows from x86-64-gp-write.test
Pavel Labath [Mon, 29 Apr 2019 15:16:26 +0000 (15:16 +0000)]
Remove XFAIL: windows from x86-64-gp-write.test

The typo fix in r359451 was enough to get it passing there.

llvm-svn: 359456

5 years ago[clangd] Add separate unit tests for CanonicalIncludes. NFC
Sam McCall [Mon, 29 Apr 2019 14:36:26 +0000 (14:36 +0000)]
[clangd] Add separate unit tests for CanonicalIncludes. NFC

llvm-svn: 359455

5 years ago[X86][SSE] Add scalar horizontal add/sub tests for non-0/1 element extractions
Simon Pilgrim [Mon, 29 Apr 2019 14:26:27 +0000 (14:26 +0000)]
[X86][SSE] Add scalar horizontal add/sub tests for non-0/1 element extractions

llvm-svn: 359454

5 years ago[libclang] Add missing export for clang_Cursor_isAnonymousRecordDecl
Ivan Donchevskii [Mon, 29 Apr 2019 14:13:11 +0000 (14:13 +0000)]
[libclang] Add missing export for clang_Cursor_isAnonymousRecordDecl

Follow up for D61232 to fix build.

llvm-svn: 359453

5 years ago@skipIfLinux another batch of flaky lldb-mi tests
Pavel Labath [Mon, 29 Apr 2019 14:12:05 +0000 (14:12 +0000)]
@skipIfLinux another batch of flaky lldb-mi tests

llvm-svn: 359452