platform/upstream/llvm.git
8 years ago[OPENMP] Implementation of codegen for firstprivate clause of target directive
Carlo Bertolli [Fri, 18 Mar 2016 21:43:32 +0000 (21:43 +0000)]
[OPENMP] Implementation of codegen for firstprivate clause of target directive

This patch implements the following aspects:

It extends sema to check that a variable is not reference in both a map clause and firstprivate or private. This is needed to ensure correct functioning at codegen level, apart from being useful for the user.
It implements firstprivate for target in codegen. The implementation applies to both host and nvptx devices.
It adds regression tests for codegen of firstprivate, host and device side when using the host as device, and nvptx side.
Please note that the regression test for nvptx codegen is missing VLAs. This is because VLAs currently require saving and restoring the stack which appears not to be a supported operation by nvptx backend.

It adds a check in sema regression tests for target map, firstprivate, and private clauses.

http://reviews.llvm.org/D18203

llvm-svn: 263837

8 years agoFix printing of anonymous struct typedefs.
Steven Watanabe [Fri, 18 Mar 2016 21:35:59 +0000 (21:35 +0000)]
Fix printing of anonymous struct typedefs.

clang -cc1 -ast-print put the struct
definition in the wrong place, like this:

  struct {} typedef S;

The reason that this happens is that the printing code
first prints the struct definition, and then tells the next
declaration to leave out the type. This behavior
is correct for simple variable declarations, but fails for
typedefs (or extern, mutable, etc).

The patch address this problem by skipping the struct
declaration when we first see it, and then telling the first
subsequent declaration that it needs to print out the full
struct definition.

Differential Revision: http://reviews.llvm.org/D17285

llvm-svn: 263836

8 years agoInterface to get/set profile summary metadata to module
Easwaran Raman [Fri, 18 Mar 2016 21:29:30 +0000 (21:29 +0000)]
Interface to get/set profile summary metadata to module

Differential Revision: http://reviews.llvm.org/D17894

llvm-svn: 263835

8 years ago[Docs] New documentation for advanced build configurations
Chris Bieneman [Fri, 18 Mar 2016 21:16:26 +0000 (21:16 +0000)]
[Docs] New documentation for advanced build configurations

This document covers how to use some of the new complex build configurations CMake supports.

Feedback and improvements welcomed!

llvm-svn: 263834

8 years agobuiltins: make __clear_cache work on Linux-ARM
Saleem Abdulrasool [Fri, 18 Mar 2016 21:06:06 +0000 (21:06 +0000)]
builtins: make __clear_cache work on Linux-ARM

__clear_cache on Android is identical to the version on Linux.  Use __linux__
instead of __ANDROID__ as __linux__ is defined for Linux and Android.

llvm-svn: 263833

8 years agobuiltins: port __clear_cache to Windows ARM
Saleem Abdulrasool [Fri, 18 Mar 2016 21:06:03 +0000 (21:06 +0000)]
builtins: port __clear_cache to Windows ARM

Support __clear_cache on Windows on ARM using the `FlushInstructionCache`
library call.

llvm-svn: 263832

8 years ago[libFuzzer] add a flag close_fd_mask so that we can silence spammy targets by closing...
Kostya Serebryany [Fri, 18 Mar 2016 20:58:29 +0000 (20:58 +0000)]
[libFuzzer] add a flag close_fd_mask so that we can silence spammy targets by closing stderr/stdout

llvm-svn: 263831

8 years agoAdded a break statement that was needed. Caught by clang's unannotated case fall...
Greg Clayton [Fri, 18 Mar 2016 20:53:35 +0000 (20:53 +0000)]
Added a break statement that was needed. Caught by clang's unannotated case fall through warning.

llvm-svn: 263830

8 years agoMILexer: Add ErrorCallbackType typedef; NFC
Matthias Braun [Fri, 18 Mar 2016 20:41:11 +0000 (20:41 +0000)]
MILexer: Add ErrorCallbackType typedef; NFC

llvm-svn: 263829

8 years ago[IndVars] Make the fix for PR26973 more obvious; NFCI
Sanjoy Das [Fri, 18 Mar 2016 20:37:11 +0000 (20:37 +0000)]
[IndVars] Make the fix for PR26973 more obvious; NFCI

llvm-svn: 263828

8 years ago[IndVars] Pass the right loop to isLoopInvariantPredicate
Sanjoy Das [Fri, 18 Mar 2016 20:37:07 +0000 (20:37 +0000)]
[IndVars] Pass the right loop to isLoopInvariantPredicate

The loop on IVOperand's incoming values assumes IVOperand to be an
induction variable on the loop over which `S Pred X` is invariant;
otherwise loop invariant incoming values to IVOperand are not guaranteed
to dominate the comparision.

This fixes PR26973.

llvm-svn: 263827

8 years agoFixed an case fall through that wasn't meant to happen. Caught by clang's unannotated...
Greg Clayton [Fri, 18 Mar 2016 20:36:30 +0000 (20:36 +0000)]
Fixed an case fall through that wasn't meant to happen. Caught by clang's unannotated case fall through warning.

llvm-svn: 263826

8 years agoRevert "[sancov] specifying sanitizer coverage dependencies."
Mike Aizatsky [Fri, 18 Mar 2016 20:34:58 +0000 (20:34 +0000)]
Revert "[sancov] specifying sanitizer coverage dependencies."

This fails on arm.

This reverts commit 52c8e0f7119d1ea1050c0708565a8c92b73386d2.

llvm-svn: 263825

8 years agoFixed a bug where DW_AT_start_scope would fall through to DW_AT_artificial in SymbolF...
Greg Clayton [Fri, 18 Mar 2016 20:33:49 +0000 (20:33 +0000)]
Fixed a bug where DW_AT_start_scope would fall through to DW_AT_artificial in SymbolFileDWARF::ParseVariableDIE(). This was caught by the clang warning that catches unannotated case fall throughs.

llvm-svn: 263824

8 years agoAMDGPU: add missing braces around multi-line if block
Nicolai Haehnle [Fri, 18 Mar 2016 20:32:04 +0000 (20:32 +0000)]
AMDGPU: add missing braces around multi-line if block

This fixes an issue with rL263658 pointed out by Tom Stellard.

llvm-svn: 263823

8 years ago[clang-tidy] Use hasAnyName() instead of matchesName().
Samuel Benzaquen [Fri, 18 Mar 2016 20:14:35 +0000 (20:14 +0000)]
[clang-tidy] Use hasAnyName() instead of matchesName().

matchesName() uses regular expressions and it is very slow.
hasAnyName() gives the same result and it is much faster.
A benchmark (with all the checks enabled) shows a ~5% speed up of
clang-tidy.

llvm-svn: 263822

8 years agoTypesafe visualization of PointerIntPairs in Visual Studio
Mike Spertus [Fri, 18 Mar 2016 20:06:16 +0000 (20:06 +0000)]
Typesafe visualization of PointerIntPairs in Visual Studio

In the <DisplayString> of PointerIntPair , I cast the pointer to the actual type, so VS can leverage it while visualizing, not unlike the recent change to PointerUnion visualization.
In the expansion, the current code is casting to the incorrect type (wrong number of stars), so I fixed that as well.

llvm-svn: 263821

8 years ago[sancov] common flags initialization.
Mike Aizatsky [Fri, 18 Mar 2016 19:28:07 +0000 (19:28 +0000)]
[sancov] common flags initialization.

Summary:
Introducing InitializeCommonFlags accross all sanitizers to simplify
common flags management.

Setting coverage=1 when html_cov_report is requested.

Differential Revision: http://reviews.llvm.org/D18273

llvm-svn: 263820

8 years ago[AArch64] Enable more load clustering in the MI Scheduler.
Chad Rosier [Fri, 18 Mar 2016 19:21:02 +0000 (19:21 +0000)]
[AArch64] Enable more load clustering in the MI Scheduler.

This patch adds unscaled loads and sign-extend loads to the TII
getMemOpBaseRegImmOfs API, which is used to control clustering in the MI
scheduler. This is done to create more opportunities for load pairing.  I've
also added the scaled LDRSWui instruction, which was missing from the scaled
instructions. Finally, I've added support in shouldClusterLoads for clustering
adjacent sext and zext loads that too can be paired by the load/store optimizer.

Differential Revision: http://reviews.llvm.org/D18048

llvm-svn: 263819

8 years ago[Objective-c] Fix a crash in WeakObjectProfileTy::getBaseInfo.
Akira Hatanaka [Fri, 18 Mar 2016 19:03:50 +0000 (19:03 +0000)]
[Objective-c] Fix a crash in WeakObjectProfileTy::getBaseInfo.

The crash occurs in WeakObjectProfileTy::getBaseInfo when getBase() is
called on an ObjCPropertyRefExpr object whose receiver is an interface.
This commit fixes the crash by checking the type of the receiver and
setting IsExact to true if it is an interface.

rdar://problem/25208167

Differential Revision: http://reviews.llvm.org/D18268

llvm-svn: 263818

8 years ago[codeview] Only emit function ids for inlined functions
Reid Kleckner [Fri, 18 Mar 2016 18:54:32 +0000 (18:54 +0000)]
[codeview] Only emit function ids for inlined functions

We aren't referencing any other kind of function currently.
Should save a bit on our debug info size.

llvm-svn: 263817

8 years ago[clang-cl] Allow use of -gline-tables-only
Reid Kleckner [Fri, 18 Mar 2016 18:42:56 +0000 (18:42 +0000)]
[clang-cl] Allow use of -gline-tables-only

llvm-svn: 263816

8 years ago[MCParser] Accept uppercase radix variants 0X and 0B
Colin LeMahieu [Fri, 18 Mar 2016 18:22:07 +0000 (18:22 +0000)]
[MCParser] Accept uppercase radix variants 0X and 0B

Differential Revision: http://reviews.llvm.org/D14781

llvm-svn: 263802

8 years agoRevert "bar"
Rafael Espindola [Fri, 18 Mar 2016 18:11:26 +0000 (18:11 +0000)]
Revert "bar"

This reverts commit r263799.
It was a mistake. Sorry about that.

llvm-svn: 263801

8 years agoThe ELF lld doesn't depend on LTO.
Rafael Espindola [Fri, 18 Mar 2016 18:09:35 +0000 (18:09 +0000)]
The ELF lld doesn't depend on LTO.

Tested with a shared build.

llvm-svn: 263800

8 years agobar
Rafael Espindola [Fri, 18 Mar 2016 18:09:32 +0000 (18:09 +0000)]
bar

llvm-svn: 263799

8 years agoMissing ATOMIC_*_LOCK_FREE tests
JF Bastien [Fri, 18 Mar 2016 17:48:58 +0000 (17:48 +0000)]
Missing ATOMIC_*_LOCK_FREE tests

Forked from D17951, these tests should have been there but weren't.

llvm-svn: 263798

8 years ago[sancov] specifying sanitizer coverage dependencies.
Mike Aizatsky [Fri, 18 Mar 2016 17:33:21 +0000 (17:33 +0000)]
[sancov] specifying sanitizer coverage dependencies.

Summary:
These dependencies would be used in the future to reduce the number
of instrumented blocks(http://reviews.llvm.org/rL262103)

This is submitted as a separate CL because of previous problems with
ARM.

Subscribers: aemerson

Differential Revision: http://reviews.llvm.org/D18227

llvm-svn: 263797

8 years ago[ELF] Link with Analysis, IPO, and LTO
Jan Vesely [Fri, 18 Mar 2016 17:12:31 +0000 (17:12 +0000)]
[ELF] Link with Analysis, IPO, and LTO

Fixes SHARED_LIB build broken by r263761

llvm-svn: 263796

8 years agoAdd -fnative-half-arguments-and-returns
Pirama Arumuga Nainar [Fri, 18 Mar 2016 16:58:36 +0000 (16:58 +0000)]
Add -fnative-half-arguments-and-returns

Summary:
r246764 handled __fp16 arguments and returns for AAPCS, but skipped this
handling for OpenCL.  Simlar to OpenCL, RenderScript also handles __fp16
type natively.

This patch adds the -fnative-half-arguments-and-returns command line
flag to allow such languages to skip this coercion of __fp16.

Reviewers: srhines, olista01

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18138

llvm-svn: 263795

8 years agoShow members of DeclContexts (i.e., class members) in Visual Studio native visualizers
Mike Spertus [Fri, 18 Mar 2016 16:38:34 +0000 (16:38 +0000)]
Show members of DeclContexts (i.e., class members) in Visual Studio native visualizers

This change shows members of DeclContext objects in the Visual Studio debugger. It will also cast a TagType like a class or a struct to a DeclContext, so its methods and fields are visualized.

llvm-svn: 263794

8 years ago[llvm-objdump] Print <unknown> in place of instruction text if it couldn't be disasse...
Colin LeMahieu [Fri, 18 Mar 2016 16:26:48 +0000 (16:26 +0000)]
[llvm-objdump] Print <unknown> in place of instruction text if it couldn't be disassembled.

llvm-svn: 263793

8 years agoAMDGPU: Overload return type of llvm.amdgcn.buffer.load.format
Nicolai Haehnle [Fri, 18 Mar 2016 16:24:40 +0000 (16:24 +0000)]
AMDGPU: Overload return type of llvm.amdgcn.buffer.load.format

Summary:
Allow the selection of BUFFER_LOAD_FORMAT_x and _XY. Do this now before
the frontend patches land in Mesa. Eventually, we may want to automatically
reduce the size of loads at the LLVM IR level, which requires such overloads,
and in some cases Mesa can generate them directly.

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D18255

llvm-svn: 263792

8 years agoAMDGPU/SI: Add llvm.amdgcn.buffer.atomic.* intrinsics
Nicolai Haehnle [Fri, 18 Mar 2016 16:24:31 +0000 (16:24 +0000)]
AMDGPU/SI: Add llvm.amdgcn.buffer.atomic.* intrinsics

Summary:
These intrinsics expose the BUFFER_ATOMIC_* instructions and will be used
by Mesa to implement atomics with buffer semantics. The intrinsic interface
matches that of buffer.load.format and buffer.store.format, except that the
GLC bit is not exposed (it is automatically deduced based on whether the
return value is used).

The change of hasSideEffects is required for TableGen to accept the pattern
that matches the intrinsic.

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm, rivanvx, llvm-commits

Differential Revision: http://reviews.llvm.org/D18151

llvm-svn: 263791

8 years agoAMDGPU: use ComplexPattern for offsets in llvm.amdgcn.buffer.load/store.format
Nicolai Haehnle [Fri, 18 Mar 2016 16:24:20 +0000 (16:24 +0000)]
AMDGPU: use ComplexPattern for offsets in llvm.amdgcn.buffer.load/store.format

Summary:
We cannot easily deduce that an offset is in an SGPR, but the Mesa frontend
cannot easily make use of an explicit soffset parameter either. Furthermore,
it is likely that in the future, LLVM will be in a better position than the
frontend to choose an SGPR offset if possible.

Since there aren't any frontend uses of these intrinsics in upstream
repositories yet, I would like to take this opportunity to change the
intrinsic signatures to a single offset parameter, which is then selected
to immediate offsets or voffsets using a ComplexPattern.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D18218

llvm-svn: 263790

8 years ago[AMDGPU] Assembler: Change dpp_ctrl syntax to match sp3
Sam Kolton [Fri, 18 Mar 2016 15:35:51 +0000 (15:35 +0000)]
[AMDGPU] Assembler: Change dpp_ctrl syntax to match sp3

Review: http://reviews.llvm.org/D18267
llvm-svn: 263789

8 years agoUpdate www/index.html to reflect current status of OpenMP project
Jonathan Peyton [Fri, 18 Mar 2016 14:50:01 +0000 (14:50 +0000)]
Update www/index.html to reflect current status of OpenMP project

llvm-svn: 263788

8 years ago[Fuzzer] Guard no_sanitize_memory attributes behind __has_feature.
Benjamin Kramer [Fri, 18 Mar 2016 14:19:19 +0000 (14:19 +0000)]
[Fuzzer] Guard no_sanitize_memory attributes behind __has_feature.

Otherwise GCC fails to build it because it doesn't know the attribute.

llvm-svn: 263787

8 years agoFix some typos; NFC
Krzysztof Parzyszek [Fri, 18 Mar 2016 14:08:42 +0000 (14:08 +0000)]
Fix some typos; NFC

Patch by Dongyuan Liu.

Differential Revision: http://reviews.llvm.org/D17977

llvm-svn: 263786

8 years agoMake LookupResult movable again.
Benjamin Kramer [Fri, 18 Mar 2016 13:31:00 +0000 (13:31 +0000)]
Make LookupResult movable again.

We lost copy semantics in r263730, because it only worked for a few very
specific cases. Move semantics don't have this issue. Sadly the
implementation is a bit messy but I don't know how to clean it up
without losing support for msvc 2013 :/

llvm-svn: 263785

8 years agoRevert r263783 as buildbot failure is being investigated.
Arpith Chacko Jacob [Fri, 18 Mar 2016 12:39:40 +0000 (12:39 +0000)]
Revert r263783 as buildbot failure is being investigated.

llvm-svn: 263784

8 years ago[OpenMP] Base support for target directive codegen on NVPTX device.
Arpith Chacko Jacob [Fri, 18 Mar 2016 11:47:43 +0000 (11:47 +0000)]
[OpenMP] Base support for target directive codegen on NVPTX device.

Summary:
Reworked test case after buildbot failure on windows.

This patch adds base support for codegen of the target directive on the NVPTX device.

Reviewers: ABataev

Differential Revision: http://reviews.llvm.org/D17877

llvm-svn: 263783

8 years ago[tsan] Add interceptor for pthread_cond_timedwait_relative_np
Kuba Brecka [Fri, 18 Mar 2016 10:54:11 +0000 (10:54 +0000)]
[tsan] Add interceptor for pthread_cond_timedwait_relative_np

On OS X, we have pthread_cond_timedwait_relative_np. TSan needs to intercept this API to avoid false positives when using condition variables.

Differential Revision: http://reviews.llvm.org/D18184

llvm-svn: 263782

8 years ago[llvm-objdump] Move test case to the X86 sub-directory because it depends on X86...
Simon Atanasyan [Fri, 18 Mar 2016 09:52:12 +0000 (09:52 +0000)]
[llvm-objdump] Move test case to the X86 sub-directory because it depends on X86 target supporting. NFC.

llvm-svn: 263781

8 years ago[ELF] - Set the sh_entsize for mergable sections
George Rimar [Fri, 18 Mar 2016 09:28:39 +0000 (09:28 +0000)]
[ELF] - Set the sh_entsize for mergable sections

Previously sh_entsize field was not set for MergeOutputSection.
Patch fixes that.

That should resolve the https://llvm.org/bugs/show_bug.cgi?id=26975

Differential revision: http://reviews.llvm.org/D18248

llvm-svn: 263780

8 years ago[TSAN] Fix build bot failure for powerpc64le
Sagar Thakur [Fri, 18 Mar 2016 07:55:44 +0000 (07:55 +0000)]
[TSAN] Fix build bot failure for powerpc64le

race_on_mutex.c passes for powerpc64le too after revision 263778. So removing the XFAIL marker.

llvm-svn: 263779

8 years ago[TSAN] Relax the expected output of race_on_mutex.c
Sagar Thakur [Fri, 18 Mar 2016 05:41:20 +0000 (05:41 +0000)]
[TSAN] Relax the expected output of race_on_mutex.c

The stack trace produced by TSan on MIPS is:

  Previous write of size 8 at 0x0120ed2930 by thread T1:
    #0 memset
/home/slt/LLVM/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:678
(race_on_mutex.c.tmp+0x0120071808)
    #1 __GI___pthread_mutex_init
/build/glibc-g99ldr/glibc-2.19/nptl/pthread_mutex_init.c:84
(libpthread.so.0+0x000000d634)
    #2 <null>
/home/slt/LLVM/llvm/projects/compiler-rt/test/tsan/race_on_mutex.c:11 (race_on_mutex.c.tmp+0x01200ea59c)

Reviewers: samsonov, dvyukov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential: http://reviews.llvm.org/D17796
llvm-svn: 263778

8 years agoAlways cache resolved paths as it even saves on StringMap lookups.
Pete Cooper [Fri, 18 Mar 2016 05:04:04 +0000 (05:04 +0000)]
Always cache resolved paths as it even saves on StringMap lookups.

Now that the resolved path cache stores the StringRef's, its
best to just always cache the results, even when realpath isn't
used.  This way we'll still avoid the StringMap hashing and lookup.

This also conveniently reorganises this code in a way I need for
a future patch.

llvm-svn: 263777

8 years agoadding another optimization opportunity to readme file
Ehsan Amiri [Fri, 18 Mar 2016 04:02:25 +0000 (04:02 +0000)]
adding another optimization opportunity to readme file

llvm-svn: 263775

8 years agoUse StringRef's in resolved path cache to avoid extra internString lookups. NFC.
Pete Cooper [Fri, 18 Mar 2016 03:48:09 +0000 (03:48 +0000)]
Use StringRef's in resolved path cache to avoid extra internString lookups.  NFC.

ResolvedPaths was storing std::string's as a cache. We would then take those strings and look them up in the internString pool to get a unique StringRef for each path.

This patch changes ResolvedPaths to store the StringRef pointing in to the internString pool itself. This way, when getResolvedPath returns a string, we know we have the StringRef we would find in the pool anyway. We can avoid the duplicate memory of the std::string's, and also the time from the lookup.

Unfortunately my profiles show no runtime change here, but it should still save memory allocations which is nice.

Reviewed by Frederic Riss.

Differential Revision: http://reviews.llvm.org/D18259

llvm-svn: 263774

8 years ago[libFuzzer] read corpus dirs recursively
Kostya Serebryany [Fri, 18 Mar 2016 01:36:00 +0000 (01:36 +0000)]
[libFuzzer] read corpus dirs recursively

llvm-svn: 263773

8 years ago[LoopDataPrefetch] Add TTI to limit the number of iterations to prefetch ahead
Adam Nemet [Fri, 18 Mar 2016 00:27:43 +0000 (00:27 +0000)]
[LoopDataPrefetch] Add TTI to limit the number of iterations to prefetch ahead

Summary:
It can hurt performance to prefetch ahead too much.  Be conservative for
now and don't prefetch ahead more than 3 iterations on Cyclone.

Reviewers: hfinkel

Subscribers: llvm-commits, mzolotukhin

Differential Revision: http://reviews.llvm.org/D17949

llvm-svn: 263772

8 years ago[LoopDataPrefetch/Aarch64] Allow selective prefetching of large-strided accesses
Adam Nemet [Fri, 18 Mar 2016 00:27:38 +0000 (00:27 +0000)]
[LoopDataPrefetch/Aarch64] Allow selective prefetching of large-strided accesses

Summary:
And use this TTI for Cyclone.  As it was explained in the original RFC
(http://thread.gmane.org/gmane.comp.compilers.llvm.devel/92758), the HW
prefetcher work up to 2KB strides.

I am also adding tests for this and the previous change (D17943):

* Cyclone prefetching accesses with a large stride
* Cyclone not prefetching accesses with a small stride
* Generic Aarch64 subtarget not prefetching either

Reviewers: hfinkel

Subscribers: aemerson, rengolin, llvm-commits, mzolotukhin

Differential Revision: http://reviews.llvm.org/D17945

llvm-svn: 263771

8 years ago[Aarch64] Add pass LoopDataPrefetch for Cyclone
Adam Nemet [Fri, 18 Mar 2016 00:27:29 +0000 (00:27 +0000)]
[Aarch64] Add pass LoopDataPrefetch for Cyclone

Summary:
This wires up the pass for Cyclone but keeps it off for now because we
need a few more TTIs.

The getPrefetchMinStride value is not very well tuned right now but it
works well with CFP2006/433.milc which motivated this.

Tests will be added as part of the upcoming large-stride prefetching
patch.

Reviewers: t.p.northover

Subscribers: llvm-commits, aemerson, hfinkel, rengolin

Differential Revision: http://reviews.llvm.org/D17943

llvm-svn: 263770

8 years ago[libFuzzer] improve -merge functionality
Kostya Serebryany [Fri, 18 Mar 2016 00:23:29 +0000 (00:23 +0000)]
[libFuzzer] improve -merge functionality

llvm-svn: 263769

8 years ago[Support] Refactor Error unit tests to avoid duplicating work.
Lang Hames [Fri, 18 Mar 2016 00:12:37 +0000 (00:12 +0000)]
[Support] Refactor Error unit tests to avoid duplicating work.

Suggested by Dave Blaikie in review for r263749. Thanks Dave!

llvm-svn: 263768

8 years ago[sancov] html report: replacing uncovered functions with function coverage % table.
Mike Aizatsky [Fri, 18 Mar 2016 00:12:14 +0000 (00:12 +0000)]
[sancov] html report: replacing uncovered functions with function coverage % table.

Differential Revision: http://reviews.llvm.org/D18256

llvm-svn: 263767

8 years agoRemove usage of LLVM_PREFIX.
Chaoren Lin [Fri, 18 Mar 2016 00:05:37 +0000 (00:05 +0000)]
Remove usage of LLVM_PREFIX.

Summary: LLVM_PREFIX could be undefined if CMAKE_INSTALL_PREFIX were set to empty.

Reviewers: kparzysz, bkramer, chandlerc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D17784

llvm-svn: 263766

8 years agoDebugInfo: Add ability to not emit DW_AT_vtable_elem_location for virtual functions.
Peter Collingbourne [Thu, 17 Mar 2016 23:58:03 +0000 (23:58 +0000)]
DebugInfo: Add ability to not emit DW_AT_vtable_elem_location for virtual functions.

A virtual index of -1u indicates that the subprogram's virtual index is
unrepresentable (for example, when using the relative vtable ABI), so do
not emit a DW_AT_vtable_elem_location attribute for it.

Differential Revision: http://reviews.llvm.org/D18236

llvm-svn: 263765

8 years ago[Support] Address some of dblaikie's feedback for r263749.
Lang Hames [Thu, 17 Mar 2016 23:43:33 +0000 (23:43 +0000)]
[Support] Address some of dblaikie's feedback for r263749.

Fixes some missing std::moves and take Expected<T> by rvalue reference in the
call operator.

llvm-svn: 263764

8 years ago[LTO] Test lto passes are actually working.
Davide Italiano [Thu, 17 Mar 2016 23:36:31 +0000 (23:36 +0000)]
[LTO] Test lto passes are actually working.

This should have been part of r263761.

llvm-svn: 263763

8 years agoMake evaluation order explicit.
Rafael Espindola [Thu, 17 Mar 2016 23:36:19 +0000 (23:36 +0000)]
Make evaluation order explicit.

llvm-svn: 263762

8 years ago[LTO] Call the optimizer before invoking codegen.
Davide Italiano [Thu, 17 Mar 2016 23:35:34 +0000 (23:35 +0000)]
[LTO] Call the optimizer before invoking codegen.

This is the required plumbing needed to run the LTO passes.

Differential Revision:  http://reviews.llvm.org/D18235

llvm-svn: 263761

8 years agoRevert "allow lambdas in mapped_iterator"
Mike Aizatsky [Thu, 17 Mar 2016 23:32:20 +0000 (23:32 +0000)]
Revert "allow lambdas in mapped_iterator"

MSVC as usual:

C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/ADT/STLExtras.h(120):
error C2100: illegal indirection
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/IR/Instructions.h(3966):
note: see reference to class template instantiation
'llvm::mapped_iterator<llvm::User::op_iterator,llvm::CatchSwitchInst::DerefFnTy>'
being compiled

This reverts commit e091dd63f1f34e043748e28ad160d3bc17731168.

llvm-svn: 263760

8 years agoallow lambdas in mapped_iterator
Mike Aizatsky [Thu, 17 Mar 2016 23:22:22 +0000 (23:22 +0000)]
allow lambdas in mapped_iterator

Differential Revision: http://reviews.llvm.org/D17311

llvm-svn: 263759

8 years ago[Docs] Fix a typo.
Alexey Samsonov [Thu, 17 Mar 2016 23:08:01 +0000 (23:08 +0000)]
[Docs] Fix a typo.

llvm-svn: 263754

8 years ago[PPC, FastISel] Fix ordered/unordered fcmp
Tim Shen [Thu, 17 Mar 2016 22:27:58 +0000 (22:27 +0000)]
[PPC, FastISel] Fix ordered/unordered fcmp

For fcmp, major concern about the following 6 cases is NaN result. The
comparison result consists of 4 bits, indicating lt, eq, gt and un (unordered),
only one of which will be set. The result is generated by fcmpu
instruction. However, bc instruction only inspects one of the first 3
bits, so when un is set, bc instruction may jump to to an undesired
place.

More specifically, if we expect an unordered comparison and un is set, we
expect to always go to true branch; in such case UEQ, UGT and ULT still
give false, which are undesired; but UNE, UGE, ULE happen to give true,
since they are tested by inspecting !eq, !lt, !gt, respectively.

Similarly, for ordered comparison, when un is set, we always expect the
result to be false. In such case OGT, OLT and OEQ is good, since they are
actually testing GT, LT, and EQ respectively, which are false. OGE, OLE
and ONE are tested through !lt, !gt and !eq, and these are true.

llvm-svn: 263753

8 years agoRevert r263687 for ubsan bot failure.
Manman Ren [Thu, 17 Mar 2016 22:13:50 +0000 (22:13 +0000)]
Revert r263687 for ubsan bot failure.

llvm-svn: 263752

8 years ago[CMake] Remove bash-ism in SanitizerLintCheck
Alexey Samsonov [Thu, 17 Mar 2016 21:41:08 +0000 (21:41 +0000)]
[CMake] Remove bash-ism in SanitizerLintCheck

llvm-svn: 263751

8 years agoRevert "Reapply [VFS] Add 'overlay-relative' field to YAML files"
Bruno Cardoso Lopes [Thu, 17 Mar 2016 21:30:55 +0000 (21:30 +0000)]
Revert "Reapply [VFS] Add 'overlay-relative' field to YAML files"

Tests failing on
http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/46102

This reverts commit a1683cd6c9e07359c09f86e98a4db6b4e1bc51fc.

llvm-svn: 263750

8 years ago[Support] Add ExitOnError utility to support tools that use the exit-on-error
Lang Hames [Thu, 17 Mar 2016 21:28:49 +0000 (21:28 +0000)]
[Support] Add ExitOnError utility to support tools that use the exit-on-error
idiom.

Most LLVM tool code exits immediately when an error is encountered and prints an
error message to stderr. The ExitOnError class supports this by providing two
call operators - one for Errors, and one for Expected<T>s. Calls to code that
can return Errors (or Expected<T>s) can use these calls to bail out on error,
and otherwise continue as if the operation had succeeded. E.g.

Error foo();
Expected<int> bar();

int main(int argc, char *argv[]) {
  ExitOnError ExitOnErr;

  ExitOnErr.setBanner(std::string("Error in ") + argv[0] + ":");

  // Exit if foo returns an error. No need to manually check error return.
  ExitOnErr(foo());

  // Exit if bar returns an error, otherwise unwrap the contained int and
  // continue.
  int X = ExitOnErr(bar());

  // ...

  return 0;
}

llvm-svn: 263749

8 years agoReapply [VFS] Add 'overlay-relative' field to YAML files
Bruno Cardoso Lopes [Thu, 17 Mar 2016 21:11:23 +0000 (21:11 +0000)]
Reapply [VFS] Add 'overlay-relative' field to YAML files

This reapplies r261552.

The VFS overlay mapping between virtual paths and real paths is done through
the 'external-contents' entries in YAML files, which contains hardcoded paths
to the real files.

When a module compilation crashes, headers are dumped into <name>.cache/vfs
directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script
generated for reproduction uses -ivfsoverlay pointing to file to gather the
mapping between virtual paths and files inside <name>.cache/vfs. Currently, we
are only capable of reproducing such crashes in the same machine as they
happen, because of the hardcoded paths in 'external-contents'.

To be able to reproduce a crash in another machine, this patch introduces a new
option in the VFS yaml file called 'overlay-relative'. When it's equal to
'true' it means that the provided path to the YAML file through the
-ivfsoverlay option should also be used to prefix the final path for every
'external-contents'.

Example, given the invocation snippet "... -ivfsoverlay
<name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:

"overlay-relative": "true",
"roots": [
...
  "type": "directory",
  "name": "/usr/include",
  "contents": [
    {
      "type": "file",
      "name": "stdio.h",
      "external-contents": "/usr/include/stdio.h"
    },
...

Here, a file manager request for virtual "/usr/include/stdio.h", that will map
into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.

This is a useful feature for debugging module crashes in machines other than
the one where the error happened.

Differential Revision: http://reviews.llvm.org/D17457

rdar://problem/24499339

llvm-svn: 263748

8 years agoRe-add (user defined) move ops to UnresolvedSetImpl to allow UnresolvedSet to be...
David Blaikie [Thu, 17 Mar 2016 20:45:38 +0000 (20:45 +0000)]
Re-add (user defined) move ops to UnresolvedSetImpl to allow UnresolvedSet to be implicitly movable

llvm-svn: 263747

8 years agounord: Extract key to avoid preemptive mallocs in insert/emplace
Duncan P. N. Exon Smith [Thu, 17 Mar 2016 20:45:20 +0000 (20:45 +0000)]
unord: Extract key to avoid preemptive mallocs in insert/emplace

unordered_set::emplace and unordered_map::emplace construct a node, then
try to insert it.  If insertion fails, the node gets deleted.

To avoid this unnecessary malloc traffic, check to see if the argument
to emplace has the appropriate key_type.  If so, we can use that key
directly and delay the malloc until we're sure we're inserting something
new.

Test updates by Eric Fiselier, who rewrote the old allocation tests to
include the new cases.

There are two orthogonal future directions:

1. Apply the same optimization to set and map.

2. Extend the optimization to when the argument is not key_type, but can
   be converted to it without side effects.  Ideally, we could do this
   whenever key_type is trivially destructible and the argument is
   trivially convertible to key_type, but in practise the relevant type
   traits "blow up sometimes".  At least, we should catch a few simple
   cases (such as when both are primitive types).

llvm-svn: 263746

8 years ago[Support] Make Error::isA<T>() works on success values.
Lang Hames [Thu, 17 Mar 2016 20:35:00 +0000 (20:35 +0000)]
[Support] Make Error::isA<T>() works on success values.

llvm-svn: 263745

8 years ago[LoopVectorize] Annotate versioned loop with noalias metadata
Adam Nemet [Thu, 17 Mar 2016 20:32:37 +0000 (20:32 +0000)]
[LoopVectorize] Annotate versioned loop with noalias metadata

Summary:
Use the new LoopVersioning facility (D16712) to add noalias metadata in
the vector loop if we versioned with memchecks.  This can enable some
optimization opportunities further down the pipeline (see the included
test or the benchmark improvement quoted in D16712).

The test also covers the bug I had in the initial version in D16712.

The vectorizer did not previously use LoopVersioning.  The reason is
that the vectorizer performs its transformations in single shot.  It
creates an empty single-block vector loop that it then populates with
the widened, if-converted instructions.  Thus creating an intermediate
versioned scalar loop seems wasteful.

So this patch (rather than bringing in LoopVersioning fully) adds a
special interface to LoopVersioning to allow the vectorizer to add
no-alias annotation while still performing its own versioning.

As the vectorizer propagates metadata from the instructions in the
original loop to the vector instructions we also check the pointer in
the original instruction and see if LoopVersioning can add no-alias
metadata based on the issued memchecks.

Reviewers: hfinkel, nadav, mzolotukhin

Subscribers: mzolotukhin, llvm-commits

Differential Revision: http://reviews.llvm.org/D17191

llvm-svn: 263744

8 years ago[LoopVersioning] Annotate versioned loop with noalias metadata
Adam Nemet [Thu, 17 Mar 2016 20:32:32 +0000 (20:32 +0000)]
[LoopVersioning] Annotate versioned loop with noalias metadata

Summary:
If we decide to version a loop to benefit a transformation, it makes
sense to record the now non-aliasing accesses in the newly versioned
loop.  This allows non-aliasing information to be used by subsequent
passes.

One example is 456.hmmer in SPECint2006 where after loop distribution,
we vectorize one of the newly distributed loops.  To vectorize we
version this loop to fully disambiguate may-aliasing accesses.  If we
add the noalias markers, we can use the same information in a later DSE
pass to eliminate some dead stores which amounts to ~25% of the
instructions of this hot memory-pipeline-bound loop.  The overall
performance improves by 18% on our ARM64.

The scoped noalias annotation is added in LoopVersioning.  The patch
then enables this for loop distribution.  A follow-on patch will enable
it for the vectorizer.  Eventually this should be run by default when
versioning the loop but first I'd like to get some feedback whether my
understanding and application of scoped noalias metadata is correct.

Essentially my approach was to have a separate alias domain for each
versioning of the loop.  For example, if we first version in loop
distribution and then in vectorization of the distributed loops, we have
a different set of memchecks for each versioning.  By keeping the scopes
in different domains they can conveniently be defined independently
since different alias domains don't affect each other.

As written, I also have a separate domain for each loop.  This is not
necessary and we could save some metadata here by using the same domain
across the different loops.  I don't think it's a big deal either way.

Probably the best is to review the tests first to see if I mapped this
problem correctly to scoped noalias markers.  I have plenty of comments
in the tests.

Note that the interface is prepared for the vectorizer which needs the
annotateInstWithNoAlias API.  The vectorizer does not use LoopVersioning
so we need a way to pass in the versioned instructions.  This is also
why the maps have to become part of the object state.

Also currently, we only have an AA-aware DSE after the vectorizer if we
also run the LTO pipeline.  Depending how widely this triggers we may
want to schedule a DSE toward the end of the regular pass pipeline.

Reviewers: hfinkel, nadav, ashutosh.nema

Subscribers: mssimpso, aemerson, llvm-commits, mcrosier

Differential Revision: http://reviews.llvm.org/D16712

llvm-svn: 263743

8 years agoBitcode: Error out instead of crashing on corrupt metadata
Justin Bogner [Thu, 17 Mar 2016 20:12:06 +0000 (20:12 +0000)]
Bitcode: Error out instead of crashing on corrupt metadata

I hit a crash in the bitcode reader on some corrupt input where an
MDString had somehow been attached to an instruction instead of an
MDNode. This input is pretty bogus, but we shouldn't be crashing on bad
input here.

This change adds error handling in all of the places where we
currently have unchecked casts from Metadata to MDNode, which means
we'll error out instead of crashing for that sort of input.

Unfortunately, I don't have tests. Hitting this requires flipping bits
in the input bitcode, and committing corrupt binary files to catch
these cases is a bit too opaque and unmaintainable.

llvm-svn: 263742

8 years agoARM: stop asserting on weird <3 x Ty> vectors in ISelLowering.
Tim Northover [Thu, 17 Mar 2016 20:10:28 +0000 (20:10 +0000)]
ARM: stop asserting on weird <3 x Ty> vectors in ISelLowering.

llvm-svn: 263741

8 years agoRevert "For MS ABI, emit dllexport friend functions defined inline in class"
Reid Kleckner [Thu, 17 Mar 2016 20:06:58 +0000 (20:06 +0000)]
Revert "For MS ABI, emit dllexport friend functions defined inline in class"

This reverts commit r263738.

This appears to cause a failure in
CXX/temp/temp.decls/temp.friend/p1.cpp

llvm-svn: 263740

8 years ago[libFuzzer] deprecate several flags
Kostya Serebryany [Thu, 17 Mar 2016 19:59:39 +0000 (19:59 +0000)]
[libFuzzer] deprecate several flags

llvm-svn: 263739

8 years agoFor MS ABI, emit dllexport friend functions defined inline in class
Reid Kleckner [Thu, 17 Mar 2016 19:52:20 +0000 (19:52 +0000)]
For MS ABI, emit dllexport friend functions defined inline in class

Summary: ...as that is apparently what MSVC does

Reviewers: rnk

Patch by Stephan Bergmann

Differential Revision: http://reviews.llvm.org/D15267

llvm-svn: 263738

8 years ago[libFuzzer] add __attribute__((no_sanitize_memory)) to two functions that may be...
Kostya Serebryany [Thu, 17 Mar 2016 19:42:35 +0000 (19:42 +0000)]
[libFuzzer] add __attribute__((no_sanitize_memory)) to two functions that may be called from signal handler(s) or from msan. This will hopefully avoid msan false reports which I can't reproduce

llvm-svn: 263737

8 years ago[msan fix] unitalized variable
Michael J. Spencer [Thu, 17 Mar 2016 19:16:54 +0000 (19:16 +0000)]
[msan fix] unitalized variable

llvm-svn: 263736

8 years agoFix deadlock due to thread list locking in 'bt all' with obj-c
Stephane Sezer [Thu, 17 Mar 2016 18:52:41 +0000 (18:52 +0000)]
Fix deadlock due to thread list locking in 'bt all' with obj-c

Summary:
The gdb-remote async thread cannot modify thread state while the main thread
holds a lock on the state. Don't use locking thread iteration for bt all.

Specifically, the deadlock manifests when lldb attempts to JIT code to
symbolicate objective c while backtracing. As part of this code path,
SetPrivateState() is called on an async thread. This async thread will
block waiting for the thread_list lock held by the main thread in
CommandObjectIterateOverThreads. The main thread will also block on the
async thread during DoResume (although with a timeout), leading to a
deadlock. Due to the timeout, the deadlock is not immediately apparent,
but the inferior will be left in an invalid state after the bt all completes,
and objective-c symbols will not be successfully resolved in the backtrace.

Reviewers: andrew.w.kaylor, jingham, clayborg

Subscribers: sas, lldb-commits

Differential Revision: http://reviews.llvm.org/D18075

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 263735

8 years ago[InstCombine] Combine A->B->A BitCast
Guozhi Wei [Thu, 17 Mar 2016 18:47:20 +0000 (18:47 +0000)]
[InstCombine] Combine A->B->A BitCast

This patch enhances InstCombine to handle following case:

        A  ->  B    bitcast
        PHI
        B  ->  A    bitcast

llvm-svn: 263734

8 years ago[Statepoints] Export a magic constant into a header; NFC
Sanjoy Das [Thu, 17 Mar 2016 18:42:17 +0000 (18:42 +0000)]
[Statepoints] Export a magic constant into a header; NFC

llvm-svn: 263733

8 years agoRemove defaulted move ops, the type is zero-cost copyable anyway, so there's no need...
David Blaikie [Thu, 17 Mar 2016 18:28:16 +0000 (18:28 +0000)]
Remove defaulted move ops, the type is zero-cost copyable anyway, so there's no need for specific move ops

(addresses MSVC build error, since MSVC 2013 can't generate default move
ops)

llvm-svn: 263732

8 years ago[lit] Enqueue tests on a separate thread to not hit limits on parallel queues
Filipe Cabecinhas [Thu, 17 Mar 2016 18:27:33 +0000 (18:27 +0000)]
[lit] Enqueue tests on a separate thread to not hit limits on parallel queues

Summary:
The multiprocessing.Queue.put() call can hang if we try queueing all the
tests before starting to take them out of the queue.
The current implementation hangs if tests exceed 2^^15, on Mac OS X.
This might happen with a ninja check-all if one has a bunch of llvm
projects.

Reviewers: delcypher, bkramer

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D17609

llvm-svn: 263731

8 years agoFix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.
David Blaikie [Thu, 17 Mar 2016 18:05:07 +0000 (18:05 +0000)]
Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

Fix implicit copy ctor and copy assignment operator warnings
when -Wdeprecated passed.

Patch by Don Hinton!

Differential Revision: http://reviews.llvm.org/D18123

llvm-svn: 263730

8 years ago[AMDGPU] add VI disassembler tests. NFC.
Valery Pykhtin [Thu, 17 Mar 2016 17:56:33 +0000 (17:56 +0000)]
[AMDGPU] add VI disassembler tests. NFC.

Autogenerated from the corresponding assembler tests with a few FIXME added (will fix soon).

Differential Revision: http://reviews.llvm.org/D18249

llvm-svn: 263729

8 years ago[PowerPC] Disable CTR loops optimization for soft float operations
Petar Jovanovic [Thu, 17 Mar 2016 17:11:33 +0000 (17:11 +0000)]
[PowerPC] Disable CTR loops optimization for soft float operations

This patch prevents CTR loops optimization when using soft float operations
inside loop body. Soft float operations use function calls, but function
calls are not allowed inside CTR optimized loops.

Patch by Aleksandar Beserminji.

Differential Revision: http://reviews.llvm.org/D17600

llvm-svn: 263727

8 years agoFix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.
Eugene Zelenko [Thu, 17 Mar 2016 17:02:25 +0000 (17:02 +0000)]
Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.

Differential revision: http://reviews.llvm.org/D18231

llvm-svn: 263726

8 years ago[WebAssembly] Stackify code emitted by eliminateFrameIndex and SP writeback
Derek Schuff [Thu, 17 Mar 2016 17:00:29 +0000 (17:00 +0000)]
[WebAssembly] Stackify code emitted by eliminateFrameIndex and SP writeback

Summary:
MRI::eliminateFrameIndex can emit several instructions to do address
calculations; these can usually be stackified. Because instructions with
FI operands can have subsequent operands which may be expression trees,
find the top of the leftmost tree and insert the code before it, to keep
the LIFO property.

Also use stackified registers when writing back the SP value to memory
in the epilog; it's unnecessary because SP will not be used after the
epilog, and it results in better code.

Differential Revision: http://reviews.llvm.org/D18234

llvm-svn: 263725

8 years ago[COFF] Use coff_section::getAlignment
David Majnemer [Thu, 17 Mar 2016 16:58:08 +0000 (16:58 +0000)]
[COFF] Use coff_section::getAlignment

Use LLVM's section alignment calculation instead of having LLD calculate
it.

llvm-svn: 263724

8 years ago[COFF] Fix invalid alignment in tests
David Majnemer [Thu, 17 Mar 2016 16:56:31 +0000 (16:56 +0000)]
[COFF] Fix invalid alignment in tests

Some COFF tests used INT_MIN for the alignment of the directive section.
This is invalid; replace the alignment with something more sensible: 1.

llvm-svn: 263723

8 years ago[COFF] Refactor section alignment calculation
David Majnemer [Thu, 17 Mar 2016 16:55:18 +0000 (16:55 +0000)]
[COFF] Refactor section alignment calculation

Section alignment isn't completely trivial, let it live in one place so
that we may reuse it in LLVM.

llvm-svn: 263722

8 years agoForgot to commit this with r263692
David Majnemer [Thu, 17 Mar 2016 16:55:11 +0000 (16:55 +0000)]
Forgot to commit this with r263692

llvm-svn: 263721

8 years agoAMDGPU/SI: Do not generate s_waitcnt after ds_permute/ds_bpermute
Changpeng Fang [Thu, 17 Mar 2016 16:43:50 +0000 (16:43 +0000)]
AMDGPU/SI: Do not generate s_waitcnt after ds_permute/ds_bpermute

Symmary:
  ds_permute/ds_bpermute do not read memory so s_waitcnt is not needed.

Reviewers
  arsenm, tstellarAMD

Subscribers
  llvm-commits, arsenm

Differential Revision:
  http://reviews.llvm.org/D18197

llvm-svn: 263720

8 years agoAMDGPU: mark atomic instructions as sources of divergence
Nicolai Haehnle [Thu, 17 Mar 2016 16:21:59 +0000 (16:21 +0000)]
AMDGPU: mark atomic instructions as sources of divergence

Summary:
As explained by the comment, threads will typically see different values
returned by atomic instructions even if the arguments are equal.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D18156

llvm-svn: 263719