platform/upstream/llvm.git
8 years agoAdd a hasOperandBundlesOtherThan helper, and use it; NFC
Sanjoy Das [Tue, 22 Mar 2016 17:51:25 +0000 (17:51 +0000)]
Add a hasOperandBundlesOtherThan helper, and use it; NFC

llvm-svn: 264072

8 years agoStaticAnalyzer: Avoid an unintentional copy
Justin Bogner [Tue, 22 Mar 2016 17:50:05 +0000 (17:50 +0000)]
StaticAnalyzer: Avoid an unintentional copy

The range here isn't over references, so using `auto &` here incites a
copy. Switching to `auto *` would do, but we might as well list an
explicit type for clarity.

Found by -Wrange-loop-analysis.

llvm-svn: 264071

8 years agoAppease MSVC bots by changing visibility of AtomVector.
Pete Cooper [Tue, 22 Mar 2016 17:39:44 +0000 (17:39 +0000)]
Appease MSVC bots by changing visibility of AtomVector.

The AtomVector class is an internal detail of File so I moved it
to be protected in r264067.  However, the MSVC bots don't like the
global declarations of type File::AtomVector in File.cpp so it needs
to go back to being public for now.

llvm-svn: 264070

8 years ago[clang-tidy] Fix redundant-string-init check with msvc 14 headers.
Etienne Bergeron [Tue, 22 Mar 2016 17:39:36 +0000 (17:39 +0000)]
[clang-tidy] Fix redundant-string-init check with msvc 14 headers.

Summary:
The string constructors are not defined using optional parameters and are not recognized by the redundant-string-init checker.

The following patch fixes the redundant-string-init checker for the Visual Studio 14 headers file.
The matcher now accept both variant (with 1 and 2 parameters).

Also added new unittests.

Similar issue than: [[ http://reviews.llvm.org/D18285 | review ]]

In the xstring.h header, the constructors are defined this way:
```
basic_string(const _Myt& _Right) [...]
basic_string(const _Myt& _Right, const _Alloc& _Al) [...]
```

Reviewers: alexfh, hokein

Subscribers: cfe-commits

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

llvm-svn: 264069

8 years ago[tsan] Disable randomized address space on linux aarch64.
Yabin Cui [Tue, 22 Mar 2016 17:16:26 +0000 (17:16 +0000)]
[tsan] Disable randomized address space on linux aarch64.

Summary:
After patch https://lkml.org/lkml/2015/12/21/340 is introduced in
linux kernel, the random gap between stack and heap is increased
from 128M to 36G on 39-bit aarch64. And it is almost impossible
to cover this big range. So I think we need to disable randomized
virtual space on aarch64 linux.

Reviewers: kcc, llvm-commits, eugenis, zatrazz, dvyukov, rengolin

Subscribers: rengolin, aemerson, tberghammer, danalbert, srhines, enh

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

llvm-svn: 264068

8 years agoUse owning pointers instead of raw pointers for Atom's to fix leaks.
Pete Cooper [Tue, 22 Mar 2016 17:15:50 +0000 (17:15 +0000)]
Use owning pointers instead of raw pointers for Atom's to fix leaks.

This is a re-commit of r264022 with a fix for MSVC.  The issue there was
that the code was running DefinedAtom::~Atom() for some value and instead
needed to cast to Atom before running ~Atom.  Original commit message follows.

Currently each File contains an BumpPtrAllocator in which Atom's are
allocated.  Some Atom's contain data structures like std::vector which
leak as we don't run ~Atom when they are BumpPtrAllocate'd.

Now each File actually owns its Atom's using an OwningAtomPtr.  This
is analygous to std::unique_ptr and may be replaced by it if possible.

An Atom can therefore only be owned by a single File, so the Resolver now
moves them from one File to another.  The MachOLinkingContext owns the File's
and so clears all the Atom's in ~MachOLinkingContext, then delete's all the
File's.  This makes sure all Atom's have been destructed before any of the
BumpPtrAllocator's in which they run have gone away.

Should hopefully fix the remaining leaks.  Will keep an eye on the bots to
make sure.

llvm-svn: 264067

8 years agoMake build bots happy
David Majnemer [Tue, 22 Mar 2016 17:10:07 +0000 (17:10 +0000)]
Make build bots happy

BasicBlock's lose their names for some builders, don't mention such
names.

llvm-svn: 264066

8 years ago[MS ABI] Assign an inheritance model for the dest of a member pointer upcast
David Majnemer [Tue, 22 Mar 2016 16:44:39 +0000 (16:44 +0000)]
[MS ABI] Assign an inheritance model for the dest of a member pointer upcast

While we correctly assigned an inheritance model for the source of a
member pointer upcast, we did not do so for the destination.

This fixes PR27030.

llvm-svn: 264065

8 years ago[Perf-training] Using os.devnull instead of a temp file
Chris Bieneman [Tue, 22 Mar 2016 16:33:23 +0000 (16:33 +0000)]
[Perf-training] Using os.devnull instead of a temp file

This is based on post-commit feedback from Vedant. Totally didn't know that existed and worked on Windows.

Thanks Vedant!

llvm-svn: 264064

8 years ago[Perf-training] Cleanup based on feedback from Sean Silvas
Chris Bieneman [Tue, 22 Mar 2016 16:27:35 +0000 (16:27 +0000)]
[Perf-training] Cleanup based on feedback from Sean Silvas

Sean provided feedback based on r257934 on cfe-commits. This change addresses that feedback.

llvm-svn: 264063

8 years ago[X86][SSE] Reapplied: Simplify vector LOAD + EXTEND on pre-SSE41 hardware
Simon Pilgrim [Tue, 22 Mar 2016 16:22:08 +0000 (16:22 +0000)]
[X86][SSE] Reapplied: Simplify vector LOAD + EXTEND on pre-SSE41 hardware

Improve vector extension of vectors on hardware without dedicated VSEXT/VZEXT instructions.

We already convert these to SIGN_EXTEND_VECTOR_INREG/ZERO_EXTEND_VECTOR_INREG but can further improve this by using the legalizer instead of prematurely splitting into legal vectors in the combine as this only properly helps for lowering to VSEXT/VZEXT.

Removes a lot of unnecessary any_extend + mask pattern - (Fix for PR25718).

Reapplied with a fix for PR26953 (missing vector widening legalization).

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

llvm-svn: 264062

8 years ago[asan] Add ucrtbase.dll to the list of DLLs to intercept
Reid Kleckner [Tue, 22 Mar 2016 15:46:50 +0000 (15:46 +0000)]
[asan] Add ucrtbase.dll to the list of DLLs to intercept

Reduces number of test failures in check-asan-dynamic with VS 2015.

llvm-svn: 264061

8 years ago[asan] Add one more x86 encoding to the interceptor for strrchr
Reid Kleckner [Tue, 22 Mar 2016 15:46:43 +0000 (15:46 +0000)]
[asan] Add one more x86 encoding to the interceptor for strrchr

llvm-svn: 264060

8 years ago[unittests] clang-format a line, NFC
Vedant Kumar [Tue, 22 Mar 2016 15:14:18 +0000 (15:14 +0000)]
[unittests] clang-format a line, NFC

llvm-svn: 264059

8 years ago[tsan] Change nullptr to NULL in one Darwin test.
Kuba Brecka [Tue, 22 Mar 2016 14:59:46 +0000 (14:59 +0000)]
[tsan] Change nullptr to NULL in one Darwin test.

Depending on the version of libcxx, nullptr might not be available. Let's use NULL instead.

llvm-svn: 264058

8 years ago[mips] Make simm6 consistent with the rest. NFC.
Daniel Sanders [Tue, 22 Mar 2016 14:50:22 +0000 (14:50 +0000)]
[mips] Make simm6 consistent with the rest. NFC.

Summary:

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 264057

8 years ago[mips] Range check simm7.
Daniel Sanders [Tue, 22 Mar 2016 14:40:00 +0000 (14:40 +0000)]
[mips] Range check simm7.

Summary:
Also renamed li_simm7 to li16_imm since it's not a simm7 and has an unusual
encoding (it's a uimm7 except that 0x7f represents -1).

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 264056

8 years agoclang-format: [JS] do not wrap ES6 imports/exports.
Daniel Jasper [Tue, 22 Mar 2016 14:32:20 +0000 (14:32 +0000)]
clang-format: [JS] do not wrap ES6 imports/exports.

"import ... from '...';" and "export ... from '...';" should be treated
the same as goog.require/provide/module/forwardDeclare calls.

Patch by Martin Probst.

llvm-svn: 264055

8 years ago[mips] Range check simm5.
Daniel Sanders [Tue, 22 Mar 2016 14:29:53 +0000 (14:29 +0000)]
[mips] Range check simm5.

Summary:
We can't check the error message for this one because there's another lw/sw
available that covers a larger range. We therefore check the transition
between the two sizes.

Reviewers: vkalintiris

Subscribers: llvm-commits, dsanders

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

llvm-svn: 264054

8 years ago[mips] Range check vsplat_uimm[1234568].
Daniel Sanders [Tue, 22 Mar 2016 14:17:41 +0000 (14:17 +0000)]
[mips] Range check vsplat_uimm[1234568].

Summary:

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 264053

8 years ago[mips] Range check uimm4_ptr, remove uimm6_ptr, and use correctly sized immediates...
Daniel Sanders [Tue, 22 Mar 2016 13:58:53 +0000 (13:58 +0000)]
[mips] Range check uimm4_ptr, remove uimm6_ptr, and use correctly sized immediates in MSA copy/insert.

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 264052

8 years ago[PATCH] Force LoopReroll to reset the loop trip count value after reroll.
Zinovy Nis [Tue, 22 Mar 2016 13:50:57 +0000 (13:50 +0000)]
[PATCH] Force LoopReroll to reset the loop trip count value after reroll.

It's a bug fix.
For rerolled loops SE trip count remains unchanged. It leads to incorrect work of the next passes.
My patch just resets SE info for rerolled loop forcing SE to re-evaluate it next time it requested.
I also added a verifier call in the exisitng test to be sure no invalid SE data remain. Without my fix this test would fail with -verify-scev.

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

llvm-svn: 264051

8 years agoMoving files that were placed in the wrong directory from r264049.
Aaron Ballman [Tue, 22 Mar 2016 13:44:36 +0000 (13:44 +0000)]
Moving files that were placed in the wrong directory from r264049.

llvm-svn: 264050

8 years agoFix crashes from delayed template parsing code that assumed getBody() would return...
Aaron Ballman [Tue, 22 Mar 2016 13:37:44 +0000 (13:37 +0000)]
Fix crashes from delayed template parsing code that assumed getBody() would return non-null.

Patch by Etienne Bergeron.

llvm-svn: 264049

8 years agoSkip some relocations in scanRelocs.
Rafael Espindola [Tue, 22 Mar 2016 13:24:29 +0000 (13:24 +0000)]
Skip some relocations in scanRelocs.

When a tls access is optimized, a group of relocations is converted at a
time.

We were already skipping relocations that were optimized out in
relocate, but not in scanRelocs.

This is a small optimization. I got here while working on a patch that
will always keep scanRelocs and relocate in sync.

llvm-svn: 264048

8 years ago[ELF] - Process R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX relocations.
George Rimar [Tue, 22 Mar 2016 12:15:26 +0000 (12:15 +0000)]
[ELF] - Process R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX relocations.

R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX relocations were added in latest ABI:
https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-r249.pdf

They should be generated instead of R_X86_64_GOTPCREL for cases
when relaxation is possible. Currently this patch just process them in the
same way like R_X86_64_GOTPCREL. That should work for now
and we can implement relaxations later.

There is no testcases provided as I think there is no way to generate
such relocations using llvm-mc atm.

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

llvm-svn: 264043

8 years ago[ELF][gcc compatibility]: support section names with special characters (e.g. "/")
Marina Yatsina [Tue, 22 Mar 2016 11:23:15 +0000 (11:23 +0000)]
[ELF][gcc compatibility]: support section names with special characters (e.g. "/")

Adding support for section names with special characters in them (e.g. "/").
GCC successfully compiles such section names.
This also fixes PR24520.

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

llvm-svn: 264038

8 years ago[ASTMatchers] New matcher hasReturnValue added
Alexander Kornienko [Tue, 22 Mar 2016 11:03:03 +0000 (11:03 +0000)]
[ASTMatchers] New matcher hasReturnValue added

Summary: A checker (will be uploaded after this patch) needs to check implicit casts. Existing generic matcher "has" ignores implicit casts and parenthesized expressions and no specific matcher for matching return value expression preexisted. The patch adds such a matcher (hasReturnValue).

Reviewers: klimek, sbenza

Subscribers: xazax.hun, klimek, cfe-commits

Patch by Ádám Balogh!

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

llvm-svn: 264037

8 years agoFix warning about extra semicolon. NFC.
Vasileios Kalintiris [Tue, 22 Mar 2016 10:41:20 +0000 (10:41 +0000)]
Fix warning about extra semicolon. NFC.

llvm-svn: 264035

8 years ago[ELF][MIPS] Delete GotSection::addMipsLocalEntry method
Simon Atanasyan [Tue, 22 Mar 2016 08:36:48 +0000 (08:36 +0000)]
[ELF][MIPS] Delete GotSection::addMipsLocalEntry method

Now local symbols have SymbolBody so we can handle all kind of symbols
in the GotSection::addEntry method. The patch moves the code from
addMipsLocalEntry to addEntry. NFC.

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

llvm-svn: 264032

8 years ago[OMPT] Make tests require OMPT_BLAME
Jonas Hahnfeld [Tue, 22 Mar 2016 08:23:24 +0000 (08:23 +0000)]
[OMPT] Make tests require OMPT_BLAME

ompt_event_barrier_{begin,end} are optional blame events.
In total it doesn't make any sense to test partially built OMPT support.

llvm-svn: 264031

8 years ago[LLDB]{MIPS] Fix TestPlatformProcessConnect.py
Mohit K. Bhakkad [Tue, 22 Mar 2016 08:08:02 +0000 (08:08 +0000)]
[LLDB]{MIPS] Fix TestPlatformProcessConnect.py
Patch by Nitesh Jain

Reviewers: clayborg, labath.
Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D18082

llvm-svn: 264030

8 years agoFix unittests: resize() -> reserve()
Mehdi Amini [Tue, 22 Mar 2016 07:35:51 +0000 (07:35 +0000)]
Fix unittests: resize() -> reserve()

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264029

8 years agoDenseMap resize() is now named reserved(), adapt the call sites
Mehdi Amini [Tue, 22 Mar 2016 07:31:35 +0000 (07:31 +0000)]
DenseMap resize() is now named reserved(), adapt the call sites

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264028

8 years ago[OMPT] Create infrastructure and add first tests for OMPT
Jonas Hahnfeld [Tue, 22 Mar 2016 07:22:49 +0000 (07:22 +0000)]
[OMPT] Create infrastructure and add first tests for OMPT

Some basic checks next to the implementation should futher lower the
possibility to introduce regressions. (Note that this would have catched
the ordering issue fixed in rL258866 and pointed to rL263940.)

The tests are implementation dependent in one point because they assume that
thread ids are assigned in ascending order. This is not defined by the standard
but currently ensured in libomp. We have to think about another way of ordering
the threads should this ever be subject to change...

Note that this isn't aiming at replacing the implementation independent
test-suite at https://github.com/OpenMPToolsInterface/ompt-test-suite!

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

llvm-svn: 264027

8 years agoRename DenseMap::resize() into DenseMap::reserve() (NFC)
Mehdi Amini [Tue, 22 Mar 2016 07:20:00 +0000 (07:20 +0000)]
Rename DenseMap::resize() into DenseMap::reserve() (NFC)

This is more coherent with usual containers.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 264026

8 years ago[Objective-c] Do not set IsExact to true when the receiver is a class.
Akira Hatanaka [Tue, 22 Mar 2016 05:00:21 +0000 (05:00 +0000)]
[Objective-c] Do not set IsExact to true when the receiver is a class.

IsExact shouldn't be set to true in WeakObjectProfileTy::getBaseInfo
when the receiver is a class because having a class as the receiver
doesn't guarantee that the Base is exact.

This is a follow-up to r263818.

rdar://problem/25208167

llvm-svn: 264025

8 years agoMinor code cleanup. NFC.
Junmo Park [Tue, 22 Mar 2016 04:37:32 +0000 (04:37 +0000)]
Minor code cleanup. NFC.

llvm-svn: 264024

8 years agoRevert "Use owning pointers instead of raw pointers for Atom's to fix leaks."
Pete Cooper [Tue, 22 Mar 2016 04:00:41 +0000 (04:00 +0000)]
Revert "Use owning pointers instead of raw pointers for Atom's to fix leaks."

This reverts commit r264022.

This breaks the Window's bots which don't like that i'm calling ~Atom when
the this pointer is a sublcass of Atom.

Reverting for now until I try find a better fix.  I tried using std::unique_ptr with
a custom deleter as a quick fix, but it didn't work well in the YAML parser.

llvm-svn: 264023

8 years agoUse owning pointers instead of raw pointers for Atom's to fix leaks.
Pete Cooper [Tue, 22 Mar 2016 03:44:32 +0000 (03:44 +0000)]
Use owning pointers instead of raw pointers for Atom's to fix leaks.

Currently each File contains an BumpPtrAllocator in which Atom's are
allocated.  Some Atom's contain data structures like std::vector which
leak as we don't run ~Atom when they are BumpPtrAllocate'd.

Now each File actually owns its Atom's using an OwningAtomPtr.  This
is analygous to std::unique_ptr and may be replaced by it if possible.

An Atom can therefore only be owned by a single File, so the Resolver now
moves them from one File to another.  The MachOLinkingContext owns the File's
and so clears all the Atom's in ~MachOLinkingContext, then delete's all the
File's.  This makes sure all Atom's have been destructed before any of the
BumpPtrAllocator's in which they run have gone away.

Should hopefully fix the remaining leaks.  Will keep an eye on the bots to
make sure.

llvm-svn: 264022

8 years ago[Perf-training] Fixing an issue with multi-threading PGO generation
Chris Bieneman [Tue, 22 Mar 2016 02:55:40 +0000 (02:55 +0000)]
[Perf-training] Fixing an issue with multi-threading PGO generation

When LIT parallelizes the profraw file generation we need to generate unique temp filenames then clean them up after the driver executes.

llvm-svn: 264021

8 years agoVisual Studio Native Visualizations for constructors and methods
Mike Spertus [Tue, 22 Mar 2016 02:29:22 +0000 (02:29 +0000)]
Visual Studio Native Visualizations for constructors and methods

With this change, the class

  struct A {
    A(int _i);
    ~A();
    int foo(double d);
    double bar(A *a) { return 1.3; }
  };

appears in the VS2015 Locals Window as

D              0x02dbb378 struct A
|- DeclKind    CXXRecord
|- Members
 |- [0]        implicit struct A
 |- [1]        Constructor {A(int _i)}
 |- [2]        Destructor {~A()}
 |- [3]        Method {int foo(double d)}
 |- [4]        Method {double bar(struct A *)}
|- [Raw View]  /* Other stuff */

Note that these changes only benefit VS2015 as
VS2013 does not have views and only displays the
struct name "A", but the change does no apparent
harm in VS2013, so is still a win.

llvm-svn: 264020

8 years agoAppease the windows buildbots
Sanjoy Das [Tue, 22 Mar 2016 02:11:57 +0000 (02:11 +0000)]
Appease the windows buildbots

The guess is that the stdout/stderr ordering may differ between windows
/ unix.

llvm-svn: 264019

8 years ago[OpenMP] Base support for target directive codegen on NVPTX device.
Arpith Chacko Jacob [Tue, 22 Mar 2016 01:48:56 +0000 (01:48 +0000)]
[OpenMP] Base support for target directive codegen on NVPTX device.

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

Reviewers: ABataev

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

Reworked test case after buildbot failure on windows.
Updated patch to integrate r263837 and test case nvptx_target_firstprivate_codegen.cpp.

llvm-svn: 264018

8 years agoMove -fms-compatibility-version=19 into target cflags
Reid Kleckner [Tue, 22 Mar 2016 01:14:36 +0000 (01:14 +0000)]
Move -fms-compatibility-version=19 into target cflags

This reduces cflags duplication and allows us to build
sanitizer_common/tests with clang and the VS 2015 STL.

llvm-svn: 264017

8 years ago[asan] Relax strdup test check lines
Reid Kleckner [Tue, 22 Mar 2016 01:04:33 +0000 (01:04 +0000)]
[asan] Relax strdup test check lines

On the buildbot, strdup appears as frame 1 instead of frame 0. Either is
an acceptable user experience.

llvm-svn: 264016

8 years agoAdd "first class" lowering for deopt operand bundles
Sanjoy Das [Tue, 22 Mar 2016 00:59:13 +0000 (00:59 +0000)]
Add "first class" lowering for deopt operand bundles

Summary:
After this change, deopt operand bundles can be lowered directly by
SelectionDAG into STATEPOINT instructions (which are then lowered to a
call or sequence of nop, with an associated __llvm_stackmaps entry0.
This obviates the need to round-trip deoptimization state through
gc.statepoint via RewriteStatepointsForGC.

Reviewers: reames, atrick, majnemer, JosephTremoulet, pgavlin

Subscribers: sanjoy, mcrosier, majnemer, llvm-commits

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

llvm-svn: 264015

8 years agoWrap 81 character line to satisfy linter
Reid Kleckner [Tue, 22 Mar 2016 00:53:04 +0000 (00:53 +0000)]
Wrap 81 character line to satisfy linter

llvm-svn: 264014

8 years ago[asan] Intercept strdup on Windows
Reid Kleckner [Tue, 22 Mar 2016 00:52:47 +0000 (00:52 +0000)]
[asan] Intercept strdup on Windows

Some unit tests were failing because we didn't intercept strdup.  It
turns out it works just fine on 2013 and 2015 with a small patch to the
interception logic.

llvm-svn: 264013

8 years ago[JITLoaderGDB] Pack the jit entry struct according to the target arch.
Siva Chandra [Tue, 22 Mar 2016 00:35:31 +0000 (00:35 +0000)]
[JITLoaderGDB] Pack the jit entry struct according to the target arch.

Reviewers: clayborg

Subscribers: tberghammer, dsrbecky, lldb-commits

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

llvm-svn: 264012

8 years ago[asan] Also apply r264006 to asan_win_dynamic_runtime_thunk.cc
Reid Kleckner [Tue, 22 Mar 2016 00:34:53 +0000 (00:34 +0000)]
[asan] Also apply r264006 to asan_win_dynamic_runtime_thunk.cc

llvm-svn: 264011

8 years agoFix coverage-related asan tests for VS 2015
Reid Kleckner [Tue, 22 Mar 2016 00:11:51 +0000 (00:11 +0000)]
Fix coverage-related asan tests for VS 2015

printf is an inline function in VS 2015, giving these tests an
unexpected extra point of coverage. This change works around that by
avoiding printf.

llvm-svn: 264010

8 years ago[CUDA] Implement atomicInc and atomicDec builtins
Justin Lebar [Tue, 22 Mar 2016 00:09:28 +0000 (00:09 +0000)]
[CUDA] Implement atomicInc and atomicDec builtins

These functions cannot be implemented as atomicrmw or cmpxchg
instructions, so they are implemented as a call to the NVVM intrinsics
@llvm.nvvm.atomic.load.inc.32.p0i32 and
@llvm.nvvm.atomic.load.dec.32.p0i32.

Patch by Jason Henline.

Reviewers: jlebar

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

llvm-svn: 264009

8 years ago[sema] [CUDA] Use std algorithms in EraseUnwantedCUDAMatchesImpl.
Justin Lebar [Tue, 22 Mar 2016 00:09:25 +0000 (00:09 +0000)]
[sema] [CUDA] Use std algorithms in EraseUnwantedCUDAMatchesImpl.

Summary: NFC

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 264008

8 years agoRevert r263974, "clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting."
NAKAMURA Takumi [Mon, 21 Mar 2016 23:51:50 +0000 (23:51 +0000)]
Revert r263974, "clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting."

It seems the test wouldn't expect if default target is *-win32.

llvm-svn: 264007

8 years ago[asan] Set the unhandled exception filter slightly later during startup
Reid Kleckner [Mon, 21 Mar 2016 23:51:21 +0000 (23:51 +0000)]
[asan] Set the unhandled exception filter slightly later during startup

VS 2015 moved the priority of their exception filter initializer from
XIY to XCAA. We now set ours to XCAB, which makes it run after both CRT
versions but before user constructors, as it should.

Fixes null_deref.cc and a variety of related tests with VS 2015. Only 4
failures remain.

llvm-svn: 264006

8 years ago[asan] Add new _*_base interceptors for VS 2015
Reid Kleckner [Mon, 21 Mar 2016 23:51:17 +0000 (23:51 +0000)]
[asan] Add new _*_base interceptors for VS 2015

There are some places in the CRT (such as mbctype) that directly call
_malloc_base. If you are incrementally linking a binary with ASan from
before this change, this change appears to result in a linker error.
Retrying the link succeeds for some reason.

llvm-svn: 264005

8 years agoMove ownership of Pass File's to the MachoLinkingContext.
Pete Cooper [Mon, 21 Mar 2016 23:17:47 +0000 (23:17 +0000)]
Move ownership of Pass File's to the MachoLinkingContext.

In trying to fix the leaks in the MachO lld codebase, we need to have
a better model for file and atom ownership.  Having the context own
everything seems like the simplest model, so change all the passes to
allocate File's on the context instead of owning files as a member.

llvm-svn: 264004

8 years ago[sancov] do not instrument nodes that are full pre-dominators
Mike Aizatsky [Mon, 21 Mar 2016 23:08:16 +0000 (23:08 +0000)]
[sancov] do not instrument nodes that are full pre-dominators

Summary:
Without tree pruning clang has 2,667,552 points.
Wiht only dominators pruning: 1,515,586.
With both dominators & predominators pruning: 1,340,534.

Resubmit of r262103.

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

llvm-svn: 264003

8 years ago[CUDA] Add documentation explaining how to detect clang vs nvcc.
Justin Lebar [Mon, 21 Mar 2016 23:05:15 +0000 (23:05 +0000)]
[CUDA] Add documentation explaining how to detect clang vs nvcc.

llvm-svn: 264002

8 years agoFixed some cases in the modularize assistant mode where header file names didn't...
John Thompson [Mon, 21 Mar 2016 23:05:14 +0000 (23:05 +0000)]
Fixed some cases in the modularize assistant mode where header file names didn't translate to valid module names.

llvm-svn: 264001

8 years agoAMDGPU: Fix dangling references introduced by r263982
Nicolai Haehnle [Mon, 21 Mar 2016 22:54:02 +0000 (22:54 +0000)]
AMDGPU: Fix dangling references introduced by r263982

Fixes Valgrind errors on the test cases that were reported as failing
by buildbots.

llvm-svn: 264000

8 years ago[ELF] Simplify code a bit. No functional change.
Davide Italiano [Mon, 21 Mar 2016 22:44:24 +0000 (22:44 +0000)]
[ELF] Simplify code a bit. No functional change.

llvm-svn: 263999

8 years ago[asan] Add strrchr to asan_win_dll_thunk.
Evgeniy Stepanov [Mon, 21 Mar 2016 22:42:15 +0000 (22:42 +0000)]
[asan] Add strrchr to asan_win_dll_thunk.

"dll_host.cc" test says there is a mismatch.

llvm-svn: 263998

8 years ago[Perf-training] Adding support for tests to skip the clang driver
Chris Bieneman [Mon, 21 Mar 2016 22:37:14 +0000 (22:37 +0000)]
[Perf-training] Adding support for tests to skip the clang driver

This patch adds a new set of substitutions to the lit run lines for order files and PGO generation which run the clang driver to get the cc1 command, then execute the cc1 command directly. This allows the scripts to bypass profiling the clang driver over and over again.

The approach in this patch was discussed via IRC with Sean Silvas.

Special thanks to Daniel Dunbar whose out-of-tree code I liberally plagiarized.

llvm-svn: 263997

8 years ago[modules] Store mangling numbers in a deterministic order so they don't cause the...
Richard Smith [Mon, 21 Mar 2016 22:33:02 +0000 (22:33 +0000)]
[modules] Store mangling numbers in a deterministic order so they don't cause the resulting .pcm files to be nondeterministic.

llvm-svn: 263996

8 years agoCollect IRExecutionUnits as part of persistent expression state.
Sean Callanan [Mon, 21 Mar 2016 22:23:38 +0000 (22:23 +0000)]
Collect IRExecutionUnits as part of persistent expression state.

IRExecutionUnits contain code and data that persistent declarations can
depend on.  In order to keep them alive and provide for lookup of these
symbols, we now allow any PersistentExpressionState to keep a list of
execution units.  Then, when doing symbol lookup on behalf of an
expression, any IRExecutionUnit can consult the persistent expression
states on a particular Target to find the appropriate symbol.

<rdar://problem/22864976>

llvm-svn: 263995

8 years ago[InstCombine] Ensure all undef operands are handled before binary instruction constan...
Simon Pilgrim [Mon, 21 Mar 2016 22:15:50 +0000 (22:15 +0000)]
[InstCombine] Ensure all undef operands are handled before binary instruction constant folding

As noted in PR18355, this patch makes it clear that all cases with undef operands have been handled before further constant folding is attempted.

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

llvm-svn: 263994

8 years agoFix -Wdocumentation warnings from r263853
Duncan P. N. Exon Smith [Mon, 21 Mar 2016 22:13:44 +0000 (22:13 +0000)]
Fix -Wdocumentation warnings from r263853

Thanks to chapuni for catching this.

llvm-svn: 263993

8 years ago[sanitizer] Add strchr* to the common interceptors
Evgeniy Stepanov [Mon, 21 Mar 2016 21:36:17 +0000 (21:36 +0000)]
[sanitizer] Add strchr* to the common interceptors

Adds strchr, strchrnul, and strrchr to the common interceptors, under a new
common flag intercept_strchr.

Removes the now-duplicate strchr interceptor from asan and all 3
interceptors from tsan. Previously, asan did not intercept strchrnul, but
does now; previously, msan did not intercept strchr, strchrnul, or strrchr,
but does now.

http://reviews.llvm.org/D18329

Patch by Derek Bruening!

llvm-svn: 263992

8 years ago[MemorySSA] Consider def-only BBs for live-in calculations.
George Burgess IV [Mon, 21 Mar 2016 21:25:39 +0000 (21:25 +0000)]
[MemorySSA] Consider def-only BBs for live-in calculations.

If we have a BB with only MemoryDefs, live-in calculations will ignore
it. This means we get results like this:

define void @foo(i8* %p) {
  ; 1 = MemoryDef(liveOnEntry)
  store i8 0, i8* %p
  br i1 undef, label %if.then, label %if.end

if.then:
  ; 2 = MemoryDef(1)
  store i8 1, i8* %p
  br label %if.end

if.end:
  ; 3 = MemoryDef(1)
  store i8 2, i8* %p
  ret void
}

...When there should be a MemoryPhi in the `if.end` BB.

This patch fixes that behavior.

llvm-svn: 263991

8 years agoRemove leftover options from multiline.ll
Krzysztof Parzyszek [Mon, 21 Mar 2016 21:25:01 +0000 (21:25 +0000)]
Remove leftover options from multiline.ll

I added -march=hexagon to force using Hexagon target when testing
locally, and I forgot to take it out.

llvm-svn: 263990

8 years ago[modules] Renumber DECL_UPDATES from 30 to 50, so it no longer collides with
Richard Smith [Mon, 21 Mar 2016 21:16:01 +0000 (21:16 +0000)]
[modules] Renumber DECL_UPDATES from 30 to 50, so it no longer collides with
TYPE_TEMPLATE_SPECIALIZATION. This was fine in practice because both record
kinds are only ever found by offset, but made the llvm-bcanalyzer -dump output
very confusing.

llvm-svn: 263989

8 years agoAdd a testcase that would have found the bug in r263971.
Rafael Espindola [Mon, 21 Mar 2016 21:09:38 +0000 (21:09 +0000)]
Add a testcase that would have found the bug in r263971.

llvm-svn: 263988

8 years agoRevert "[llvm-objdump] Printing relocations in executable and shared object files...
Rafael Espindola [Mon, 21 Mar 2016 20:59:15 +0000 (20:59 +0000)]
Revert "[llvm-objdump] Printing relocations in executable and shared object files.  This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does."

This reverts commit r263971.
It produces the wrong results for .rela.dyn. I will add a test.

llvm-svn: 263987

8 years agoUnxfail test/DebugInfo/Generic/multiline.ll on Hexagon
Krzysztof Parzyszek [Mon, 21 Mar 2016 20:55:59 +0000 (20:55 +0000)]
Unxfail test/DebugInfo/Generic/multiline.ll on Hexagon

llvm-svn: 263986

8 years ago[sanitizier] initializing common flags.
Mike Aizatsky [Mon, 21 Mar 2016 20:53:20 +0000 (20:53 +0000)]
[sanitizier] initializing common flags.

Summary: Without SetDefaults() CommonFlags contain garbage.

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

llvm-svn: 263985

8 years agoRevert "Convert some ObjC msgSends to runtime calls."
Pete Cooper [Mon, 21 Mar 2016 20:50:03 +0000 (20:50 +0000)]
Revert "Convert some ObjC msgSends to runtime calls."

This reverts commit r263607.

This change caused more objc_retain/objc_release calls in the IR but those
are then incorrectly optimized by the ARC optimizer.  Work is going to have
to be done to ensure the ARC optimizer doesn't optimize user written RR, but
that should land before this change.

This change will also need to be updated to take account for any changes required
to ensure that user written calls to RR are distinct from those inserted by ARC.

llvm-svn: 263984

8 years agoAMDGPU: Coding style fixes
Nicolai Haehnle [Mon, 21 Mar 2016 20:39:24 +0000 (20:39 +0000)]
AMDGPU: Coding style fixes

I meant to add these before committing r263982 as per the review,
but I forgot to squash.

llvm-svn: 263983

8 years agoAMDGPU: Add SIWholeQuadMode pass
Nicolai Haehnle [Mon, 21 Mar 2016 20:28:33 +0000 (20:28 +0000)]
AMDGPU: Add SIWholeQuadMode pass

Summary:
Whole quad mode is already enabled for pixel shaders that compute
derivatives, but it must be suspended for instructions that cause a
shader to have side effects (i.e. stores and atomics).

This pass addresses the issue by storing the real (initial) live mask
in a register, masking EXEC before instructions that require exact
execution and (re-)enabling WQM where required.

This pass is run before register coalescing so that we can use
machine SSA for analysis.

The changes in this patch expose a problem with the second machine
scheduling pass: target independent instructions like COPY implicitly
use EXEC when they operate on VGPRs, but this fact is not encoded in
the MIR. This can lead to miscompilation because instructions are
moved past changes to EXEC.

This patch fixes the problem by adding use-implicit operands to
target independent instructions. Some general codegen passes are
relaxed to work with such implicit use operands.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: MatzeB, arsenm, llvm-commits

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

llvm-svn: 263982

8 years ago[Hexagon] Add handling fixups and instruction relaxation
Krzysztof Parzyszek [Mon, 21 Mar 2016 20:27:17 +0000 (20:27 +0000)]
[Hexagon] Add handling fixups and instruction relaxation

llvm-svn: 263981

8 years ago[Hexagon] Properly encode registers in duplex instructions
Krzysztof Parzyszek [Mon, 21 Mar 2016 20:13:33 +0000 (20:13 +0000)]
[Hexagon] Properly encode registers in duplex instructions

llvm-svn: 263980

8 years ago[asan] Disable thread-safe static initilization with VS 2015
Reid Kleckner [Mon, 21 Mar 2016 20:08:59 +0000 (20:08 +0000)]
[asan] Disable thread-safe static initilization with VS 2015

ASan interceptors contain local statics which run before the CRT is
initialized. Thread-safe statics appear to rely on CRT-internal state,
and will crash without this flag.

llvm-svn: 263979

8 years ago[Hexagon] Fix reserving emergency spill slots for register scavenger
Krzysztof Parzyszek [Mon, 21 Mar 2016 19:57:08 +0000 (19:57 +0000)]
[Hexagon] Fix reserving emergency spill slots for register scavenger

- R10 and R11 are not reserved registers.
- Check for reserved registers when finding unused caller-saved registers.

llvm-svn: 263977

8 years ago[WebAssembly] Implement the eqz instructions.
Dan Gohman [Mon, 21 Mar 2016 19:54:41 +0000 (19:54 +0000)]
[WebAssembly] Implement the eqz instructions.

llvm-svn: 263976

8 years ago[SLP] Remove unnecessary member variables by using container APIs.
Chad Rosier [Mon, 21 Mar 2016 19:47:44 +0000 (19:47 +0000)]
[SLP] Remove unnecessary member variables by using container APIs.

This changes the debug output, but still retains its usefulness.
Differential Revision: http://reviews.llvm.org/D18324

llvm-svn: 263975

8 years agoclang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.
Nico Weber [Mon, 21 Mar 2016 19:44:18 +0000 (19:44 +0000)]
clang-cl: With -fmsc-version=1900, use MSVS2015 diag formatting.

llvm-svn: 263974

8 years ago[asan] Pass -fms-compatibility-version=19 with VS 2015
Reid Kleckner [Mon, 21 Mar 2016 19:37:30 +0000 (19:37 +0000)]
[asan] Pass -fms-compatibility-version=19 with VS 2015

This resolves errors about char16_t and char32_t when compiling 2015 STL
headers with clang.

llvm-svn: 263973

8 years agoCompilation can end up calling functions (e.g. to resolve indirect functions) so...
Jim Ingham [Mon, 21 Mar 2016 19:21:13 +0000 (19:21 +0000)]
Compilation can end up calling functions (e.g. to resolve indirect functions) so I added
a way for compilation to take a "thread to use for compilation".  If it isn't set then the
compilation will use the currently selected thread.  This should help keep function execution
to the one thread intended.

llvm-svn: 263972

8 years ago[llvm-objdump] Printing relocations in executable and shared object files. This...
Colin LeMahieu [Mon, 21 Mar 2016 19:14:50 +0000 (19:14 +0000)]
[llvm-objdump] Printing relocations in executable and shared object files.  This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does.

In executable and shared object ELF files, relocations in the file contain the final virtual address rather than section offset so this is adjusted to display section offset.

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

llvm-svn: 263971

8 years ago[modules] Don't invent a module cache path unless implicit module builds are enabled.
Richard Smith [Mon, 21 Mar 2016 19:06:06 +0000 (19:06 +0000)]
[modules] Don't invent a module cache path unless implicit module builds are enabled.

llvm-svn: 263970

8 years agoAMDGPU/SI: Fix threshold calculation for branching when exec is zero
Tom Stellard [Mon, 21 Mar 2016 18:56:58 +0000 (18:56 +0000)]
AMDGPU/SI: Fix threshold calculation for branching when exec is zero

Summary:
When control flow is implemented using the exec mask, the compiler will
insert branch instructions to skip over the masked section when exec is
zero if the section contains more than a certain number of instructions.

The previous code would only count instructions in successor blocks,
and this patch modifies the code to start counting instructions in all
blocks between the start and end of the branch.

Reviewers: nhaehnle, arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 263969

8 years agoFix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.
Eugene Zelenko [Mon, 21 Mar 2016 18:32:35 +0000 (18:32 +0000)]
Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.

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

llvm-svn: 263968

8 years ago[STATS] Add OMP_critical and OMP_critical_wait timers
Jonathan Peyton [Mon, 21 Mar 2016 18:32:26 +0000 (18:32 +0000)]
[STATS] Add OMP_critical and OMP_critical_wait timers

OMP_critical - time spent in critical section
OMP_critical_wait - time spent waiting to enter a critical section

llvm-svn: 263967

8 years ago[asan] Update hotpatch code for VS 2015 memset implementation
Reid Kleckner [Mon, 21 Mar 2016 18:23:07 +0000 (18:23 +0000)]
[asan] Update hotpatch code for VS 2015 memset implementation

In VS 2015, the memset fill parameter is zero extended from one byte
instead of being copied wholesale.

The issue reproduces with existing tests if you use VS2015.

llvm-svn: 263966

8 years ago[AArch64] Add a helpful assert. NFC.
Chad Rosier [Mon, 21 Mar 2016 18:04:10 +0000 (18:04 +0000)]
[AArch64] Add a helpful assert. NFC.

llvm-svn: 263965

8 years agoAMDGPU: Remove SignBitIsZero for mubuf scratch offsets
Matt Arsenault [Mon, 21 Mar 2016 18:02:18 +0000 (18:02 +0000)]
AMDGPU: Remove SignBitIsZero for mubuf scratch offsets

These instructions do not have the same negative base
address problem that DS instructions do on SI.

llvm-svn: 263964

8 years ago[clang-tidy] Fix check broken in rL263822.
Samuel Benzaquen [Mon, 21 Mar 2016 18:00:43 +0000 (18:00 +0000)]
[clang-tidy] Fix check broken in rL263822.

Add names missing from rL263822 and add tests to prevent future omissions.

llvm-svn: 263963

8 years agoARM: Better codegen for 64-bit compares.
Peter Collingbourne [Mon, 21 Mar 2016 18:00:02 +0000 (18:00 +0000)]
ARM: Better codegen for 64-bit compares.

This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.

Before:

push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1:                                 @ %bb1
bl f
pop {r7, pc}
.LBB1_2:                                @ %bb2
bl g
pop {r7, pc}

After:

push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1:                                 @ %bb1
bl f
pop {r7, pc}
.LBB1_2:                                @ %bb2
bl g
pop {r7, pc}

Saves around 80KB in Chromium's libchrome.so.

Some notes on this patch:

- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
  introduced (nothing else needs them). However, they are necessary in
  order to avoid poor codegen, and they seem similar to existing combines
  in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
  (brcond Compare)).

- No support for Thumb-1. This is in principle possible, but we'd need
  to implement ARMISD::SUBE for Thumb-1.

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

llvm-svn: 263962

8 years agoclang-format: [JS] no space in union and intersection types.
Daniel Jasper [Mon, 21 Mar 2016 17:57:31 +0000 (17:57 +0000)]
clang-format: [JS] no space in union and intersection types.

The operators | and & in types, as opposed to the bitwise operators,
should not have whitespace around them (e.g. `Foo<Bar|Baz>`).

Patch by Martin Probst. Thank you.

llvm-svn: 263961