platform/upstream/llvm.git
8 years agoAdd check for unneeded copies of locals
Haojian Wu [Wed, 23 Mar 2016 09:33:07 +0000 (09:33 +0000)]
Add check for unneeded copies of locals

Summary: Extends the UnnecessaryCopyInitialization to detect copies of local variables and parameters that are unneeded.

Patch by Matt Kulukundis!

Reviewers: alexfh, hokein

Subscribers: cfe-commits

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

llvm-svn: 264146

8 years ago[ELF][MIPS] Add comment with MIPS GOT relocations handling description. NFC.
Simon Atanasyan [Wed, 23 Mar 2016 09:28:02 +0000 (09:28 +0000)]
[ELF][MIPS] Add comment with MIPS GOT relocations handling description. NFC.

llvm-svn: 264145

8 years agowww: Drop one more </div>
Tobias Grosser [Wed, 23 Mar 2016 09:27:41 +0000 (09:27 +0000)]
www: Drop one more </div>

llvm-svn: 264144

8 years agowww: Drop polyhedral news reference.
Tobias Grosser [Wed, 23 Mar 2016 09:26:39 +0000 (09:26 +0000)]
www: Drop polyhedral news reference.

The feed2html service used has been unavailable a couple of times and always
causes the polly website to fail to load correctly.

llvm-svn: 264143

8 years agoCodegen:Do not invalidate dominator tree when bailing out during code generation
Tobias Grosser [Wed, 23 Mar 2016 06:57:51 +0000 (06:57 +0000)]
Codegen:Do not invalidate dominator tree when bailing out during code generation

When codegenerating invariant loads in some rare cases we cannot generate code
and bail out. This change ensures that we maintain a valid dominator tree
in these situations. This fixes llvm.org/PR26736

Contributed-by: Matthias Reisinger <d412vv1n@gmail.com>
llvm-svn: 264142

8 years agoFAQ: Remove the entire Build Problems section
Justin Bogner [Wed, 23 Mar 2016 06:54:42 +0000 (06:54 +0000)]
FAQ: Remove the entire Build Problems section

This is all horribly outdated, and is mostly about the autoconf build
system that doesn't even exist anymore. These questions aren't
frequent, and these answers aren't useful.

llvm-svn: 264141

8 years agoAdd option to disallow modref function calls in scops.
Tobias Grosser [Wed, 23 Mar 2016 06:40:15 +0000 (06:40 +0000)]
Add option to disallow modref function calls in scops.

This might be useful to evaluate the benefit of us handling modref funciton
calls. Also, a new bug that was triggered by modref function calls was
recently reported http://llvm.org/PR27035. To ensure the same issue does not
cause troubles for other people, we temporarily disable this until the bug
is resolved.

llvm-svn: 264140

8 years agoFAQ: We require GCC 4.7 - nobody's asking about build failures with 3.3.2
Justin Bogner [Wed, 23 Mar 2016 06:38:53 +0000 (06:38 +0000)]
FAQ: We require GCC 4.7 - nobody's asking about build failures with 3.3.2

llvm-svn: 264139

8 years ago[docs] Fix typo in ProgrammersManual.rst
Vedant Kumar [Wed, 23 Mar 2016 05:18:50 +0000 (05:18 +0000)]
[docs] Fix typo in ProgrammersManual.rst

Patch by Miod Vallat!

llvm-svn: 264138

8 years ago[AMDGPU] Fix missing assembler predicates.
Valery Pykhtin [Wed, 23 Mar 2016 04:27:26 +0000 (04:27 +0000)]
[AMDGPU] Fix missing assembler predicates.

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

llvm-svn: 264137

8 years ago[Tests] Remove the correct files.
Davide Italiano [Wed, 23 Mar 2016 03:20:46 +0000 (03:20 +0000)]
[Tests] Remove the correct files.

llvm-svn: 264136

8 years ago[Docs] Clarify boolean conversion for Error and Expected<T> in the Programmer's
Lang Hames [Wed, 23 Mar 2016 03:18:16 +0000 (03:18 +0000)]
[Docs] Clarify boolean conversion for Error and Expected<T> in the Programmer's
Manual.

llvm-svn: 264135

8 years ago[LTO] Remove dead code.
Davide Italiano [Wed, 23 Mar 2016 02:45:53 +0000 (02:45 +0000)]
[LTO] Remove dead code.

llvm-svn: 264133

8 years ago[Sema] Allow implicit conversions of &overloaded_fn in C.
George Burgess IV [Wed, 23 Mar 2016 02:33:58 +0000 (02:33 +0000)]
[Sema] Allow implicit conversions of &overloaded_fn in C.

Also includes a minor ``enable_if`` docs update.

Currently, our address-of overload machinery will only allow implicit
conversions of overloaded functions to void* in C. For example:

```
void f(int) __attribute__((overloadable));
void f(double) __attribute__((overloadable, enable_if(0, "")));

void *fp = f; // OK. This is C and the target is void*.
void (*fp2)(void) = f; // Error. This is C, but the target isn't void*.
```

This patch makes the assignment of `fp2` select the `f(int)` overload,
rather than emitting an error (N.B. you'll still get a warning about the
`fp2` assignment if you use -Wincompatible-pointer-types).

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

llvm-svn: 264132

8 years agoRemove stale comment
Sanjoy Das [Wed, 23 Mar 2016 02:28:35 +0000 (02:28 +0000)]
Remove stale comment

llvm-svn: 264131

8 years ago[StatepointLowering] Don't do two DenseMap lookups; nfci
Sanjoy Das [Wed, 23 Mar 2016 02:24:15 +0000 (02:24 +0000)]
[StatepointLowering] Don't do two DenseMap lookups; nfci

llvm-svn: 264130

8 years ago[StatepointLowering] Minor NFC cleanups
Sanjoy Das [Wed, 23 Mar 2016 02:24:13 +0000 (02:24 +0000)]
[StatepointLowering] Minor NFC cleanups

 - Use auto
 - Name variables in LLVM style
 - Use llvm::find instead of std::find
 - Blank lines between declarations

llvm-svn: 264129

8 years ago[StatepointLowering] Minor nfc refactoring
Sanjoy Das [Wed, 23 Mar 2016 02:24:10 +0000 (02:24 +0000)]
[StatepointLowering] Minor nfc refactoring

Now that StatepointLoweringInfo represents base pointers, derived
pointers and gc relocates as SmallVectors and not ArrayRefs, we no
longer need to allocate "backing storage" on stack in LowerStatepoint.
So elide the backing storage, and inline the trivial body of
getIncomingStatepointGCValues.

llvm-svn: 264128

8 years ago[StatepointLowering] Schedule gc relocates before uniqueing them
Sanjoy Das [Wed, 23 Mar 2016 02:24:07 +0000 (02:24 +0000)]
[StatepointLowering] Schedule gc relocates before uniqueing them

Otherwise we can see an "unexpected" gc.relocate that we uniqued away.

llvm-svn: 264127

8 years agoAMDGPU: Cache information about register pressure sets
Tom Stellard [Wed, 23 Mar 2016 01:53:22 +0000 (01:53 +0000)]
AMDGPU: Cache information about register pressure sets

We can statically decide whether or not a register pressure set is for
SGPRs or VGPRs, so we don't need to re-compute this information in
SIRegisterInfo::getRegPressureSetLimit().

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

llvm-svn: 264126

8 years ago[Apple Clang] Expose llvm-config from stage2 builds in stage1
Chris Bieneman [Wed, 23 Mar 2016 01:47:05 +0000 (01:47 +0000)]
[Apple Clang] Expose llvm-config from stage2 builds in stage1

This exposes the stage2-llvm-config target though the stage1 build configuration.

llvm-svn: 264125

8 years agoMinor code cleanup. NFC.
Junmo Park [Wed, 23 Mar 2016 01:38:35 +0000 (01:38 +0000)]
Minor code cleanup. NFC.

llvm-svn: 264124

8 years agoChange 'apropos' such that it doesn't look into the "long help/syntax" strings for...
Enrico Granata [Wed, 23 Mar 2016 01:21:55 +0000 (01:21 +0000)]
Change 'apropos' such that it doesn't look into the "long help/syntax" strings for commands

This solves issues such as 'apropos foo' returning valid matches just because syntax examples happen to use 'foo' as a placeholder token

Fixes rdar://9043025

llvm-svn: 264123

8 years ago[ModuleUtils] Use range-based loop. NFC.
Davide Italiano [Wed, 23 Mar 2016 00:43:35 +0000 (00:43 +0000)]
[ModuleUtils] Use range-based loop. NFC.

llvm-svn: 264122

8 years ago[docs] Use reST link.
Sean Silva [Wed, 23 Mar 2016 00:31:21 +0000 (00:31 +0000)]
[docs] Use reST link.

llvm-svn: 264121

8 years agoBring back Makefile.sphinx
Sean Silva [Wed, 23 Mar 2016 00:30:57 +0000 (00:30 +0000)]
Bring back Makefile.sphinx

It is not part of autoconf and should not have been removed in r258861.

llvm-svn: 264120

8 years ago[docs] Clarify the sense of --compile-command
Sean Silva [Wed, 23 Mar 2016 00:25:13 +0000 (00:25 +0000)]
[docs] Clarify the sense of --compile-command

In retrospect, it seems "obvious" that the sense of the return code is
the same as if it crashed on "interesting" inputs. But that didn't stop
me from spending more time than I care to admit verifying this.

llvm-svn: 264119

8 years ago[ScopInfo] Fix domains after loops.
Michael Kruse [Tue, 22 Mar 2016 23:27:42 +0000 (23:27 +0000)]
[ScopInfo] Fix domains after loops.

ISL can conclude additional conditions on parameters from restrictions
on loop variables. Such conditions persist when leaving the loop and the
loop variable is projected out. This results in a narrower domain for
exiting the loop than entering it and is logically impossible for
non-infinite loops.

We fix this by not adding a lower bound i>=0 when constructing BB
domains, but defer it to when also the upper bound it computed, which
was done redundantly even before this patch.

This reduces the number of LNT fails with -polly-process-unprofitable
-polly-position=before-vectorizer from 8 to 6.

llvm-svn: 264118

8 years agoTidy up this test a bit.
Sean Silva [Tue, 22 Mar 2016 23:19:40 +0000 (23:19 +0000)]
Tidy up this test a bit.

llvm-svn: 264117

8 years agoMove empty atom check to target independent code. NFC.
Pete Cooper [Tue, 22 Mar 2016 23:07:34 +0000 (23:07 +0000)]
Move empty atom check to target independent code.  NFC.

Turns out that checking only x86 for empty atoms to fix UBSan then
requires the same code in the other targets too.  Better to just
check this in the main run loop instead of in each target.

Should be NFC, other than fixing UBSan failures.

llvm-svn: 264116

8 years agoAvoid memcpy from nullptr. NFC.
Pete Cooper [Tue, 22 Mar 2016 22:59:35 +0000 (22:59 +0000)]
Avoid memcpy from nullptr.  NFC.

This was caught by the UBSan bot.  When the atom has no size, we would
issue a memcpy with size0 and a nullptr for the source.

Also, this code should never have references inside an empty atom so
add an assert for that while we're here.

llvm-svn: 264115

8 years agoDon't memcpy from a null source. Found by UBSan
Pete Cooper [Tue, 22 Mar 2016 22:51:03 +0000 (22:51 +0000)]
Don't memcpy from a null source.  Found by UBSan

llvm-svn: 264114

8 years agoReverted a change in r264074 that made lldb-mi use lldb_private APIs.
Sean Callanan [Tue, 22 Mar 2016 22:42:42 +0000 (22:42 +0000)]
Reverted a change in r264074 that made lldb-mi use lldb_private APIs.

FileSystem::Fopen is a lldb_private API, but lldb-mi uses only the
public API.  Depending on lldb_private APIs makes Xcode builds fail.
I reverted the portion of r264074 that added such a dependency.

llvm-svn: 264113

8 years agoTest commit to verify repository access and fix a typo.
Derek Bruening [Tue, 22 Mar 2016 22:32:03 +0000 (22:32 +0000)]
Test commit to verify repository access and fix a typo.

llvm-svn: 264112

8 years ago[LTO] Keep linkonce_odr symbols when appropriate.
Davide Italiano [Tue, 22 Mar 2016 22:31:34 +0000 (22:31 +0000)]
[LTO] Keep linkonce_odr symbols when appropriate.

Ensure we keep the symbol we need to before it reaches
the Writer (and hit an assertion), changing its linkage
from linkonce_odr to weak. For a more detailed description
of the problem, see PR19901 where a similar problem was
fixed for the gold plugin. Thanks to Rafael for providing
a testcase.

llvm-svn: 264111

8 years agoTypo
Joerg Sonnenberger [Tue, 22 Mar 2016 22:24:52 +0000 (22:24 +0000)]
Typo

llvm-svn: 264110

8 years agoMC: Don't access the filesystem in MCContext's constructor
Justin Bogner [Tue, 22 Mar 2016 22:24:29 +0000 (22:24 +0000)]
MC: Don't access the filesystem in MCContext's constructor

MCContext shouldn't be accessing the filesystem - that's a gross
layering violation and makes it awkward to use as a library or in a
daemon where it may not even be allowed filesystem access.

The CWD lookup here is normally redundant anyway, since the calling
context either also looks up the CWD or sets this to something more
specific. Here, we fix up the one caller that doesn't already set up a
debug compilation dir and make it clear that the responsibility for
such set up is in the users of MCContext.

llvm-svn: 264109

8 years agoMake it so that a command alias can actually remove the help/long help from its paren...
Enrico Granata [Tue, 22 Mar 2016 22:12:59 +0000 (22:12 +0000)]
Make it so that a command alias can actually remove the help/long help from its parent command by setting itself to an empty help string

llvm-svn: 264108

8 years ago[NVVM] Remove noduplicate attribute from synchronizing intrinsics.
Justin Lebar [Tue, 22 Mar 2016 22:08:01 +0000 (22:08 +0000)]
[NVVM] Remove noduplicate attribute from synchronizing intrinsics.

Summary:
I've completed my audit of all the code that looks at noduplicate and
added handling of convergent where appropriate, so we no longer need
noduplicate on these intrinsics.

Reviewers: jholewinski

Subscribers: llvm-commits, jholewinski

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

llvm-svn: 264107

8 years ago[CUDA] Don't allow templated variadic functions.
Justin Lebar [Tue, 22 Mar 2016 22:06:19 +0000 (22:06 +0000)]
[CUDA] Don't allow templated variadic functions.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 264106

8 years agoInvalidate scop on encountering a complex control flow
Tobias Grosser [Tue, 22 Mar 2016 22:05:32 +0000 (22:05 +0000)]
Invalidate scop on encountering a complex control flow

We bail out if current scop has a complex control flow as this could lead to
building of large domain conditions. This is to reduce compile time.  This
addresses r26382.

Contributed-by: Chris Jenneisch <chrisj@codeaurora.org>
Differential Revision: http://reviews.llvm.org/D18362

llvm-svn: 264105

8 years ago[lldb-mi] Uncomment a line in CMakeLists.txt to make linux build happy.
Siva Chandra [Tue, 22 Mar 2016 21:37:56 +0000 (21:37 +0000)]
[lldb-mi] Uncomment a line in CMakeLists.txt to make linux build happy.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 264104

8 years agoDrop comdats from the dst module if they are not selected.
Rafael Espindola [Tue, 22 Mar 2016 21:35:47 +0000 (21:35 +0000)]
Drop comdats from the dst module if they are not selected.

A really unfortunate design of llvm-link and related libraries is that
they operate one module at a time.

This means they can copy a GV to the destination module that should not
be there in the final result because a later bitcode file takes
precedence.

We already handled cases like a strong GV replacing a weak for example.

One case that is not currently handled is a comdat replacing another.
This doesn't happen in ELF, but with COFF largest selection kind it is
possible.

In "llvm-link a.ll b.ll" if the selected comdat was from a.ll,
everything will work and we will not copy the comdat from b.ll.

But if we run "llvm-link b.ll a.ll", we fail to delete the already
copied comdat from b.ll. This patch fixes that.

llvm-svn: 264103

8 years agoKeep CodeGenPrepare from preserving the domtree.
George Burgess IV [Tue, 22 Mar 2016 21:25:08 +0000 (21:25 +0000)]
Keep CodeGenPrepare from preserving the domtree.

CGP modifies the domtree in some cases, so saying that it preserves the
domtree is a lie. We'll be able to selectively preserve it with the new
pass manager.

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

llvm-svn: 264099

8 years agoUpdate cxx-features test to C++1z
JF Bastien [Tue, 22 Mar 2016 21:12:48 +0000 (21:12 +0000)]
Update cxx-features test to C++1z

Forked from the following patch:
  http://reviews.llvm.org/D17950

llvm-svn: 264098

8 years agoFix operator= on OwningAtomPtr to call destructor when needed.
Pete Cooper [Tue, 22 Mar 2016 21:08:39 +0000 (21:08 +0000)]
Fix operator= on OwningAtomPtr to call destructor when needed.

If the LHS of 'a = b' already had an atom in it then we wouldn't
call the destructor.  This happens when we use something like
std::remove_if which is done in the CompactUnwindPass.  Should fix
the leaks on the mach-o/unwind-info-simple-x86_64.yaml test case.

Lang and I are going to take a look at removing OwningAtomPtr in
favour of a std::unique_ptr but just trying to get the bots green
so we have a good baseline first.

llvm-svn: 264097

8 years agoFix a bug caused by my alias refactoring where, if an alias was defined in terms...
Enrico Granata [Tue, 22 Mar 2016 21:07:54 +0000 (21:07 +0000)]
Fix a bug caused by my alias refactoring where, if an alias was defined in terms of another alias, trying to run the nested command would actually cause a crash in the command interpreter

llvm-svn: 264096

8 years agoBackend support for top-level Clang epxressions
Sean Callanan [Tue, 22 Mar 2016 21:05:51 +0000 (21:05 +0000)]
Backend support for top-level Clang epxressions

This patch adds a new ExecutionPolicy, eExecutionPolicyTopLevel, which
tells the expression parser that the expression should be JITted as top
level code but nothing (except static initializers) should be run.  I
have modified the Clang expression parser to recognize this execution
policy.  On top of the existing patches that support storing IR and
maintaining a map of arbitrary Decls, this is mainly just patching up a
few places in the expression parser.

I intend to submit a patch for review that exposes this functionality
through the "expression" command and through the SB API.  That patch
also includes a testcase for all of this.

<rdar://problem/22864976>

llvm-svn: 264095

8 years agoMark SymbolBody::getSymbol as `const`.
Sean Silva [Tue, 22 Mar 2016 21:04:03 +0000 (21:04 +0000)]
Mark SymbolBody::getSymbol as `const`.

llvm-svn: 264094

8 years agoWe do not use libLTO, so fix the error.
Rui Ueyama [Tue, 22 Mar 2016 20:58:15 +0000 (20:58 +0000)]
We do not use libLTO, so fix the error.

llvm-svn: 264093

8 years agoD18325: Added mm_malloc module export.
John Thompson [Tue, 22 Mar 2016 20:57:51 +0000 (20:57 +0000)]
D18325: Added mm_malloc module export.

llvm-svn: 264092

8 years agoELF: Create LTO.{cpp,h} and move LTO-related code to that file.
Rui Ueyama [Tue, 22 Mar 2016 20:52:10 +0000 (20:52 +0000)]
ELF: Create LTO.{cpp,h} and move LTO-related code to that file.

The code for LTO has been growing, so now is probably a good time to
move it to its own file. SymbolTable.cpp is for symbol table, and
because compiling bitcode files are semantically not a part of
symbol table, this is I think a good thing to do.

http://reviews.llvm.org/D18370

llvm-svn: 264091

8 years ago[lto] Provide a file name for the combined LTO object.
Sean Silva [Tue, 22 Mar 2016 20:25:32 +0000 (20:25 +0000)]
[lto] Provide a file name for the combined LTO object.

Otherwise, we get diagnostics like:

    undefined symbol: foo in

Which isn't particularly useful.

llvm-svn: 264089

8 years agoRevert "Support arbitrary addrspace pointers in masked load/store intrinsics"
Matthias Braun [Tue, 22 Mar 2016 20:24:34 +0000 (20:24 +0000)]
Revert "Support arbitrary addrspace pointers in masked load/store intrinsics"

This commit broke LTO builds. Reverting it to unbreak the bots while the
issue is investigated. See also:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160321/341002.html

This reverts r263158

llvm-svn: 264088

8 years agoChanges to the Xcode project file to make LLDB build again after llvm/Support/Convert...
Enrico Granata [Tue, 22 Mar 2016 20:16:51 +0000 (20:16 +0000)]
Changes to the Xcode project file to make LLDB build again after llvm/Support/ConvertUTF.h was brought into the driver

llvm-svn: 264087

8 years ago[X86][AVX] Added AVX1 tests for 256-bit vector idiv-by-constant
Simon Pilgrim [Tue, 22 Mar 2016 20:10:49 +0000 (20:10 +0000)]
[X86][AVX] Added AVX1 tests for 256-bit vector idiv-by-constant

Prep work based on feedback for D18307

llvm-svn: 264086

8 years ago[SelectionDAG] Ensure constant folded legalized vector element types are compatible...
Simon Pilgrim [Tue, 22 Mar 2016 19:59:53 +0000 (19:59 +0000)]
[SelectionDAG] Ensure constant folded legalized vector element types are compatible with the BUILD_VECTOR type

Found during fuzz testing - 32-bit x86 targets were legalizing a <2 x i1> compare result to <2 x i32> when <2 x i64> was expected.

llvm-svn: 264085

8 years agoCodeGen: check return types match when emitting tail call to builtin.
Tim Northover [Tue, 22 Mar 2016 19:14:38 +0000 (19:14 +0000)]
CodeGen: check return types match when emitting tail call to builtin.

We were just completely ignoring the types when determining whether we could
safely emit a libcall as a tail call. This is clearly wrong.

Theoretically, we could dig deeper looking for incidental matches (much like
the generic code in Analysis.cpp does), but it's probably not worth it for the
few libcalls that exist.

llvm-svn: 264084

8 years agoRemove unnecessary branch from test
Sanjoy Das [Tue, 22 Mar 2016 18:45:41 +0000 (18:45 +0000)]
Remove unnecessary branch from test

(Addresses post commit review by Reid Kleckner)

llvm-svn: 264083

8 years ago[LoopVersioning] Relax an assert for LCSSA PHIs
Adam Nemet [Tue, 22 Mar 2016 18:38:15 +0000 (18:38 +0000)]
[LoopVersioning] Relax an assert for LCSSA PHIs

When you have multiple LCSSA (single-operand) PHIs that are converted
into two-operand PHIs due to versioning, only assert that the PHI
currently being converted has a single operand.  I.e. we don't want to
check PHIs that were converted earlier in the loop.

Fixes PR27023.

Thanks to Karl-Johan Karlsson for the minimized testcase!

llvm-svn: 264081

8 years ago[clang-tidy] Fix broken test with redundant string init (msvc).
Etienne Bergeron [Tue, 22 Mar 2016 18:21:17 +0000 (18:21 +0000)]
[clang-tidy] Fix broken test with redundant string init (msvc).

Summary:
There is a silly bug that got introduced after fixing incorrect paths with this patch:
http://reviews.llvm.org/D18293

The tests was present twice in the file.

Reviewers: alexfh, rnk

Subscribers: cfe-commits

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

llvm-svn: 264080

8 years ago[tsan] Fix check-tsan build by using CHECK_NE.
Yabin Cui [Tue, 22 Mar 2016 18:12:18 +0000 (18:12 +0000)]
[tsan] Fix check-tsan build by using CHECK_NE.

Reviewers: llvm-commits, srhines, dvyukov

Subscribers: srhines

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

llvm-svn: 264079

8 years agoAllow lowering call sites with both funclets and deopt state
Sanjoy Das [Tue, 22 Mar 2016 18:10:39 +0000 (18:10 +0000)]
Allow lowering call sites with both funclets and deopt state

Lowering funclets is a no-op, so we can just go ahead and lower the
deopt state.

llvm-svn: 264078

8 years agoMore MSVC bot appeasement. Explicitly define rvalue methods on SortKey.
Pete Cooper [Tue, 22 Mar 2016 18:09:55 +0000 (18:09 +0000)]
More MSVC bot appeasement.  Explicitly define rvalue methods on SortKey.

OwningAtomPtr does not have OwningAtomPtr(OwningAtomPtr&) or the equivalent
operator= as we only want to use rvalue references in it.

SortKey didn't like this on MSVC as it was synthesizing SortKey(SortKey&) and
trying to use the OwningAtomPtr(OwningAtomPtr&) method which was private an
unimplemented.

Now we explicitly have the methods on SortKey so hopefully the bot will be
happier.

llvm-svn: 264077

8 years ago[WebAssembly] Implement the rotate instructions.
Dan Gohman [Tue, 22 Mar 2016 18:01:49 +0000 (18:01 +0000)]
[WebAssembly] Implement the rotate instructions.

llvm-svn: 264076

8 years ago[clang-tidy] Fix redundant-string-cstr check with msvc 14 headers.
Etienne Bergeron [Tue, 22 Mar 2016 18:00:13 +0000 (18:00 +0000)]
[clang-tidy] Fix redundant-string-cstr check with msvc 14 headers.

Summary:
The string constructors are not defined using optional parameters and are not recognize by the checker.

The constructor defined in the MSVC header is defined with 1 parameter. Therefore, patterns are not recognized by the checker.
The current patch add support to accept constructor with only one parameter.

Repro on a Visual Studio 14 installation with the following code:
```
void f1(const std::string &s) {
  f1(s.c_str());
}
```

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

The CXXConstructExpr to recognize only contains 1 parameter.
```
CXXConstructExpr 0x3f1a070 <C:\src\llvm\examples\test.cc:6:6, col:14> 'const std::string':'const class std::basic_string<char, struct std::char_traits<char>, class
 std::allocator<char> >' 'void (const char *) __attribute__((thiscall))'
`-CXXMemberCallExpr 0x3f1a008 <col:6, col:14> 'const char *'
  `-MemberExpr 0x3f19fe0 <col:6, col:8> '<bound member function type>' .c_str 0x3cc22f8
    `-DeclRefExpr 0x3f19fc8 <col:6> 'const std::string':'const class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char> >' lvalue ParmVar 0x3f19c80 's' 'const std::string &'
```

Reviewers: aaron.ballman, alexfh

Subscribers: aemerson

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

llvm-svn: 264075

8 years agoUnicode support on Win32.
Zachary Turner [Tue, 22 Mar 2016 17:58:09 +0000 (17:58 +0000)]
Unicode support on Win32.

Win32 API calls that are Unicode aware require wide character
strings, but LLDB uses UTF8 everywhere.  This patch does conversions
wherever necessary when passing strings into and out of Win32 API
calls.

Patch by Cameron
Differential Revision: http://reviews.llvm.org/D17107
Reviewed By: zturner, amccarth

llvm-svn: 264074

8 years ago[clang-tidy] Skip reporting of not applicable fixes.
Etienne Bergeron [Tue, 22 Mar 2016 17:51:27 +0000 (17:51 +0000)]
[clang-tidy] Skip reporting of not applicable fixes.

Summary:
Invalid source location are causing clang-tidy to crash when manipulating an invalid file.

Macro definitions on the command line have locations in a virtual buffer and therefore
don't have a corresponding valid FilePath.

A recent patch added path conversion to absolute path. As the FilePath may now be empty,
the result of makeAbsolutePath may incorrectly be the folder WorkingDir.  The crash occurs
in getLocation which is not able to find the appropriate FileEntry (null pointer).

```
          SmallString<128> FixAbsoluteFilePath = Fix.getFilePath();
          Files.makeAbsolutePath(FixAbsoluteFilePath);
          FixLoc = getLocation(FixAbsoluteFilePath, Fix.getOffset());
```

With relative path, the code was not crashing because getLocation was skipping empty path.

Example of code:

```
int main() { return X; }
```

With the given command-line:

```
clang-tidy test.cc --checks=misc-macro-*  --  -DX=0+0
```

Reviewers: alexfh, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 264073

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