platform/upstream/llvm.git
6 years agolibcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* filename...
Peter Collingbourne [Tue, 23 Jan 2018 02:07:27 +0000 (02:07 +0000)]
libcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* filenames on Windows.

This is an MSVC standard library extension. It seems like a reasonable
enough extension to me because wchar_t* is the native format for
filenames on that platform.

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

llvm-svn: 323170

6 years agolibcxx: Move Windows threading support into a .cpp file.
Peter Collingbourne [Tue, 23 Jan 2018 01:59:43 +0000 (01:59 +0000)]
libcxx: Move Windows threading support into a .cpp file.

This allows us to avoid polluting the namespace of users of <thread>
with the definitions in windows.h.

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

llvm-svn: 323169

6 years ago[WebAssembly] Update to match llvm changes to TABLE relocations
Sam Clegg [Tue, 23 Jan 2018 01:25:56 +0000 (01:25 +0000)]
[WebAssembly] Update to match llvm changes to TABLE relocations

TABLE relocations now store the function that is being refered
to indirectly.

See rL323165.

Also extend the call-indirect.ll a little.

Based on a patch by Nicholas Wilson!

llvm-svn: 323168

6 years agoNewPM: Improve/fix GCOV - which needs to run early in the pass pipeline.
David Blaikie [Tue, 23 Jan 2018 01:25:24 +0000 (01:25 +0000)]
NewPM: Improve/fix GCOV - which needs to run early in the pass pipeline.

Using a new extension point in the new PM, register GCOV at the start of
the pipeline rather than the end.

llvm-svn: 323167

6 years agoNewPM: Add an extension point for the start of the pipeline.
David Blaikie [Tue, 23 Jan 2018 01:25:20 +0000 (01:25 +0000)]
NewPM: Add an extension point for the start of the pipeline.

This applies to most pipelines except the LTO and ThinLTO backend
actions - it is for use at the beginning of the overall pipeline.

This extension point will be used to add the GCOV pass when enabled in
Clang.

llvm-svn: 323166

6 years ago[WebAssembly] Store function index rather than table index in TABLE_INDEX relocations
Sam Clegg [Tue, 23 Jan 2018 01:23:17 +0000 (01:23 +0000)]
[WebAssembly] Store function index rather than table index in TABLE_INDEX relocations

Relocations of type R_WEBASSEMBLY_TABLE_INDEX represent places
where the table index for a given function is needed.  While the
value stored in this location is a table index, the index in
the relocation entry itself is a function index (the index of
the function which is to be called indirectly).

This is how is was spec'd originally but the LLVM implementation
didn't do this.  This makes things a little simpler in the linker
since the table in the input file can essentially be ignored that
the output table can be created purely based on these relocations.

Patch by Nicholas Wilson!

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

llvm-svn: 323165

6 years ago[COFF] don't replace import library if contents are unchanged
Bob Haarman [Tue, 23 Jan 2018 00:36:42 +0000 (00:36 +0000)]
[COFF] don't replace import library if contents are unchanged

Summary:
This detects when an import library is about to be overwritten with a
newly built one with the same contents, and keeps the old library
instead. The use case for this is to avoid needlessly rebuilding
targets that depend on the import library in build systems that rely
on timestamps to determine whether a target requires rebuilding.

This feature was requested in PR35917.

Reviewers: rnk, ruiu, zturner, pcc

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 323164

6 years ago[lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by
Lang Hames [Mon, 22 Jan 2018 23:53:56 +0000 (23:53 +0000)]
[lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by
building method override tables for CXXMethodDecls in
DWARFASTParserClang::CompleteTypeFromDWARF.

C++ virtual method calls in LLDB expressions may fail if the override table for
the method being called is not correct as IRGen will produce references to the
wrong (or a missing) vtable entry.

This patch does not fix calls to virtual methods with covariant return types as
it mistakenly treats these as overloads, rather than overrides. This will be
addressed in a future patch.

Review: https://reviews.llvm.org/D41997

Partially fixes <rdar://problem/14205774>

llvm-svn: 323163

6 years agoSmall fixes for detect_invalid_pointer_pairs.
Alex Shlyapnikov [Mon, 22 Jan 2018 23:28:52 +0000 (23:28 +0000)]
Small fixes for detect_invalid_pointer_pairs.

Summary:
One test-case uses a wrong operation (should be subtraction).
Second test-case should declare a global variables before a tested one
in order to guarantee we will find a red-zone.

Reviewers: kcc, jakubjelinek, alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek

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

llvm-svn: 323162

6 years agoRevert r322595: Specify inline for isWhitespace in CommandLine.cpp
Rui Ueyama [Mon, 22 Jan 2018 23:27:50 +0000 (23:27 +0000)]
Revert r322595: Specify inline for isWhitespace in CommandLine.cpp

The original change was made based on a misunderstanding that
-DCMAKE_BUILD_TYPE=RelWithDebugInfo would produce the same executable
as -DCMAKE_BUILD_TYPE=Release modulo debug info. Turned out that's not
true -- it at least disables some optimizations such as function inlining.

llvm-svn: 323161

6 years agoUpdate cxx2a status
Marshall Clow [Mon, 22 Jan 2018 23:17:20 +0000 (23:17 +0000)]
Update cxx2a status

llvm-svn: 323160

6 years agoLast batch of P0202 constexpr additions: includes/set_intersection/exchange
Marshall Clow [Mon, 22 Jan 2018 23:10:40 +0000 (23:10 +0000)]
Last batch of P0202 constexpr additions: includes/set_intersection/exchange

llvm-svn: 323159

6 years agoAdd hasTrailingReturn AST matcher
Julie Hockett [Mon, 22 Jan 2018 22:45:23 +0000 (22:45 +0000)]
Add hasTrailingReturn AST matcher

Adds AST matcher for a FunctionDecl that has a trailing return type.

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

llvm-svn: 323158

6 years ago[ASTMatchers] [NFC] Fix code examples
Fangrui Song [Mon, 22 Jan 2018 22:34:15 +0000 (22:34 +0000)]
[ASTMatchers] [NFC] Fix code examples

Subscribers: klimek, cfe-commits

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

llvm-svn: 323157

6 years agoReland "[CodeGen] Fix crash when a function taking transparent union is redeclared."
Volodymyr Sapsai [Mon, 22 Jan 2018 22:29:24 +0000 (22:29 +0000)]
Reland "[CodeGen] Fix crash when a function taking transparent union is redeclared."

When a function taking transparent union is declared as taking one of
union members earlier in the translation unit, clang would hit an
"Invalid cast" assertion during EmitFunctionProlog. This case
corresponds to function f1 in test/CodeGen/transparent-union-redecl.c.
We decided to cast i32 to union because after merging function
declarations function parameter type becomes int,
CGFunctionInfo::ArgInfo type matches with ABIArgInfo type, so we decide
it is a trivial case. But these types should also be castable to
parameter declaration type which is not the case here.

Now the fix is in converting from ABIArgInfo type to VarDecl type and using
argument demotion when necessary.

Additional tests in Sema/transparent-union.c capture current behavior and make
sure there are no regressions.

rdar://problem/34949329

Reviewers: rjmccall, rafael

Reviewed By: rjmccall

Subscribers: aemerson, cfe-commits, kristof.beyls, ahatanak

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

llvm-svn: 323156

6 years agoIntroduce the "retpoline" x86 mitigation technique for variant #2 of the speculative...
Chandler Carruth [Mon, 22 Jan 2018 22:05:25 +0000 (22:05 +0000)]
Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre..

Summary:
First, we need to explain the core of the vulnerability. Note that this
is a very incomplete description, please see the Project Zero blog post
for details:
https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

The basis for branch target injection is to direct speculative execution
of the processor to some "gadget" of executable code by poisoning the
prediction of indirect branches with the address of that gadget. The
gadget in turn contains an operation that provides a side channel for
reading data. Most commonly, this will look like a load of secret data
followed by a branch on the loaded value and then a load of some
predictable cache line. The attacker then uses timing of the processors
cache to determine which direction the branch took *in the speculative
execution*, and in turn what one bit of the loaded value was. Due to the
nature of these timing side channels and the branch predictor on Intel
processors, this allows an attacker to leak data only accessible to
a privileged domain (like the kernel) back into an unprivileged domain.

The goal is simple: avoid generating code which contains an indirect
branch that could have its prediction poisoned by an attacker. In many
cases, the compiler can simply use directed conditional branches and
a small search tree. LLVM already has support for lowering switches in
this way and the first step of this patch is to disable jump-table
lowering of switches and introduce a pass to rewrite explicit indirectbr
sequences into a switch over integers.

However, there is no fully general alternative to indirect calls. We
introduce a new construct we call a "retpoline" to implement indirect
calls in a non-speculatable way. It can be thought of loosely as
a trampoline for indirect calls which uses the RET instruction on x86.
Further, we arrange for a specific call->ret sequence which ensures the
processor predicts the return to go to a controlled, known location. The
retpoline then "smashes" the return address pushed onto the stack by the
call with the desired target of the original indirect call. The result
is a predicted return to the next instruction after a call (which can be
used to trap speculative execution within an infinite loop) and an
actual indirect branch to an arbitrary address.

On 64-bit x86 ABIs, this is especially easily done in the compiler by
using a guaranteed scratch register to pass the target into this device.
For 32-bit ABIs there isn't a guaranteed scratch register and so several
different retpoline variants are introduced to use a scratch register if
one is available in the calling convention and to otherwise use direct
stack push/pop sequences to pass the target address.

This "retpoline" mitigation is fully described in the following blog
post: https://support.google.com/faqs/answer/7625886

We also support a target feature that disables emission of the retpoline
thunk by the compiler to allow for custom thunks if users want them.
These are particularly useful in environments like kernels that
routinely do hot-patching on boot and want to hot-patch their thunk to
different code sequences. They can write this custom thunk and use
`-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this
case, on x86-64 thu thunk names must be:
```
  __llvm_external_retpoline_r11
```
or on 32-bit:
```
  __llvm_external_retpoline_eax
  __llvm_external_retpoline_ecx
  __llvm_external_retpoline_edx
  __llvm_external_retpoline_push
```
And the target of the retpoline is passed in the named register, or in
the case of the `push` suffix on the top of the stack via a `pushl`
instruction.

There is one other important source of indirect branches in x86 ELF
binaries: the PLT. These patches also include support for LLD to
generate PLT entries that perform a retpoline-style indirection.

The only other indirect branches remaining that we are aware of are from
precompiled runtimes (such as crt0.o and similar). The ones we have
found are not really attackable, and so we have not focused on them
here, but eventually these runtimes should also be replicated for
retpoline-ed configurations for completeness.

For kernels or other freestanding or fully static executables, the
compiler switch `-mretpoline` is sufficient to fully mitigate this
particular attack. For dynamic executables, you must compile *all*
libraries with `-mretpoline` and additionally link the dynamic
executable and all shared libraries with LLD and pass `-z retpolineplt`
(or use similar functionality from some other linker). We strongly
recommend also using `-z now` as non-lazy binding allows the
retpoline-mitigated PLT to be substantially smaller.

When manually apply similar transformations to `-mretpoline` to the
Linux kernel we observed very small performance hits to applications
running typical workloads, and relatively minor hits (approximately 2%)
even for extremely syscall-heavy applications. This is largely due to
the small number of indirect branches that occur in performance
sensitive paths of the kernel.

When using these patches on statically linked applications, especially
C++ applications, you should expect to see a much more dramatic
performance hit. For microbenchmarks that are switch, indirect-, or
virtual-call heavy we have seen overheads ranging from 10% to 50%.

However, real-world workloads exhibit substantially lower performance
impact. Notably, techniques such as PGO and ThinLTO dramatically reduce
the impact of hot indirect calls (by speculatively promoting them to
direct calls) and allow optimized search trees to be used to lower
switches. If you need to deploy these techniques in C++ applications, we
*strongly* recommend that you ensure all hot call targets are statically
linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well
tuned servers using all of these techniques saw 5% - 10% overhead from
the use of retpoline.

We will add detailed documentation covering these components in
subsequent patches, but wanted to make the core functionality available
as soon as possible. Happy for more code review, but we'd really like to
get these patches landed and backported ASAP for obvious reasons. We're
planning to backport this to both 6.0 and 5.0 release streams and get
a 5.0 release with just this cherry picked ASAP for distros and vendors.

This patch is the work of a number of people over the past month: Eric, Reid,
Rui, and myself. I'm mailing it out as a single commit due to the time
sensitive nature of landing this and the need to backport it. Huge thanks to
everyone who helped out here, and everyone at Intel who helped out in
discussions about how to craft this. Also, credit goes to Paul Turner (at
Google, but not an LLVM contributor) for much of the underlying retpoline
design.

Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer

Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits

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

llvm-svn: 323155

6 years ago[WebAssembly] Remove --emit-relocs
Sam Clegg [Mon, 22 Jan 2018 21:55:43 +0000 (21:55 +0000)]
[WebAssembly] Remove --emit-relocs

This was added to mimic ELF, but maintaining it has cost
and we currently don't have any use for it outside of the
test code.

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

llvm-svn: 323154

6 years ago[AMDGPU] SI Load Store Optimizer: When merging with offset, use V_ADD_{I|U}32_e64
Mark Searles [Mon, 22 Jan 2018 21:46:43 +0000 (21:46 +0000)]
[AMDGPU] SI Load Store Optimizer: When merging with offset, use V_ADD_{I|U}32_e64
- Change inserted add ( V_ADD_{I|U}32_e32 ) to _e64 version ( V_ADD_{I|U}32_e64 ) so that the add uses a vreg for the carry; this prevents inserted v_add from killing VCC; the _e64 version doesn't accept a literal in its encoding, so we need to introduce a mov instr as well to get the imm into a register.
- Change pass name to "SI Load Store Optimizer"; this removes the '/', which complicates scripts.

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

llvm-svn: 323153

6 years agoAnother batch of P0202 constepr algirithms. remove/remove_if/remove_copy/remove_copy_...
Marshall Clow [Mon, 22 Jan 2018 21:43:04 +0000 (21:43 +0000)]
Another batch of P0202 constepr algirithms. remove/remove_if/remove_copy/remove_copy_if/reverse_copy, and tests (commented out) for rotate_copy, because that depends on std::copy

llvm-svn: 323152

6 years ago[clangd] Drop ~destructor completions - rarely helpful and work inconsistently
Sam McCall [Mon, 22 Jan 2018 21:05:00 +0000 (21:05 +0000)]
[clangd] Drop ~destructor completions - rarely helpful and work inconsistently

llvm-svn: 323149

6 years ago[CodeComplete] Omit templated constructors from member list too.
Sam McCall [Mon, 22 Jan 2018 20:44:47 +0000 (20:44 +0000)]
[CodeComplete] Omit templated constructors from member list too.

Also avoid printing a 'void' return type for constructor expressions.

llvm-svn: 323148

6 years agoStill more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical...
Marshall Clow [Mon, 22 Jan 2018 20:44:33 +0000 (20:44 +0000)]
Still more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical_compare

llvm-svn: 323147

6 years ago[analyzer] Protect against dereferencing a null pointer
Alexander Shaposhnikov [Mon, 22 Jan 2018 20:18:42 +0000 (20:18 +0000)]
[analyzer] Protect against dereferencing a null pointer

The check (inside StackHintGeneratorForSymbol::getMessage)
if (!N)
    return getMessageForSymbolNotFound()
is moved to the beginning of the function.

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

Test plan: make check-all

llvm-svn: 323146

6 years ago[cmake] [libcxxabi] Fix find_path() problems when cross compiling
Don Hinton [Mon, 22 Jan 2018 19:41:05 +0000 (19:41 +0000)]
[cmake] [libcxxabi] Fix find_path() problems when cross compiling

When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, these find_path() invocations are looking for paths in
the libcxx and libunwind projects on the host system, not the
target system, which can be done by passing
NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323145

6 years ago[llvm-objcopy] Use physical instead of virtual address when aligning and placing...
Jake Ehrlich [Mon, 22 Jan 2018 19:27:30 +0000 (19:27 +0000)]
[llvm-objcopy] Use physical instead of virtual address when aligning and placing sections in binary

For sections with different virtual and physical addresses, alignment and
placement in the output binary should be based on the physical address.

Ran into this problem with a bare metal ARM project where llvm-objcopy added a
lot of zero-padding before the .data section that had differing addresses. GNU
objcopy did not add the padding, and after this fix, neither does llvm-objcopy.

Update a test case so a section has different physical and virtual addresses.

Fixes B35708

Authored By: Owen Shaw (owenpshaw)

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

llvm-svn: 323144

6 years ago[cmake] [libcxx] Fix find_path() problems when cross compiling.
Don Hinton [Mon, 22 Jan 2018 19:26:38 +0000 (19:26 +0000)]
[cmake] [libcxx] Fix find_path() problems when cross compiling.

When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxxabi project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323143

6 years ago[ubsan] Disable signal handling on Android.
Evgeniy Stepanov [Mon, 22 Jan 2018 19:26:01 +0000 (19:26 +0000)]
[ubsan] Disable signal handling on Android.

Summary: See rationale in the comments.

Reviewers: vitalybuka

Subscribers: srhines, llvm-commits, kubamracek

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

llvm-svn: 323142

6 years ago[cmake] [libunwind] Fix find_path() problems when cross compiling
Don Hinton [Mon, 22 Jan 2018 19:15:06 +0000 (19:15 +0000)]
[cmake] [libunwind] Fix find_path() problems when cross compiling

When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxx project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323141

6 years agoasan: allow inline instrumentation for the kernel
Dmitry Vyukov [Mon, 22 Jan 2018 19:07:11 +0000 (19:07 +0000)]
asan: allow inline instrumentation for the kernel

Currently ASan instrumentation pass forces callback
instrumentation when applied to the kernel.
This patch changes the current behavior to allow
using inline instrumentation in this case.

Authored by andreyknvl. Reviewed in:
https://reviews.llvm.org/D42384

llvm-svn: 323140

6 years ago[AArch64] Create a separate feature set for Exynos M3
Evandro Menezes [Mon, 22 Jan 2018 19:03:26 +0000 (19:03 +0000)]
[AArch64] Create a separate feature set for Exynos M3

Distinguish the features from Exynos M2.

llvm-svn: 323139

6 years agoFix memory leak in TestClangASTContext.TestRecordHasFields
Raphael Isemann [Mon, 22 Jan 2018 18:56:33 +0000 (18:56 +0000)]
Fix memory leak in TestClangASTContext.TestRecordHasFields

Summary: We can't use unique_ptr's here because we use those variables as `out` parameters to some functions. Discovered by the memory sanitizer.

Subscribers: lldb-commits

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

llvm-svn: 323138

6 years agoAdd (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n. These...
Marshall Clow [Mon, 22 Jan 2018 18:38:18 +0000 (18:38 +0000)]
Add (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n.  These will be enabled when that part of P0202 is implemented. NFC at this time.

llvm-svn: 323137

6 years ago[ARM] Cleanup part of ARMBaseInstrInfo::optimizeCompareInstr (NFCI).
Joel Galenson [Mon, 22 Jan 2018 17:53:47 +0000 (17:53 +0000)]
[ARM] Cleanup part of ARMBaseInstrInfo::optimizeCompareInstr (NFCI).

As noted in another review, this loop is confusing.  This commit cleans it up
somewhat.

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

llvm-svn: 323136

6 years ago[CodeGen] Shrink MachineOperand by 8 bytes on Windows
Reid Kleckner [Mon, 22 Jan 2018 17:50:20 +0000 (17:50 +0000)]
[CodeGen] Shrink MachineOperand by 8 bytes on Windows

Use 'unsigned' for these bitfields so they actually pack together.
Previously it used three words for these bits instead of one.

Add some static_asserts to prevent this from being undone.

llvm-svn: 323135

6 years ago[Dockerfiles] Use a newer version of ninja when building inside debian8.
Ilya Biryukov [Mon, 22 Jan 2018 17:19:41 +0000 (17:19 +0000)]
[Dockerfiles] Use a newer version of ninja when building inside debian8.

Summary:
The debian8 repos have an old version of ninja that seems to sometimes crash
when building llvm.

Reviewers: ioeric, mehdi_amini

Reviewed By: ioeric

Subscribers: llvm-commits

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

llvm-svn: 323134

6 years ago[CodeComplete] Fix completion in the middle of idents in macro calls
Ilya Biryukov [Mon, 22 Jan 2018 17:18:28 +0000 (17:18 +0000)]
[CodeComplete] Fix completion in the middle of idents in macro calls

Summary:
This patch removes IdentifierInfo from completion token after remembering
the identifier in the preprocessor.

Prior to this patch, completion token had the IdentifierInfo set to null when
completing at the start of identifier and to the II for completion prefix
when in the middle of identifier.

This patch unifies how code completion token is handled when it is insterted
before the identifier and in the middle of the identifier.

The actual IdentifierInfo can still be obtained from the Preprocessor.

Reviewers: bkramer, arphaman

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 323133

6 years ago[mips] add warnings for using dsp and msa flags with inappropriate revisions
Petar Jovanovic [Mon, 22 Jan 2018 16:43:30 +0000 (16:43 +0000)]
[mips] add warnings for using dsp and msa flags with inappropriate revisions

Dsp and dspr2 require MIPS revision 2, while msa requires revision 5. Adding
warnings for cases when these flags are used with earlier revision.

Patch by Milos Stojanovic.

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

llvm-svn: 323131

6 years ago[clang-tidy objc-property-declaration] New option IncludeDefaultAcronyms
Ben Hamilton [Mon, 22 Jan 2018 15:45:25 +0000 (15:45 +0000)]
[clang-tidy objc-property-declaration] New option IncludeDefaultAcronyms

Summary:
The existing option objc-property-declaration.Acronyms
replaces the built-in set of acronyms.

While this behavior is OK for clients that don't want the default
behavior, many clients may just want to add their own custom acronyms
to the default list.

This revision introduces a new option,
objc-property-declaration.IncludeDefaultAcronyms, which controls
whether the acronyms in objc-property-declaration.Acronyms are
appended to the default list (the default behavior) or whether they
replace.

I also updated the documentation.

Test Plan: make -j12 check-clang-tools

Reviewers: Wizard, hokein, klimek

Reviewed By: hokein

Subscribers: Eugene.Zelenko, cfe-commits

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

llvm-svn: 323130

6 years ago[SystemZ] Fix bootstrap failure due to invalid DAG loop
Ulrich Weigand [Mon, 22 Jan 2018 15:41:49 +0000 (15:41 +0000)]
[SystemZ] Fix bootstrap failure due to invalid DAG loop

The change in r322988 caused a failure in the bootstrap build bot.
The problem was that directly gluing a BR_CCMASK node to a
compare-and-swap could lead to issues if other nodes were
chained in between.  There is then no way to create a topological
sort that respects both the chain sequence and the glue property.

Fixed for now by rejecting the optimization in this case.  As a
future enhancement, we may be able to handle additional cases
by swapping chain links around.

llvm-svn: 323129

6 years agoFix bug in commit 323096 exposed by test in test-suite-verify-machineinstrs-x86_64h-O3
Marina Yatsina [Mon, 22 Jan 2018 15:31:05 +0000 (15:31 +0000)]
Fix bug in commit 323096 exposed by test in test-suite-verify-machineinstrs-x86_64h-O3

Change-Id: I0a4b10d0d6c8de606d989c567ec07944ae283a87
llvm-svn: 323126

6 years ago[AArch64][SVE] Asm: PTRUE and PTRUES instructions
Sander de Smalen [Mon, 22 Jan 2018 15:29:19 +0000 (15:29 +0000)]
[AArch64][SVE] Asm: PTRUE and PTRUES instructions

Summary: These instructions initialize a predicate vector from a pattern/immediate.

Reviewers: fhahn, rengolin, evandro, mcrosier, t.p.northover, samparker, olista01

Reviewed By: samparker

Subscribers: aemerson, javed.absar, tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 323124

6 years ago[DOCS] Mention OpenMP Tools Interface in runtime library
Jonas Hahnfeld [Mon, 22 Jan 2018 15:27:45 +0000 (15:27 +0000)]
[DOCS] Mention OpenMP Tools Interface in runtime library

Also list supported configurations (architectures + operating
systems).

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

llvm-svn: 323123

6 years ago[modules] Correctly overload getModule in the MultiplexExternalSemaSource
Raphael Isemann [Mon, 22 Jan 2018 15:27:25 +0000 (15:27 +0000)]
[modules] Correctly overload getModule in the MultiplexExternalSemaSource

Summary:
The MultiplexExternalSemaSource doesn't correctly overload the `getModule` function,
causing the multiplexer to not forward this call as intended.

Reviewers: v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 323122

6 years agoFix uninitialized variable in GoParser
Raphael Isemann [Mon, 22 Jan 2018 14:32:43 +0000 (14:32 +0000)]
Fix uninitialized variable in GoParser

Summary:
`m_last_tok` isn't initialized anywhere before it's used the first time (most likely in the `GoParser::Rule::error` method), which causes most of the GoParser tests to fail with sanitizers enabled with errors like this:

```
GoParser.cpp:52:21: runtime error: load of value <random value>, which is not a valid value for type 'GoLexer::TokenType'
UndefinedBehaviorSanitizer: undefined-behavior GoParser.cpp:52:21
```

Reviewers: ribrdb, davide, labath

Reviewed By: labath

Subscribers: labath, lldb-commits

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

llvm-svn: 323119

6 years ago[AArch64] optimise v4f16 fcmps to utilise vector instructions
Carey Williams [Mon, 22 Jan 2018 14:16:11 +0000 (14:16 +0000)]
[AArch64] optimise v4f16 fcmps to utilise vector instructions

Improves the code generation for v4f16 FCMP instructions when FullFP16 is not supported.
Generating FCTVL(s) rather than a longer series of FCVTs.

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

llvm-svn: 323118

6 years ago[ThinLTO] Re-commit of dot dumper after test fix
Eugene Leviant [Mon, 22 Jan 2018 13:35:40 +0000 (13:35 +0000)]
[ThinLTO] Re-commit of dot dumper after test fix

llvm-svn: 323116

6 years ago[analyzer] Model and check unrepresentable left shifts
Gabor Horvath [Mon, 22 Jan 2018 13:32:10 +0000 (13:32 +0000)]
[analyzer] Model and check unrepresentable left shifts

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 323115

6 years agoFixing warnings caused by commit 323095
Marina Yatsina [Mon, 22 Jan 2018 13:24:10 +0000 (13:24 +0000)]
Fixing warnings caused by commit 323095

Change-Id: I4e1f81db2f5382a820f4016c23b243e4d5aebf51
llvm-svn: 323114

6 years agoRename DwarfAcceleratorTable to AppleAcceleratorTable. NFC
Pavel Labath [Mon, 22 Jan 2018 13:17:23 +0000 (13:17 +0000)]
Rename DwarfAcceleratorTable to AppleAcceleratorTable. NFC

This frees up the first name to be used as an base class for the
apple table and the dwarf5 .debug_names accel table. The rename  was
split off from D42297 (adding of debug_names support), which is still
under review.

llvm-svn: 323113

6 years agoFix MSVC implicit double-float truncation warning. NFCI.
Simon Pilgrim [Mon, 22 Jan 2018 13:15:16 +0000 (13:15 +0000)]
Fix MSVC implicit double-float truncation warning. NFCI.

llvm-svn: 323112

6 years ago[clangd] Try to fix build bot failue in r323101
Eric Liu [Mon, 22 Jan 2018 13:03:25 +0000 (13:03 +0000)]
[clangd] Try to fix build bot failue in r323101

llvm-svn: 323111

6 years ago[X86][AVX] Add test case for PR34370
Simon Pilgrim [Mon, 22 Jan 2018 12:27:22 +0000 (12:27 +0000)]
[X86][AVX] Add test case for PR34370

llvm-svn: 323106

6 years ago[X86][SSE] Add ISD::VECTOR_SHUFFLE to faux shuffle decoding (Reapplied)
Simon Pilgrim [Mon, 22 Jan 2018 12:05:17 +0000 (12:05 +0000)]
[X86][SSE] Add ISD::VECTOR_SHUFFLE to faux shuffle decoding (Reapplied)

Primarily, this allows us to use the aggressive extraction mechanisms in combineExtractWithShuffle earlier and make use of UNDEF elements that may be lost during lowering.

Reapplied after rL322279 was reverted at rL322335 due to PR35918, underlying issue was fixed at rL322644.

llvm-svn: 323104

6 years agoRevert "[SymbolFilePDB] Fix null array access when parsing the type of a function...
Pavel Labath [Mon, 22 Jan 2018 11:51:56 +0000 (11:51 +0000)]
Revert "[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it"

This reverts commit r322995, as it breaks
lldb-Unit::SymbolFilePDBTests.TestTypedefs
<http://lab.llvm.org:8011/builders/lldb-windows7-android/builds/7715>.

llvm-svn: 323102

6 years ago[clangd] Add support for different file URI schemas.
Eric Liu [Mon, 22 Jan 2018 11:48:20 +0000 (11:48 +0000)]
[clangd] Add support for different file URI schemas.

Summary: I will replace the existing URI struct in Protocol.h with the new URI and rename FileURI to URI in a followup patch.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 323101

6 years agoAdd SysV Abi for PPC64le
Pavel Labath [Mon, 22 Jan 2018 11:27:43 +0000 (11:27 +0000)]
Add SysV Abi for PPC64le

Summary:
This patch implements the ABI Plugin for PPC64le. It was based on the
ABI for PPC64. It also enables LLDB to evaluate expressions using JIT.

Reviewers: labath, clayborg, jhibbits, davide

Reviewed By: labath, clayborg, jhibbits, davide

Subscribers: davide, JDevlieghere, chmeee, emaste, jhibbits, hfinkel, lldb-commits, nemanjai, luporl, lbianc, mgorny, anajuliapc, kbarton

Differential Revision: https://reviews.llvm.org/D41702
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 323100

6 years agoAdd test for interaction of --gc-sections and undefined references
James Henderson [Mon, 22 Jan 2018 10:58:06 +0000 (10:58 +0000)]
Add test for interaction of --gc-sections and undefined references

It is possible for a link to fail with an undefined reference, unless
--gc-sections is specified, removing the reference in the process. This
doesn't look to be tested anywhere explicitly, so I thought it useful
to add a test for it to ensure the behaviour is maintained.

Reviewers: ruiu

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

llvm-svn: 323099

6 years ago[AArch64][SVE] Asm: Predicate patterns
Sander de Smalen [Mon, 22 Jan 2018 10:46:00 +0000 (10:46 +0000)]
[AArch64][SVE] Asm: Predicate patterns

Summary:
This patch adds support for parsing/printing of named or unnamed
patterns that are used in SVE's PTRUE instruction, amongst others.

The pattern can be specified as a named pattern to initialize the predicate
vector or it can be specified as an immediate in the range 0-31.

Reviewers: fhahn, rengolin, evandro, mcrosier, t.p.northover

Reviewed By: fhahn

Subscribers: aemerson, javed.absar, tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 323098

6 years ago[YAML] Plain scalars can not begin with most indicators.
Haojian Wu [Mon, 22 Jan 2018 10:20:48 +0000 (10:20 +0000)]
[YAML] Plain scalars can not begin with most indicators.

Summary:
Discovered when clangd loads YAML symbols, some symbol documentations
start with indicators (e.g. "-"), but YAML prints them as plain scalars
(no quotes), which make the YAML parser fail to parse.

For these kind of strings, we need quotes.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, llvm-commits, cfe-commits

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

llvm-svn: 323097

6 years agoBreak false dependencies for POPCNT, LZCNT, TZCNT
Marina Yatsina [Mon, 22 Jan 2018 10:07:01 +0000 (10:07 +0000)]
Break false dependencies for POPCNT, LZCNT, TZCNT

Add POPCNT, LZCNT, TZCNT to the list of instructions that have false dependency.
Add a test to make sure BreakFalseDeps breaks the dependencies for these instructions.
Update affected tests.

This fixes bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869

This is the final of multiple patches that fix this bugzilla.
Most of the patches are intended at refactoring the existent code.

Reviews of the refactoring done to enable this change:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333

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

Change-Id: If95cbf1a3f5c7dccff8f1b22ecb397542147303d
llvm-svn: 323096

6 years agoSeparate LoopTraversal, ReachingDefAnalysis and BreakFalseDeps into their own files.
Marina Yatsina [Mon, 22 Jan 2018 10:06:50 +0000 (10:06 +0000)]
Separate LoopTraversal, ReachingDefAnalysis and BreakFalseDeps into their own files.

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40334

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

Change-Id: Ie5f8eb34d98cfdfae23a3072eb69b5794f0e2d56
llvm-svn: 323095

6 years agoRename ExecutionDepsFix files to ExecutionDomainFix
Marina Yatsina [Mon, 22 Jan 2018 10:06:33 +0000 (10:06 +0000)]
Rename ExecutionDepsFix files to ExecutionDomainFix

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I6a048cca7fdafbfc42fb1bac94343e483befded8
llvm-svn: 323094

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:06:18 +0000 (10:06 +0000)]
ExecutionDepsFix refactoring:
- clang-format

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I131b126af13bc743bc5d69d83699e52b9b720979
llvm-svn: 323093

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:06:10 +0000 (10:06 +0000)]
ExecutionDepsFix refactoring:
- Moving comments to class definition in header file
- Changing comments to doxygen style
- Rephrase loop traversal explaining comment

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I9a12618db5b66128611fa71b54a233414f6012ac
llvm-svn: 323092

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:06:01 +0000 (10:06 +0000)]
ExecutionDepsFix refactoring:
- Removing LiveRegs

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I8ab56d99951a6d6981542f68d94c1f624f3c9fbf
llvm-svn: 323091

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:05:53 +0000 (10:05 +0000)]
ExecutionDepsFix refactoring:
- Changing LiveRegs to be a vector

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I9cdd364bd7bf2a0bf61ea41a48d4bd310ec3bce4
llvm-svn: 323090

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:05:45 +0000 (10:05 +0000)]
ExecutionDepsFix refactoring:
- Changing DenseMap<MBB*, LiveReg*> to SmallVector<LiveReg*>
- Now the MBB number will be the index of LiveReg in the vector.
- Adding asserts

This patch is NFC.

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: If4a3f141693d0361ddb292432337dbb63a1e69ee
llvm-svn: 323089

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:05:37 +0000 (10:05 +0000)]
ExecutionDepsFix refactoring:
- Remove unneeded includes and unneeded members
- Use range iterators
- Variable renaming, typedefs, extracting constants
- Removing {} from one line ifs

This patch is NFC.

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: Ib59060ab3fa5bee3bf2ca2045c24e572635ee7f6
llvm-svn: 323088

6 years agoSeparate ExecutionDepsFix into 4 parts:
Marina Yatsina [Mon, 22 Jan 2018 10:05:23 +0000 (10:05 +0000)]
Separate ExecutionDepsFix into 4 parts:
1. ReachingDefsAnalysis - Allows to identify for each instruction what is the “closest” reaching def of a certain register. Used by BreakFalseDeps (for clearance calculation) and ExecutionDomainFix (for arbitrating conflicting domains).
2. ExecutionDomainFix - Changes the variant of the instructions in order to minimize domain crossings.
3. BreakFalseDeps - Breaks false dependencies.
4. LoopTraversal - Creatws a traversal order of the basic blocks that is optimal for loops (introduced in revision L293571). Both ExecutionDomainFix and ReachingDefsAnalysis use this to determine the order they will traverse the basic blocks.

This also included the following changes to ExcecutionDepsFix original logic:
1. BreakFalseDeps and ReachingDefsAnalysis logic no longer restricted by a register class.
2. ReachingDefsAnalysis tracks liveness of reg units instead of reg indices into a given reg class.

Additional changes in affected files:
1. X86 and ARM targets now inherit from ExecutionDomainFix instead of ExecutionDepsFix. BreakFalseDeps also was added to the passes they activate.
2. Comments and references to ExecutionDepsFix replaced with ExecutionDomainFix and BreakFalseDeps, as appropriate.

Additional refactoring changes will follow.

This commit is (almost) NFC.
The only functional change is that now BreakFalseDeps will break dependency for all register classes.
Since no additional instructions were added to the list of instructions that have false dependencies, there is no actual change yet.
In a future commit several instructions (and tests) will be added.

This is the first of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: Icaeb75e014eff96a8f721377783f9a3e6c679275
llvm-svn: 323087

6 years agoFix TestTargetSymbolsAddCommand [getBuildArtifact refactor]
Pavel Labath [Mon, 22 Jan 2018 09:55:30 +0000 (09:55 +0000)]
Fix TestTargetSymbolsAddCommand [getBuildArtifact refactor]

llvm-svn: 323086

6 years agoFix memory leaks in MinidumpParserTest
Raphael Isemann [Mon, 22 Jan 2018 09:48:40 +0000 (09:48 +0000)]
Fix memory leaks in MinidumpParserTest

Summary: We never delete the allocated RegisterContext objects, causing those tests to fail with enabled memory sanitizer.

Reviewers: dvlahovski, zturner

Reviewed By: zturner

Subscribers: zturner, lldb-commits

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

llvm-svn: 323085

6 years ago[BinaryFormat] Add .debug_names support
Pavel Labath [Mon, 22 Jan 2018 09:41:36 +0000 (09:41 +0000)]
[BinaryFormat] Add .debug_names support

Summary:
This adds a definition of the .debug_names section and the new constants
(DW_IDX_???) which are used in it.

Reviewers: JDevlieghere, aprantl

Subscribers: llvm-commits

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

llvm-svn: 323084

6 years ago[lsan] Respect log_path option in standalone LSan
Maxim Ostapenko [Mon, 22 Jan 2018 09:30:27 +0000 (09:30 +0000)]
[lsan] Respect log_path option in standalone LSan

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

llvm-svn: 323083

6 years agoFix use after free in DiskFilesOrDirectories
Raphael Isemann [Mon, 22 Jan 2018 09:17:16 +0000 (09:17 +0000)]
Fix use after free in DiskFilesOrDirectories

Summary:
We copy the local variable `Resolved` into `Storage` to keep it around. However, we then still let the `SearchDir` ref point to `Resolved` which then is used to access the already freed memory later on. With this patch we point to `Storage` which doesn't get deleted after the current scope exits.

Discovered by memory sanitizer in the CompletionTest.DirCompletionUsername test.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 323082

6 years agoFix unrepresentable float value in ScalarTest
Raphael Isemann [Mon, 22 Jan 2018 08:11:29 +0000 (08:11 +0000)]
Fix unrepresentable float value in ScalarTest

Summary: float can't represent the given value in the literal, so we get this UB error: `runtime error: 1.23457e+48 is outside the range of representable values of type 'float'`. The test seems to not rely on this specific value, so let's just choose a smaller one that can be represented.

Reviewers: uweigand

Subscribers: lldb-commits

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

llvm-svn: 323081

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Mon, 22 Jan 2018 07:51:37 +0000 (07:51 +0000)]
[NFC] fix trivial typos in comments

"the the" -> "the"

llvm-svn: 323080

6 years agoRevert [SCEV] Fix isLoopEntryGuardedByCond usage
Serguei Katkov [Mon, 22 Jan 2018 07:47:02 +0000 (07:47 +0000)]
Revert [SCEV] Fix isLoopEntryGuardedByCond usage

It causes buildbot failures. New added assert is fired.
It seems not all usages of isLoopEntryGuardedByCond are fixed.

llvm-svn: 323079

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Mon, 22 Jan 2018 07:44:38 +0000 (07:44 +0000)]
[NFC] fix trivial typos in comments

"the the" -> "the"

llvm-svn: 323078

6 years ago[SCEV] Fix isLoopEntryGuardedByCond usage
Serguei Katkov [Mon, 22 Jan 2018 07:31:41 +0000 (07:31 +0000)]
[SCEV] Fix isLoopEntryGuardedByCond usage

ScalarEvolution::isKnownPredicate invokes isLoopEntryGuardedByCond without check
that SCEV is available at entry point of the loop. It is incorrect and fixed by patch.

Reviewers: sanjoy, mkazantsev, anna, dorit
Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42165

llvm-svn: 323077

6 years agoFix memory leaks in TestArm64InstEmulation
Raphael Isemann [Mon, 22 Jan 2018 07:22:13 +0000 (07:22 +0000)]
Fix memory leaks in TestArm64InstEmulation

Summary: We never delete the created instances, so those test fail with the memory sanitizer.

Reviewers: jasonmolenda

Reviewed By: jasonmolenda

Subscribers: aemerson, javed.absar, kristof.beyls, lldb-commits

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

llvm-svn: 323076

6 years agoMake loop counter unsigned in SymbolFilePDB::GetCompileUnitIndex
Raphael Isemann [Mon, 22 Jan 2018 06:56:09 +0000 (06:56 +0000)]
Make loop counter unsigned in SymbolFilePDB::GetCompileUnitIndex

Summary: This fixes a clang warning.

Reviewers: zturner

Reviewed By: zturner

Subscribers: zturner, lldb-commits

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

llvm-svn: 323075

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Mon, 22 Jan 2018 05:54:46 +0000 (05:54 +0000)]
[NFC] fix trivial typos in comments

"the the" -> "the"

llvm-svn: 323074

6 years ago[ORC] Add orc::SymbolResolver, a Orc/Legacy API interop header, and an
Lang Hames [Mon, 22 Jan 2018 03:00:31 +0000 (03:00 +0000)]
[ORC] Add orc::SymbolResolver, a Orc/Legacy API interop header, and an
orc::SymbolResolver to JITSymbolResolver adapter.

The new orc::SymbolResolver interface uses asynchronous queries for better
performance. (Asynchronous queries with bulk lookup minimize RPC/IPC overhead,
support parallel incoming queries, and expose more available work for
distribution). Existing ORC layers will soon be updated to use the
orc::SymbolResolver API rather than the legacy llvm::JITSymbolResolver API.

Because RuntimeDyld still uses JITSymbolResolver, this patch also includes an
adapter that wraps an orc::SymbolResolver with a JITSymbolResolver API.

llvm-svn: 323073

6 years agoReally comment out the constexpr tests.
Marshall Clow [Mon, 22 Jan 2018 01:51:49 +0000 (01:51 +0000)]
Really comment out the constexpr tests.

llvm-svn: 323072

6 years agoChange a static_assert to check for is_trivial instead of is_pod, as is mandated...
Marshall Clow [Mon, 22 Jan 2018 00:17:48 +0000 (00:17 +0000)]
Change a static_assert to check for is_trivial instead of is_pod, as is mandated by P0767.

llvm-svn: 323071

6 years agoimplement (but leave commented out) the constexpr tests from P0202 for std::merge...
Marshall Clow [Mon, 22 Jan 2018 00:11:44 +0000 (00:11 +0000)]
implement (but leave commented out) the constexpr tests from P0202 for std::merge. merge requires std::copy, which isn't constexpr yet.

llvm-svn: 323070

6 years agoClean up #include "DWARFCompileUnit.h"
Jan Kratochvil [Sun, 21 Jan 2018 18:03:17 +0000 (18:03 +0000)]
Clean up #include "DWARFCompileUnit.h"

Clean up needless+missing #include "DWARFCompileUnit.h" for split of
DWARFCompileUnit to DWARFUnit as discussed in D40466.

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

llvm-svn: 323069

6 years ago[InstCombine] (X << Y) / X -> 1 << Y
Sanjay Patel [Sun, 21 Jan 2018 16:14:51 +0000 (16:14 +0000)]
[InstCombine] (X << Y) / X -> 1 << Y

...when the shift is known to not overflow with the matching
signed-ness of the division.

This closes an optimization gap caused by canonicalizing mul
by power-of-2 to shl as shown in PR35709:
https://bugs.llvm.org/show_bug.cgi?id=35709

Patch by Anton Bikineev!

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

llvm-svn: 323068

6 years ago[InstSimplify] add baseline tests for (X << Y) % X -> 0; NFC
Sanjay Patel [Sun, 21 Jan 2018 15:36:15 +0000 (15:36 +0000)]
[InstSimplify] add baseline tests for (X << Y) % X -> 0; NFC

This is the 'rem' counterpart to D42032 and would be folded by
D42341.

Patch by Anton Bikineev.

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

llvm-svn: 323067

6 years agoTemporarily revert r323062 to investigate buildbot failures
Eugene Leviant [Sun, 21 Jan 2018 10:22:19 +0000 (10:22 +0000)]
Temporarily revert r323062 to investigate buildbot failures

llvm-svn: 323065

6 years ago[modules] Fix missing includes/typo in LLDB's includes. [NFC]
Raphael Isemann [Sun, 21 Jan 2018 09:54:19 +0000 (09:54 +0000)]
[modules] Fix missing includes/typo in LLDB's includes. [NFC]

Summary:
This patch adds missing includes to the LLDB headers inside `include/` as a first step of building LLDB's source with C++ modules. It also fixes this single `stds::` typo.

Some quick map why some non-obvious includes were necessary:
* lldb/lldb-defines.h for LLDB_INVALID_ADDRESS
* lldb/lldb-types.h for addr_t
* lldb/lldb-defines.h for DISALLOW_COPY_AND_ASSIG
* lldb/DataFormatters/TypeSynthetic.h for SyntheticChildrenFrontEnd

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: zturner, lldb-commits

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

llvm-svn: 323064

6 years agoAn attempt to fix buildbot after rL323062
Eugene Leviant [Sun, 21 Jan 2018 08:49:07 +0000 (08:49 +0000)]
An attempt to fix buildbot after rL323062

llvm-svn: 323063

6 years ago[ThinLTO] Implement summary visualizer
Eugene Leviant [Sun, 21 Jan 2018 07:27:32 +0000 (07:27 +0000)]
[ThinLTO] Implement summary visualizer

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

llvm-svn: 323062

6 years ago[sanitizer] Pass the CMake compiler to custom libc++ build
Petr Hosek [Sun, 21 Jan 2018 03:22:22 +0000 (03:22 +0000)]
[sanitizer] Pass the CMake compiler to custom libc++ build

This addresses the error introduced in r323054 on some bots.

llvm-svn: 323061

6 years ago[ORC] Add a lookupFlags method to VSO.
Lang Hames [Sun, 21 Jan 2018 03:20:39 +0000 (03:20 +0000)]
[ORC] Add a lookupFlags method to VSO.

lookupFlags returns a SymbolFlagsMap for the requested symbols, along with a
set containing the SymbolStringPtr for any symbol not found in the VSO.

The JITSymbolFlags for each symbol will have been stripped of its transient
JIT-state flags (i.e. NotMaterialized, Materializing).

Calling lookupFlags does not trigger symbol materialization.

llvm-svn: 323060

6 years ago[ORC] More cleanup. NFC.
Lang Hames [Sun, 21 Jan 2018 03:20:36 +0000 (03:20 +0000)]
[ORC] More cleanup. NFC.

llvm-svn: 323059

6 years ago[Dominators] Remove misleading double-deletion test
Jakub Kuderski [Sun, 21 Jan 2018 03:07:16 +0000 (03:07 +0000)]
[Dominators] Remove misleading double-deletion test

Summary:
It's generally not safe to perform multiple DomTree updates without using the incremental API.

Although it is supposed to work in this particular case, the testcase is misleading/confusing, and it's better to remove it.

Reviewers: dberlin, brzycki, davide, grosser

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 323058

6 years ago[ORC] Cleanup. NFC.
Lang Hames [Sun, 21 Jan 2018 02:24:45 +0000 (02:24 +0000)]
[ORC] Cleanup. NFC.

llvm-svn: 323057

6 years ago[DSE] Factor out common code [NFC]
Philip Reames [Sun, 21 Jan 2018 02:10:54 +0000 (02:10 +0000)]
[DSE] Factor out common code [NFC]

We already had the pointer being stored to in the MemLoc, reuse that code.  In merging cases, it turned out the interface of the getLocForWrite had become inconsitent with other related utilities.  Fix that by making sure the input passes hasAnalyzableWrite as well.

llvm-svn: 323056

6 years ago[DSE] Minor rename for clarity sake [NFC]
Philip Reames [Sun, 21 Jan 2018 01:44:33 +0000 (01:44 +0000)]
[DSE] Minor rename for clarity sake [NFC]

llvm-svn: 323055