platform/upstream/llvm.git
7 years ago[InstCombine][AVX-512] Teach InstCombineCalls how to handle the intrinsics for variab...
Craig Topper [Fri, 18 Nov 2016 06:04:33 +0000 (06:04 +0000)]
[InstCombine][AVX-512] Teach InstCombineCalls how to handle the intrinsics for variable shift with 16-bit elements.

This is a straightforward extension of the existing support for 32/64-bit element types. Just needed to add the additional instrinsics to the switches.

llvm-svn: 287316

7 years agoRemove an out param from ValueObject::GetValueForExpressionPath.
Zachary Turner [Fri, 18 Nov 2016 05:45:41 +0000 (05:45 +0000)]
Remove an out param from ValueObject::GetValueForExpressionPath.

This argument was only used in one place in the codebase, and
it was in a non-critical log statement and can be easily
substituted for an equally meaningful field instead.  The
payoff of computing this value is not worth the added
complexity.

llvm-svn: 287315

7 years agoSimplify MergeOutputSection.
Rui Ueyama [Fri, 18 Nov 2016 05:05:43 +0000 (05:05 +0000)]
Simplify MergeOutputSection.

MergeOutputSection class was a bit hard to use because it provdes
a series of finalize functions that have to be called in a right way
at a right time. It also intereacted with MergeInputSection, and the
logic was somewhat entangled between the two classes.

This patch simplifies it by providing only one finalize function.
Now, all you have to do is to call MergeOutputSection::finalize
when you have added all sections to the output section. Then, it
internally merges strings and initliazes StringPiece objects.
I think this is much easier to understand.

This patch also adds comments.

llvm-svn: 287314

7 years ago[AVX-512] Replace masked 16-bit element variable shift builtins with new unmasked...
Craig Topper [Fri, 18 Nov 2016 05:04:51 +0000 (05:04 +0000)]
[AVX-512] Replace masked 16-bit element variable shift builtins with new unmasked versions and selects.

llvm-svn: 287313

7 years ago[AVX-512] Replace masked 16-bit element variable shift intrinsics with new unmasked...
Craig Topper [Fri, 18 Nov 2016 05:04:44 +0000 (05:04 +0000)]
[AVX-512] Replace masked 16-bit element variable shift intrinsics with new unmasked versions and selects.

The same thing was done to 32-bit and 64-bit element sizes previously.

This will allow us to support these shuffls in InstCombineCalls along with the other variable shift intrinsics.

llvm-svn: 287312

7 years agoAMDGPU: Move redundant setting of inst properties
Matt Arsenault [Fri, 18 Nov 2016 04:42:59 +0000 (04:42 +0000)]
AMDGPU: Move redundant setting of inst properties

llvm-svn: 287311

7 years agoAMDGPU: Fix crash on illegal type for inlineasm
Matt Arsenault [Fri, 18 Nov 2016 04:42:57 +0000 (04:42 +0000)]
AMDGPU: Fix crash on illegal type for inlineasm

There are still crashes on non-MVT types in other
places.

llvm-svn: 287310

7 years ago[libc++] Fix preprocessor guard for overload declaration
Shoaib Meenai [Fri, 18 Nov 2016 04:31:09 +0000 (04:31 +0000)]
[libc++] Fix preprocessor guard for overload declaration

Fix a typo in the conditional.  Caught by going through list of removed
symbols when building with hidden visibility.

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

llvm-svn: 287309

7 years agoDelete more dead code in ValueObject.
Zachary Turner [Fri, 18 Nov 2016 04:30:47 +0000 (04:30 +0000)]
Delete more dead code in ValueObject.

Apparently these two enormous functions were dead.  Which is
good, since one was largely a copy of another function with
only a few minor tweaks.

llvm-svn: 287308

7 years agoRemove some dead code in ValueObject.
Zachary Turner [Fri, 18 Nov 2016 03:51:19 +0000 (03:51 +0000)]
Remove some dead code in ValueObject.

Originally I converted this entire function and all dependents
to use StringRef, but there were some test failures that
were tricky to track down, as this is a complicated function.
So I'm starting over, this time in smaller increments.

llvm-svn: 287307

7 years agoObject: Simplify; remove unnecessary use of unique_ptr.
Peter Collingbourne [Fri, 18 Nov 2016 03:20:36 +0000 (03:20 +0000)]
Object: Simplify; remove unnecessary use of unique_ptr.

llvm-svn: 287305

7 years agoMachineOperand: Add dump() method
Matthias Braun [Fri, 18 Nov 2016 02:40:40 +0000 (02:40 +0000)]
MachineOperand: Add dump() method

llvm-svn: 287302

7 years agoupdate Apples ABI list to ignore non-std symbols
Eric Fiselier [Fri, 18 Nov 2016 02:36:58 +0000 (02:36 +0000)]
update Apples ABI list to ignore non-std symbols

llvm-svn: 287301

7 years agoconvert bpf assembler to look like kernel verifier output
Alexei Starovoitov [Fri, 18 Nov 2016 02:32:35 +0000 (02:32 +0000)]
convert bpf assembler to look like kernel verifier output

since bpf instruction set was introduced people learned to
read and understand kernel verifier output whereas llvm asm
output stayed obscure and unknown. Convert llvm to emit
assembler text similar to kernel to avoid this discrepancy

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 287300

7 years ago[Docs][TableGen] Remove reference to tablegen supporting octal integers. It doesn...
Craig Topper [Fri, 18 Nov 2016 02:28:50 +0000 (02:28 +0000)]
[Docs][TableGen] Remove reference to tablegen supporting octal integers. It doesn't and hasn't for at least 9 years.

llvm-svn: 287299

7 years ago[AVX-512] Support FCOPYSIGN for v16f32 and v8f64
Craig Topper [Fri, 18 Nov 2016 02:25:34 +0000 (02:25 +0000)]
[AVX-512] Support FCOPYSIGN for v16f32 and v8f64

Summary:
This extends FCOPYSIGN support to 512-bit vectors.

I've also added tests to show what the 128-bit and 256-bit cases look like with broadcast loads.

Reviewers: delena, zvi, RKSimon, spatel

Subscribers: llvm-commits

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

llvm-svn: 287298

7 years ago[ELF] Rename an historical leftover, `Chunk` is now `InputSection`.
Davide Italiano [Fri, 18 Nov 2016 02:23:48 +0000 (02:23 +0000)]
[ELF] Rename an historical leftover, `Chunk` is now `InputSection`.

llvm-svn: 287297

7 years ago[ELF] Use std::for_each() and hoist common code in a lambda.
Davide Italiano [Fri, 18 Nov 2016 02:18:04 +0000 (02:18 +0000)]
[ELF] Use std::for_each() and hoist common code in a lambda.

llvm-svn: 287296

7 years agoAdd doxygen comments to fxsrintrin.h's intrinsics.
Ekaterina Romanova [Fri, 18 Nov 2016 01:42:01 +0000 (01:42 +0000)]
Add doxygen comments to fxsrintrin.h's intrinsics.

The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Paul Robinson and Charles Li.

llvm-svn: 287295

7 years agoChange sym_check to filter non-stdlib symbols.
Eric Fiselier [Fri, 18 Nov 2016 01:40:20 +0000 (01:40 +0000)]
Change sym_check to filter non-stdlib symbols.

Currently sym_check almost all names found in the binary, including those
which are defined in other libraries. This makes our ABI lists harder to maintain.

This patch adds a --only-stdlib-symbols option to sym_check which removes
all symbols which aren't possibly provided by libc++. It also re-generates
the linux ABI list after making this change.

llvm-svn: 287294

7 years agoAdd an option to disable libedit
Yichao Yu [Fri, 18 Nov 2016 01:25:49 +0000 (01:25 +0000)]
Add an option to disable libedit

Summary: This should provide the function similar to `--disable-libedit` with the autotools build system, which seems to be missing from the commit (r200595) that adds this.

Reviewers: pcc, beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 287293

7 years ago[CUDA] Attempt to fix test failures in cuda-macos-includes.cu.
Justin Lebar [Fri, 18 Nov 2016 01:11:32 +0000 (01:11 +0000)]
[CUDA] Attempt to fix test failures in cuda-macos-includes.cu.

Run clang -cc1 -E instead of -S, in an attempt to make this test work
cross-platform.

llvm-svn: 287292

7 years agoForward ns_consumed delegate arguments with a move.
John McCall [Fri, 18 Nov 2016 01:08:24 +0000 (01:08 +0000)]
Forward ns_consumed delegate arguments with a move.

StartFunction enters a release cleanup for ns_consumed arguments in
ARC, so we need to balance that somehow.  We could teach StartFunction
that it's emitting a delegating function, so that the cleanup is
unnecessary, but that would be invasive and somewhat fraught.  We could
balance the consumed argument with an extra retain, but clearing the
original variable should be easier to optimize and avoid some extra work
at -O0.  And there shouldn't be any difference as long as nothing else
uses the argument, which should always be true for the places we emit
delegate arguments.

Fixes PR 27887.

llvm-svn: 287291

7 years ago[CUDA] Update docs to indicate that MacOS is now supported.
Justin Lebar [Fri, 18 Nov 2016 00:42:00 +0000 (00:42 +0000)]
[CUDA] Update docs to indicate that MacOS is now supported.

llvm-svn: 287290

7 years ago[CUDA] Update docs; CUDA 8.0 is supported as of a while ago.
Justin Lebar [Fri, 18 Nov 2016 00:41:40 +0000 (00:41 +0000)]
[CUDA] Update docs; CUDA 8.0 is supported as of a while ago.

llvm-svn: 287289

7 years ago[CUDA] Wrapper header changes necessary to support MacOS.
Justin Lebar [Fri, 18 Nov 2016 00:41:35 +0000 (00:41 +0000)]
[CUDA] Wrapper header changes necessary to support MacOS.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287288

7 years ago[CUDA] Use the right section and constant names for fatbins when compiling for macos.
Justin Lebar [Fri, 18 Nov 2016 00:41:31 +0000 (00:41 +0000)]
[CUDA] Use the right section and constant names for fatbins when compiling for macos.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287287

7 years ago[CUDA] Initialize our header search using the host triple.
Justin Lebar [Fri, 18 Nov 2016 00:41:27 +0000 (00:41 +0000)]
[CUDA] Initialize our header search using the host triple.

Summary:
This used to work because system headers are found in a (somewhat)
predictable set of locations on Linux.  But this is not the case on
MacOS; without this change, we don't look in the right places for our
headers when doing device-side compilation on Mac.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287286

7 years ago[CUDA] Driver changes to support CUDA compilation on MacOS.
Justin Lebar [Fri, 18 Nov 2016 00:41:22 +0000 (00:41 +0000)]
[CUDA] Driver changes to support CUDA compilation on MacOS.

Summary:
Compiling CUDA device code requires us to know the host toolchain,
because CUDA device-side compiles pull in e.g. host headers.

When we only supported Linux compilation, this worked because
CudaToolChain, which is responsible for device-side CUDA compilation,
inherited from the Linux toolchain.  But in order to support MacOS,
CudaToolChain needs to take a HostToolChain pointer.

Because a CUDA toolchain now requires a host TC, we no longer will
create a CUDA toolchain from Driver::getToolChain -- you have to go
through CreateOffloadingDeviceToolChains.  I am *pretty* sure this is
correct, and that previously any attempt to create a CUDA toolchain
through getToolChain() would eventually have resulted in us throwing
"error: unsupported use of NVPTX for host compilation".

In any case hacking getToolChain to create a CUDA+host toolchain would
be wrong, because a Driver can be reused for multiple compilations,
potentially with different host TCs, and getToolChain will cache the
result, causing us to potentially use a stale host TC.

So that's the main change in this patch.

In addition, we have to pull CudaInstallationDetector out of Generic_GCC
and into a top-level class.  It's now used by the Generic_GCC and MachO
toolchains.

Reviewers: tra

Subscribers: rryan, hfinkel, sfantao

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

llvm-svn: 287285

7 years agoAdd missing REQUIRES.
Rafael Espindola [Fri, 18 Nov 2016 00:11:12 +0000 (00:11 +0000)]
Add missing REQUIRES.

llvm-svn: 287284

7 years agoEHABI: mark some functions as exported
Saleem Abdulrasool [Thu, 17 Nov 2016 23:53:35 +0000 (23:53 +0000)]
EHABI: mark some functions as exported

These are part of the EHABI specification and are exported to be available to
users.  Mark them as `_LIBUNWIND_EXPORT` like the rest of the unwind interfaces.

llvm-svn: 287283

7 years agoResubmit "Change RegisterValue getters / setters to use StringRef."
Zachary Turner [Thu, 17 Nov 2016 23:47:31 +0000 (23:47 +0000)]
Resubmit "Change RegisterValue getters / setters to use StringRef."

This resubmits r287279 with a fix for the original issue, which
was a trivial typo.

llvm-svn: 287282

7 years agoRevert "Change RegisterValue getters / setters to use StringRef."
Zachary Turner [Thu, 17 Nov 2016 23:32:26 +0000 (23:32 +0000)]
Revert "Change RegisterValue getters / setters to use StringRef."

This reverts commit r287279, which breaks some register
tests on Linux.

llvm-svn: 287281

7 years agoAlways compute sh_link for SHF_LINK_ORDER sections.
Rafael Espindola [Thu, 17 Nov 2016 23:16:39 +0000 (23:16 +0000)]
Always compute sh_link for SHF_LINK_ORDER sections.

Since the output has a section table too, it is meaningful to compute
the sh_link. In a more practical note, the binutils' strip crashes if
sh_link is not set for SHT_ARM_EXIDX.

llvm-svn: 287280

7 years agoChange RegisterValue getters / setters to use StringRef.
Zachary Turner [Thu, 17 Nov 2016 23:05:28 +0000 (23:05 +0000)]
Change RegisterValue getters / setters to use StringRef.

In the process, found some functions that were duplicates of
existing StringRef member functions.  So deleted those functions
and used the StringRef functions instead.

llvm-svn: 287279

7 years agoMinor changes in x86 intrinsics headers; NFC
Ekaterina Romanova [Thu, 17 Nov 2016 23:02:00 +0000 (23:02 +0000)]
Minor changes in x86 intrinsics headers; NFC

I made several changes for consistency with the rest of x86 instrinsics header files. Some of these changes help to render doxygen comments better.

1. avxintrin.h –  Moved the opening bracket on a separate line for several
                  intrinsics (for consistency with the rest of the intrinsics).

2. emmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added braces after extern "C"  even though there is only
                  one declaration each time

3. xmmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added intrinsic prototypes for a couple of macro definitions
                  into the doxygen comment;
               -  Added braces after extern "C"  even though there is only one
                  declaration each time

4. ammintrin.h –  Removed extra line between the doxygen comment and the body
                  of the functions (for consistency with the rest of the files).

Desk reviewed by Paul Robinson.

llvm-svn: 287278

7 years ago[lli] Prefer `exit(1)` to `return 1` for consistency.
Davide Italiano [Thu, 17 Nov 2016 22:59:13 +0000 (22:59 +0000)]
[lli] Prefer `exit(1)` to `return 1` for consistency.

llvm-svn: 287277

7 years ago[lli] Factor out error handling. NFCI.
Davide Italiano [Thu, 17 Nov 2016 22:58:13 +0000 (22:58 +0000)]
[lli] Factor out error handling. NFCI.

llvm-svn: 287276

7 years ago[Preprocessor] Support for '-dI' flag
Bruno Cardoso Lopes [Thu, 17 Nov 2016 22:45:31 +0000 (22:45 +0000)]
[Preprocessor] Support for '-dI' flag

Re-introduce r285411.

Implement the -dI as supported by GCC: Output ‘#include’ directives in addition
to the result of preprocessing.

This change aims to add this option, pass it through to the preprocessor via
the options class, and when inclusions occur we output some information (+ test
cases).

Patch by Steve O'Brien!

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

llvm-svn: 287275

7 years agoFix step-over when SymbolContext.function is missing and symbol is present.
Sam McCall [Thu, 17 Nov 2016 22:29:31 +0000 (22:29 +0000)]
Fix step-over when SymbolContext.function is missing and symbol is present.

Summary:
Fix step-over when SymbolContext.function is missing and symbol is present.

With targets from our build configuration,
ThreadPlanStepOverRange::IsEquivalentContext fails to fire for relevant frames,
leading to ShouldStop() returning true prematurely.

The frame's SymbolContext, and m_addr_context have:
  - comp_unit set and matching
  - function = nullptr
  - symbol set and matching (but this is never checked)
My naive guess is that the context should be equivalent in this case :-)

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 287274

7 years ago[ReleaseNotes] Mention the completion of the upstreaming of the AVR backend
Dylan McKay [Thu, 17 Nov 2016 22:26:09 +0000 (22:26 +0000)]
[ReleaseNotes] Mention the completion of the upstreaming of the AVR backend

llvm-svn: 287273

7 years agoProbably overwritten loads should not be considered hoistable
Johannes Doerfert [Thu, 17 Nov 2016 22:25:17 +0000 (22:25 +0000)]
Probably overwritten loads should not be considered hoistable

Do not assume a load to be hoistable/invariant if the pointer is used by
another instruction in the SCoP that might write to memory and that is
always executed.

llvm-svn: 287272

7 years ago[NFC] Add flag to disable error block assumptions
Johannes Doerfert [Thu, 17 Nov 2016 22:16:35 +0000 (22:16 +0000)]
[NFC] Add flag to disable error block assumptions

The declaration as an "error block" is currently aggressive and not very
smart. This patch allows to disable error blocks completely. This might
be useful to prevent SCoP expansion to a point where the assumed context
becomes infeasible, thus the SCoP has to be discarded.

llvm-svn: 287271

7 years ago[FIX] Do not try to hoist memory intrinsic
Johannes Doerfert [Thu, 17 Nov 2016 22:11:56 +0000 (22:11 +0000)]
[FIX] Do not try to hoist memory intrinsic

Since we do not necessarily treat memory intrinsics as non-affine
anymore, we have to check for them explicitly before we try to hoist an
access.

llvm-svn: 287270

7 years ago[NFC] Skip over trivial assumptions
Johannes Doerfert [Thu, 17 Nov 2016 22:08:40 +0000 (22:08 +0000)]
[NFC] Skip over trivial assumptions

Filter trivial assumptions, thus assume { : } or restrict { : 0 = 1 },
as they clutter the user output as well as the statistics.

llvm-svn: 287269

7 years ago[sanitizers] specifying style for global constant
Mike Aizatsky [Thu, 17 Nov 2016 21:57:43 +0000 (21:57 +0000)]
[sanitizers] specifying style for global constant

Subscribers: kubabrecka

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

llvm-svn: 287268

7 years ago[DBG] Collect statistics about actually versioned SCoPs
Johannes Doerfert [Thu, 17 Nov 2016 21:55:43 +0000 (21:55 +0000)]
[DBG] Collect statistics about actually versioned SCoPs

llvm-svn: 287267

7 years agoMake GetRegisterByName() take a StringRef.
Zachary Turner [Thu, 17 Nov 2016 21:54:37 +0000 (21:54 +0000)]
Make GetRegisterByName() take a StringRef.

This one is fairly trivial and only really involves changing
function signatures and a few simple call-sites.

llvm-svn: 287266

7 years ago[DBG] Allow to emit the RTC value at runtime
Johannes Doerfert [Thu, 17 Nov 2016 21:49:19 +0000 (21:49 +0000)]
[DBG] Allow to emit the RTC value at runtime

The new command line flag "polly-codegen-emit-rtc-print" can be used to
place a "printf" in the generated code that will print the RTC value and
the overflow state.

llvm-svn: 287265

7 years ago[ELF][MIPS] Remove 'mips' word from MipsGotSection fields and methods names. NFC
Simon Atanasyan [Thu, 17 Nov 2016 21:49:14 +0000 (21:49 +0000)]
[ELF][MIPS] Remove 'mips' word from MipsGotSection fields and methods names. NFC

Also add new comments with MIPS GOT description.

llvm-svn: 287264

7 years ago[DBG] Collect statistics about statically infeasible SCoPs
Johannes Doerfert [Thu, 17 Nov 2016 21:44:47 +0000 (21:44 +0000)]
[DBG] Collect statistics about statically infeasible SCoPs

llvm-svn: 287263

7 years ago[CrashReproducer][Darwin] Suggest attaching .crash diagnostic file
Bruno Cardoso Lopes [Thu, 17 Nov 2016 21:41:22 +0000 (21:41 +0000)]
[CrashReproducer][Darwin] Suggest attaching .crash diagnostic file

In addition to the preprocessed sources file and reproducer script, also
point to the .crash diagnostic files on Darwin. Example:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cpp
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cache
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.sh
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.crash

When no match is found for the .crash, point the user to a directory
where those can be found. Example:

clang-4.0: note: diagnostic msg: Crash backtrace is located in
clang-4.0: note: diagnostic msg: /Users/bruno/Library/Logs/DiagnosticReports/clang-4.0_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-4.0: note: diagnostic msg: (choose the .crash file that corresponds to your crash)

rdar://problem/27286266

llvm-svn: 287262

7 years ago[DBG] Collect statistics about taken assumptions
Johannes Doerfert [Thu, 17 Nov 2016 21:41:08 +0000 (21:41 +0000)]
[DBG] Collect statistics about taken assumptions

llvm-svn: 287261

7 years agoAllow use define symbols to override linker defined ones.
Rafael Espindola [Thu, 17 Nov 2016 21:20:16 +0000 (21:20 +0000)]
Allow use define symbols to override linker defined ones.

I hit an internal linker script that was defining _DYNAMIC instead of
letting the linker do it. It turns out that both bfd and gold allow
that.

This is pretty easy to implement, just make the linker defined symbol
weak. This should have no impact in the case where there is no user
defined symbol: The visibility is hidden, which causes the output to
still be local.

llvm-svn: 287260

7 years agoConvert Platform, Process, and Connection functions to StringRef.
Zachary Turner [Thu, 17 Nov 2016 21:15:14 +0000 (21:15 +0000)]
Convert Platform, Process, and Connection functions to StringRef.

All tests pass on Linux and Windows.

llvm-svn: 287259

7 years agoFixes for r287241. Use placement new. Apply clang-format.
Malcolm Parsons [Thu, 17 Nov 2016 21:00:09 +0000 (21:00 +0000)]
Fixes for r287241. Use placement new. Apply clang-format.

llvm-svn: 287258

7 years agoAllow SIZEOF() command on nonexistent section.
Rui Ueyama [Thu, 17 Nov 2016 20:27:10 +0000 (20:27 +0000)]
Allow SIZEOF() command on nonexistent section.

Linker script doesn't create a section if it has no content. So the following
script doesn't create .norelocs section if it doesn't have any .rel* sections.

  .norelocs : { *(.rel*) }

Later, if you assert that the size of .norelocs is 0, LLD printed out
an error message, because it didn't allow calling SIZEOF() on nonexistent
sections.

This patch allows SIZEOF() on nonexistent sections, so that you can do
something like this.

  ASSERT(SIZEOF(.norelocs), "shouldn't contain .rel sections!")

Note that this behavior is compatible with GNU.

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

llvm-svn: 287257

7 years ago[CMake] Error when LTO and lld are enabled on Darwin
Petr Hosek [Thu, 17 Nov 2016 20:22:49 +0000 (20:22 +0000)]
[CMake] Error when LTO and lld are enabled on Darwin

lld on Darwin does not currently support LTO.

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

llvm-svn: 287256

7 years agoWorkaround compilers w/o C++1z inline variables
Eric Fiselier [Thu, 17 Nov 2016 20:08:43 +0000 (20:08 +0000)]
Workaround compilers w/o C++1z inline variables

llvm-svn: 287255

7 years agoAdd single quotes to error messages.
Rui Ueyama [Thu, 17 Nov 2016 19:57:47 +0000 (19:57 +0000)]
Add single quotes to error messages.

llvm-svn: 287254

7 years agoUse consistent variable name.
Rui Ueyama [Thu, 17 Nov 2016 19:57:45 +0000 (19:57 +0000)]
Use consistent variable name.

llvm-svn: 287253

7 years agoUse llvm::reverse to get a reverse range.
Rui Ueyama [Thu, 17 Nov 2016 19:57:43 +0000 (19:57 +0000)]
Use llvm::reverse to get a reverse range.

llvm-svn: 287252

7 years agoRemove files missed in r287250
Eric Fiselier [Thu, 17 Nov 2016 19:24:34 +0000 (19:24 +0000)]
Remove files missed in r287250

llvm-svn: 287251

7 years agoImplement P0504R0: Revisiting in-place tag types for any/optional/variant
Eric Fiselier [Thu, 17 Nov 2016 19:24:04 +0000 (19:24 +0000)]
Implement P0504R0: Revisiting in-place tag types for any/optional/variant

llvm-svn: 287250

7 years agoTest changes for P0504R0 "Revisiting in-place tag types for any/optional/variant...
Eric Fiselier [Thu, 17 Nov 2016 19:23:35 +0000 (19:23 +0000)]
Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant". Patch from Casey Carter

llvm-svn: 287249

7 years agoFix spelling mistakes in Hexagon target comments. NFC.
Simon Pilgrim [Thu, 17 Nov 2016 19:21:20 +0000 (19:21 +0000)]
Fix spelling mistakes in Hexagon target comments. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287248

7 years agoFix spelling mistakes in X86 target comments. NFC.
Simon Pilgrim [Thu, 17 Nov 2016 19:03:05 +0000 (19:03 +0000)]
Fix spelling mistakes in X86 target comments. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287247

7 years ago[asan] Create a .ASAN$G(A-Z) section for global registration
Reid Kleckner [Thu, 17 Nov 2016 19:02:53 +0000 (19:02 +0000)]
[asan] Create a .ASAN$G(A-Z) section for global registration

Summary:
The expectation is that new instrumented code will add global variable
metadata to the .ASAN$GL section, and we will use this new code to
iterate over it.

This technique seems to break when using incremental linking, which
seems to align every global to a 256 byte boundary. Presumably this is
so that it can incrementally cope with global changing size. Clang
already passes -incremental:no as a linker flag when you invoke it to do
the link step.

The two tests added for this feature will fail until the LLVM
instrumentation change in D26770 lands, so they are marked XFAIL for
now.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits, mgorny

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

llvm-svn: 287246

7 years ago[tests] Use __SSE2__ (rather than __i686__...) for SSE2 ASAN test
Michal Gorny [Thu, 17 Nov 2016 18:41:54 +0000 (18:41 +0000)]
[tests] Use __SSE2__ (rather than __i686__...) for SSE2 ASAN test

Use the __SSE2__ to determine whether SSE2 is enabled in the ASAN tests
rather than relying on either of the __i686__ and __x86_64__. The former
is only set with explicit -march=i686, and therefore misses most of
the x86 CPUs that support SSE2. __SSE2__ is in turn defined if
the current settings (-march, -msse2) indicate that SSE2 is supported
which should be more reliable.

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

llvm-svn: 287245

7 years agoObjC Module: try to make objc module deterministic.
Manman Ren [Thu, 17 Nov 2016 18:41:18 +0000 (18:41 +0000)]
ObjC Module: try to make objc module deterministic.

Make sure that comparing selectors in DeclarationName does its job.
rdar://problem/28988750

llvm-svn: 287244

7 years ago[CodeView] Fix some Clang-tidy modernize-use-default, modernize-use-override and...
Eugene Zelenko [Thu, 17 Nov 2016 18:11:21 +0000 (18:11 +0000)]
[CodeView] Fix some Clang-tidy modernize-use-default, modernize-use-override and Include What You Use warnings; other minor fixes (NFC).

Per Zachary Turner and Mehdi Amini suggestion to make only post-commit reviews.

llvm-svn: 287243

7 years agoRewrite all Property related functions in terms of StringRef.
Zachary Turner [Thu, 17 Nov 2016 18:08:12 +0000 (18:08 +0000)]
Rewrite all Property related functions in terms of StringRef.

This was a bit tricky, especially for things like
OptionValueArray and OptionValueDictionary since they do some
funky string parsing.  Rather than try to re-write line-by-line
I tried to make the StringRef usage idiomatic, even though
it meant often re-writing from scratch large blocks of code
in a different way while keeping true to the original intent.

The finished code is a big improvement though, and often much
shorter than the original code.  All tests and unit tests
pass on Windows and Linux.

llvm-svn: 287242

7 years agoUse unique_ptr for cached tokens for default arguments in C++.
Malcolm Parsons [Thu, 17 Nov 2016 17:52:58 +0000 (17:52 +0000)]
Use unique_ptr for cached tokens for default arguments in C++.

Summary:
This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs.  There was a fixme in the code where the cached tokens are created  about using a smart pointer.

The change is straightforward, though I did have to track down and fix a memory corruption caused by the change.  memcpy was being used to copy parameter information.  This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely.

Patch by David Tarditi!

Reviewers: malcolm.parsons

Subscribers: arphaman, malcolm.parsons, cfe-commits

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

llvm-svn: 287241

7 years ago[libFuzzer] better documentation for -fsanitize-coverage=trace-cmp
Kostya Serebryany [Thu, 17 Nov 2016 17:31:54 +0000 (17:31 +0000)]
[libFuzzer] better documentation for -fsanitize-coverage=trace-cmp

llvm-svn: 287240

7 years agoSema: correct typo correction for ivars in @implementation
Saleem Abdulrasool [Thu, 17 Nov 2016 17:10:54 +0000 (17:10 +0000)]
Sema: correct typo correction for ivars in @implementation

The previous typo correction handling assumed that ivars are only declared in
the interface declaration rather than as a private ivar in the implementation.
Adjust the handling to permit both interfaces.  Assert earlier that the
interface has been acquired to ensure that we can identify when both possible
casts have failed.

Addresses PR31040!

llvm-svn: 287238

7 years agoEnable -threads by default.
Rui Ueyama [Thu, 17 Nov 2016 17:06:51 +0000 (17:06 +0000)]
Enable -threads by default.

LLD supports multi-threading, and it seems to be working well as
you can see in r287140. In short, LLD runs a few percent to 30%
faster with -threads and more than 50% faster if you are using
-build-id (your mileage may vary depending on your computer).

However, I don't think most users even don't know about that because
-threads is not a default option.

This patch enables it by default.

Discussion thread:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/107160.html

llvm-svn: 287237

7 years ago[asan] Update the tests as Mach-O metadata liveness tracking is on by default
Anna Zaks [Thu, 17 Nov 2016 16:56:11 +0000 (16:56 +0000)]
[asan] Update the tests as Mach-O metadata liveness tracking is on by default

This commit reverts r274579.

llvm-svn: 287236

7 years ago[asan] Turn on Mach-O global metadata liveness tracking by default
Anna Zaks [Thu, 17 Nov 2016 16:55:40 +0000 (16:55 +0000)]
[asan] Turn on Mach-O global metadata liveness tracking by default

This patch turns on the metadata liveness tracking since all known issues
have been resolved. The future has been implemented in
https://reviews.llvm.org/D16737 and enables support of dead code stripping
option on Mach-O platforms.

As part of enabling the feature, I also plan on reverting the following
patch to compiler-rt:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160704/369910.html

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

llvm-svn: 287235

7 years agoPass StringRefs instead of StringMatcher because it's simpler.
Rui Ueyama [Thu, 17 Nov 2016 16:48:53 +0000 (16:48 +0000)]
Pass StringRefs instead of StringMatcher because it's simpler.

llvm-svn: 287234

7 years agoRevert "AMDGPU: Enable ConstrainCopy DAG mutation"
Konstantin Zhuravlyov [Thu, 17 Nov 2016 16:41:49 +0000 (16:41 +0000)]
Revert "AMDGPU: Enable ConstrainCopy DAG mutation"

This reverts commit r287146.

This breaks few conformance tests.

llvm-svn: 287233

7 years ago[SCEV] limit recursion depth of CompareSCEVComplexity
Daniil Fukalov [Thu, 17 Nov 2016 16:07:52 +0000 (16:07 +0000)]
[SCEV] limit recursion depth of CompareSCEVComplexity

Summary:
CompareSCEVComplexity goes too deep (50+ on a quite a big unrolled loop) and runs almost infinite time.

Added cache of "equal" SCEV pairs to earlier cutoff of further estimation. Recursion depth limit was also introduced as a parameter.

Reviewers: sanjoy

Subscribers: mzolotukhin, tstellarAMD, llvm-commits

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

llvm-svn: 287232

7 years agoSimplify. NFC.
Rafael Espindola [Thu, 17 Nov 2016 15:29:11 +0000 (15:29 +0000)]
Simplify. NFC.

llvm-svn: 287231

7 years ago[include-fixer] Add a test for the full round trip through libclang and the plugin.
Benjamin Kramer [Thu, 17 Nov 2016 15:23:06 +0000 (15:23 +0000)]
[include-fixer] Add a test for the full round trip through libclang and the plugin.

llvm-svn: 287230

7 years agoLink include-fixer into libclang if clang-tools-extra is checked out.
Benjamin Kramer [Thu, 17 Nov 2016 15:22:36 +0000 (15:22 +0000)]
Link include-fixer into libclang if clang-tools-extra is checked out.

include-fixer only slightly bloats the size of libclang, but since
libclang has no explicit plugin mechanism it's the only way of getting
this to work. Clang-tidy is already there and so far there weren't many
complaints ;)

This is designed to be easy to remove again if libclang ever grows
proper plugin support.

llvm-svn: 287229

7 years ago[include-fixer] Refactor include fixer to be usable as a plugin
Benjamin Kramer [Thu, 17 Nov 2016 15:16:05 +0000 (15:16 +0000)]
[include-fixer] Refactor include fixer to be usable as a plugin

- Refactor the external sema source into a visible class
- Add support for emitting FixIts
- Wrap up include fixer as a plugin as I did with clang-tidy

Test case will follow as soon as I wire this up in libclang.

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

llvm-svn: 287228

7 years ago[OPENMP] Fixed codegen for 'omp cancel' construct.
Alexey Bataev [Thu, 17 Nov 2016 15:12:05 +0000 (15:12 +0000)]
[OPENMP] Fixed codegen for 'omp cancel' construct.

If 'omp cancel' construct is used in a worksharing construct it may
cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled.

llvm-svn: 287227

7 years ago[docs] Remove doubled spaces
Malcolm Parsons [Thu, 17 Nov 2016 14:26:45 +0000 (14:26 +0000)]
[docs] Remove doubled spaces

Reviewers: aaron.ballman

Subscribers: nemanjai, cfe-commits

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

llvm-svn: 287226

7 years agoAvoid accessing an end() iterator.
Rafael Espindola [Thu, 17 Nov 2016 14:18:08 +0000 (14:18 +0000)]
Avoid accessing an end() iterator.

llvm-svn: 287225

7 years agoWdocumentation fix
Simon Pilgrim [Thu, 17 Nov 2016 12:21:45 +0000 (12:21 +0000)]
Wdocumentation fix

llvm-svn: 287224

7 years ago[X86][SSE] Improve lowering of vXi64 multiply with known zero 32-bit halves
Simon Pilgrim [Thu, 17 Nov 2016 12:14:49 +0000 (12:14 +0000)]
[X86][SSE] Improve lowering of vXi64 multiply with known zero 32-bit halves

vXi64 multiplication is lowered into 3 calls of vpmuludq with the upper/lower 32-bit halves.

If any of these halves are zero then we can remove individual calls. Although there was isBuildVectorAllZeros code to do this I don't think it ever worked (maybe just for constant folded cases that don't seem to be tested for any longer).

This requires additional X86ISD support for computeKnownBitsForTargetNode, so far I've just added support for X86ISD::VZEXT (VPMOVZX* - helping the AVX2+ cases).

Partial fix for PR30845

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

llvm-svn: 287223

7 years agoFix spelling in comment. NFC.
Simon Pilgrim [Thu, 17 Nov 2016 12:03:05 +0000 (12:03 +0000)]
Fix spelling in comment. NFC.

llvm-svn: 287222

7 years ago[clang-tidy] Ignore template instantiations in modernize-use-equals-delete check
Malcolm Parsons [Thu, 17 Nov 2016 11:40:02 +0000 (11:40 +0000)]
[clang-tidy] Ignore template instantiations in modernize-use-equals-delete check

Summary: Template instantiations were causing misplaced fixits.

Reviewers: aaron.ballman, alexfh, hokein

Subscribers: hokein, cfe-commits

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

llvm-svn: 287221

7 years ago[cmake] Move LLVM_BUILD_STATIC check to an earlier point
Pavel Labath [Thu, 17 Nov 2016 11:22:23 +0000 (11:22 +0000)]
[cmake] Move LLVM_BUILD_STATIC check to an earlier point

Summary:
The motivation for this is to enable correct detection of dlopen() on Android.
Android does not provide a static version of libdl, so if we add the -static flag
after performing the check, it will succeed even though subsequent link steps
will fail. With this change we correctly detect the absence of libdl in a
LLVM_BUILD_STATIC build on Android.

The link itself still does not succeed because the code does not check the result
of this check properly, but I plan to fix that in a separate change.

Reviewers: beanz

Subscribers: danalbert, mgorny, srhines, tberghammer, llvm-commits

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

llvm-svn: 287220

7 years ago[ARM] Relax restriction on variadic functions for tailcall optimization
Pablo Barrio [Thu, 17 Nov 2016 10:56:58 +0000 (10:56 +0000)]
[ARM] Relax restriction on variadic functions for tailcall optimization

Summary:
Variadic functions can be treated in the same way as normal functions
with respect to the number and types of parameters.

Reviewers: grosbach, olista01, t.p.northover, rengolin

Subscribers: javed.absar, aemerson, llvm-commits

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

llvm-svn: 287219

7 years ago[ELF] Remove unneeded forward declarations. NFC.
Eugene Leviant [Thu, 17 Nov 2016 10:34:05 +0000 (10:34 +0000)]
[ELF] Remove unneeded forward declarations. NFC.

llvm-svn: 287218

7 years ago[X86] RegCall - Handling v64i1 in 32/64 bit target
Oren Ben Simhon [Thu, 17 Nov 2016 09:59:40 +0000 (09:59 +0000)]
[X86] RegCall - Handling v64i1 in 32/64 bit target

Register Calling Convention defines a new behavior for v64i1 types.
This type should be saved in GPR.
However for 32 bit machine we need to split the value into 2 GPRs (because each is 32 bit).

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

llvm-svn: 287217

7 years ago[ELF] Convert SymbolTableSection to input section
Eugene Leviant [Thu, 17 Nov 2016 09:16:34 +0000 (09:16 +0000)]
[ELF] Convert SymbolTableSection to input section

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

llvm-svn: 287216

7 years ago[clang-tidy] Changes to modernize-use-default check
Malcolm Parsons [Thu, 17 Nov 2016 09:14:04 +0000 (09:14 +0000)]
[clang-tidy] Changes to modernize-use-default check

Summary:
Warn about special member functions that only contain a comment.
Report the location of the special member function, unless it is
defined in a macro.  Reporting the location of the body in a macro is
more helpful as it causes the macro expansion location to be reported too.

Fixes PR30920.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 287215

7 years agoDelete dead code and add asserts instead; NFC
Sanjoy Das [Thu, 17 Nov 2016 07:29:43 +0000 (07:29 +0000)]
Delete dead code and add asserts instead; NFC

llvm-svn: 287214

7 years ago[ImplicitNullCheck] Fix an edge case where we were hoisting incorrectly
Sanjoy Das [Thu, 17 Nov 2016 07:29:40 +0000 (07:29 +0000)]
[ImplicitNullCheck] Fix an edge case where we were hoisting incorrectly

ImplicitNullCheck keeps track of one instruction that the memory
operation depends on that it also hoists with the memory operation.
When hoisting this dependency, it would sometimes clobber a live-in
value to the basic block we were hoisting the two things out of.  Fix
this by explicitly looking for such dependencies.

I also noticed two redundant checks on `MO.isDef()` in IsMIOperandSafe.
They're redundant since register MachineOperands are either Defs or Uses
-- there is no third kind.  I'll change the checks to asserts in a later
commit.

llvm-svn: 287213