platform/upstream/llvm.git
8 years ago[CodeGenPrepare] Fix r265264 (again).
Peter Zotov [Sun, 3 Apr 2016 19:32:13 +0000 (19:32 +0000)]
[CodeGenPrepare] Fix r265264 (again).

Don't require TLI for SinkCmpExpression, like it wasn't before
r265264.

llvm-svn: 265271

8 years agoValueMapper: Split out mapSimpleMetadata, NFC
Duncan P. N. Exon Smith [Sun, 3 Apr 2016 19:31:01 +0000 (19:31 +0000)]
ValueMapper: Split out mapSimpleMetadata, NFC

Split out a helper for mapping metadata without operands.  This is any
metadata that is not an MDNode, and any MDNode where the answer is known
without looking at operands.

Through some weird twists, this function is co-recursive:

    mapSimpleMetadata
    => MapValue
    => materializeInitFor
    => linkFunctionBody
    => RemapInstructions
    => MapMetadata
    => mapSimpleMetadata

I plan to break the recursion in a follow-up.

llvm-svn: 265270

8 years ago[sanitizer] Make AtosSymbolizer more resilient when symbolicating a zero address
Kuba Brecka [Sun, 3 Apr 2016 19:13:03 +0000 (19:13 +0000)]
[sanitizer] Make AtosSymbolizer more resilient when symbolicating a zero address

llvm-svn: 265269

8 years agoValueMapper: Introduce Mapper helper class, NFC
Duncan P. N. Exon Smith [Sun, 3 Apr 2016 19:06:24 +0000 (19:06 +0000)]
ValueMapper: Introduce Mapper helper class, NFC

Remove a bunch of boilerplate from ValueMapper.cpp by using a new
file-local class called Mapper.

llvm-svn: 265268

8 years ago[X86][SSE] Refreshed MOVMSK sign bit tests
Simon Pilgrim [Sun, 3 Apr 2016 18:59:42 +0000 (18:59 +0000)]
[X86][SSE] Refreshed MOVMSK sign bit tests

llvm-svn: 265267

8 years ago[X86][SSE] Support for MOVMSK signbit extraction instructions
Simon Pilgrim [Sun, 3 Apr 2016 18:22:03 +0000 (18:22 +0000)]
[X86][SSE] Support for MOVMSK signbit extraction instructions

Add support for lowering with the MOVMSK instruction to extract vector element signbits to a GPR.

This is an early step towards more optimal handling of vector comparison results.

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

llvm-svn: 265266

8 years ago[CodeGenPrepare] Fix r265264.
Peter Zotov [Sun, 3 Apr 2016 17:11:53 +0000 (17:11 +0000)]
[CodeGenPrepare] Fix r265264.

The case where there was no TargetLowering was not handled,
leading to null pointer dereferences.

llvm-svn: 265265

8 years ago[CodeGenPrepare] Avoid sinking soft-FP comparisons
Peter Zotov [Sun, 3 Apr 2016 16:36:17 +0000 (16:36 +0000)]
[CodeGenPrepare] Avoid sinking soft-FP comparisons

Sinking comparisons in CGP can undo the job of hoisting them done
earlier by LICM, and soft-FP makes this an expensive mistake.

A common pattern that produces floating point comparisons uniform
over a loop is an explicit check for division by zero. If the divisor
is hoisted out of the loop, the comparison can also be, but hoisting
the function that unwinds is never legal, since it may cause side
effects in the loop body prior to the unwinding to not be executed.

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

llvm-svn: 265264

8 years ago[X86] Tidied up X86ISD instruction nodes. NFCI.
Simon Pilgrim [Sun, 3 Apr 2016 14:14:32 +0000 (14:14 +0000)]
[X86] Tidied up X86ISD instruction nodes. NFCI.

Tidied up comments, stripped trailing whitespace, split apart nodes that aren't related.

No change in ordering although there is definitely some scope for it.

llvm-svn: 265263

8 years agoMark some FP intrinsics as safe to speculatively execute
Peter Zotov [Sun, 3 Apr 2016 12:30:46 +0000 (12:30 +0000)]
Mark some FP intrinsics as safe to speculatively execute

Floating point intrinsics in LLVM are generally not speculatively
executed, since most of them are defined to behave the same as libm
functions, which set errno.

However, the only error that can happen  when executing ceil, floor,
nearbyint, rint and round libm functions per POSIX.1-2001 is -ERANGE,
and that requires the maximum value of the exponent to be smaller
than  the number of mantissa bits, which is not the case with any of
the floating point types supported by LLVM.

The trunc and copysign functions never set errno per per POSIX.1-2001.

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

llvm-svn: 265262

8 years ago[FIX] Do not create two SAI objects for exit PHIs
Johannes Doerfert [Sun, 3 Apr 2016 11:16:00 +0000 (11:16 +0000)]
[FIX] Do not create two SAI objects for exit PHIs

  If an exit PHI is written and also read in the SCoP we should not create two
  SAI objects but only one. As the read is only modeled to ensure OpenMP code
  generation knows about it we can simply use the EXIT_PHI MemoryKind for both
  accesses.

llvm-svn: 265261

8 years ago[FIX] Do not create a SCoP in the presence of infinite loops
Johannes Doerfert [Sun, 3 Apr 2016 11:12:39 +0000 (11:12 +0000)]
[FIX] Do not create a SCoP in the presence of infinite loops

  If a loop has no exiting blocks the region covering we use during
  schedule genertion might not cover that loop properly. For now we bail
  out as we would not optimize these loops anyway.

llvm-svn: 265260

8 years agoAVX-512: Load and Extended Load for i1 vectors
Elena Demikhovsky [Sun, 3 Apr 2016 08:41:12 +0000 (08:41 +0000)]
AVX-512: Load and Extended Load for i1 vectors

Implemented load+{sign|zero}_extend for i1 vectors
Fixed failures in i1 vector load.
Covered loading of v2i1, v4i1, v8i1, v16i1, v32i1, v64i1 vectors for KNL and SKX.

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

llvm-svn: 265259

8 years ago[LTO] Implement -disable-verify, which disables bitcode verification.
Davide Italiano [Sun, 3 Apr 2016 03:39:09 +0000 (03:39 +0000)]
[LTO] Implement -disable-verify, which disables bitcode verification.

So, there are some cases when the IR Linker produces a broken
module (which doesn't pass the verifier) and we end up asserting
inside the verifier. I think it's always a bug producing a module
which does not pass the verifier but there are some cases in which
people can live with the broken module (e.g. if only DebugInfo
metadata are broken). The gold plugin has something similar.

This commit is motivated by a situation I found in the
wild. It seems that somebody else discovered it independently
and reported in PR24923.

llvm-svn: 265258

8 years agoFix test case committed in r265197.
Akira Hatanaka [Sun, 3 Apr 2016 03:36:22 +0000 (03:36 +0000)]
Fix test case committed in r265197.

The test was failing on some release build because the basic block names
I was expecting weren't printed.

llvm-svn: 265257

8 years ago[LTO] Add a test to ensure we reject negative opt level.
Davide Italiano [Sun, 3 Apr 2016 03:12:00 +0000 (03:12 +0000)]
[LTO] Add a test to ensure we reject negative opt level.

We already got this right, but it never hurts adding another
test, in case we'll change the handling in the future, to ensure
we don't break it.

llvm-svn: 265256

8 years ago[LTO] Reject invalid optimization levels.
Davide Italiano [Sun, 3 Apr 2016 02:41:15 +0000 (02:41 +0000)]
[LTO] Reject invalid optimization levels.

llvm-svn: 265255

8 years ago[LTO] Fix -save-temps in case -o is not specified.
Davide Italiano [Sun, 3 Apr 2016 02:16:56 +0000 (02:16 +0000)]
[LTO] Fix -save-temps in case -o is not specified.

Currently we create a file called .lto.bc. In UNIX,
ls(1) by default doesn't show up files starting with
a dot, as they're (only by convention) hidden.
This makes the output of -save-temps a little bit
hard to find. Use "a.out.lto.bc" instead if the
output file is not specified.

While here, change an existing -save-temps test to
exercise this more interesting behaviour.

llvm-svn: 265254

8 years ago[SimplifyLibCalls] Garbage collect dead code.
Davide Italiano [Sun, 3 Apr 2016 01:46:52 +0000 (01:46 +0000)]
[SimplifyLibCalls] Garbage collect dead code.

We already skip optimizations if the return value
of printf() is used, so CI->use_empty() is always
true.

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

llvm-svn: 265253

8 years ago[c-index-test] Fix leak in print_completion_result, NFC
Vedant Kumar [Sun, 3 Apr 2016 00:54:46 +0000 (00:54 +0000)]
[c-index-test] Fix leak in print_completion_result, NFC

llvm-svn: 265252

8 years ago[lanai] Fix for LanaiDelaySlotFiller and LanaiMCInstLower.cpp
Jacques Pienaar [Sun, 3 Apr 2016 00:49:27 +0000 (00:49 +0000)]
[lanai] Fix for LanaiDelaySlotFiller and LanaiMCInstLower.cpp

Summary:
* Fix to stop delay slot filler from inserting SP modifying instructions in the newly expanded call/return instructions.
* In LowerSymbol the outermost type was not LanaiMCExpr if there was a binary expression
* Remove printExpr in LanaiInstPrinter

Subscribers: joker.eph, llvm-commits

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

llvm-svn: 265251

8 years ago[ELF] Prefer 'auto' over explicit type for consistency.
Davide Italiano [Sat, 2 Apr 2016 23:47:54 +0000 (23:47 +0000)]
[ELF] Prefer 'auto' over explicit type for consistency.

llvm-svn: 265250

8 years ago[mips][microMIPS] Revert commits r264245 and r264248.
Zoran Jovanovic [Sat, 2 Apr 2016 23:06:13 +0000 (23:06 +0000)]
[mips][microMIPS] Revert commits r264245 and r264248.
Commit r264245 was the reason for failing tests in LLVM test suite.
Commit r264248 depends on the first one.

llvm-svn: 265249

8 years ago[X86][SSE] Added 1024-bit vector comparison tests
Simon Pilgrim [Sat, 2 Apr 2016 21:33:09 +0000 (21:33 +0000)]
[X86][SSE] Added 1024-bit vector comparison tests

More examples of PR22603, poor vector splitting for AVX512F targets as well as missing uses of PACKSS/MOVMSK

llvm-svn: 265248

8 years ago[X86][AVX512] Added AVX512 comparison tests
Simon Pilgrim [Sat, 2 Apr 2016 21:24:42 +0000 (21:24 +0000)]
[X86][AVX512] Added AVX512 comparison tests

llvm-svn: 265247

8 years agoProvide support for Binutils' --no-dynamic-linker option.
Ed Schouten [Sat, 2 Apr 2016 20:58:02 +0000 (20:58 +0000)]
Provide support for Binutils' --no-dynamic-linker option.

GNU ld seems to write a PT_INTERP header into executables containing a
default (read: bogus) value if --dynamic-linker flag is not provided.
LLD is different in the sense that it omits it unless --dynamic-linker
is provided, which seems fair.

Binutils 2.26 added a new flag, --no-dynamic-linker, that can be used to
generate binaries without PT_INTERP. Let's go ahead and also add this
flag to LLD, so that we can invoke the linker in a portable way.

Reviewed by: ruiu
Differential Revision: http://reviews.llvm.org/D18723

llvm-svn: 265246

8 years agoSimplify. NFC.
Rui Ueyama [Sat, 2 Apr 2016 19:36:36 +0000 (19:36 +0000)]
Simplify. NFC.

llvm-svn: 265242

8 years agoMerge two `if`s.
Rui Ueyama [Sat, 2 Apr 2016 19:31:01 +0000 (19:31 +0000)]
Merge two `if`s.

llvm-svn: 265241

8 years agoAArch64: support .cpu directive
Saleem Abdulrasool [Sat, 2 Apr 2016 19:29:52 +0000 (19:29 +0000)]
AArch64: support .cpu directive

Add support for the AArch64 .cpu directive.  This is a slightly involved
directive since the parameter is actually a variable encoded string.  The
general structure is:

  <cpu>[[+-]<feature>]*

We now map some of the supported string names for features for internal
representation of feature flags.  If we encounter one which we do not support,
bail out as we cannot validate the assembly any longer.

Resolves PR27010.

llvm-svn: 265240

8 years agoVariable names should start with uppercase letters.
Rui Ueyama [Sat, 2 Apr 2016 19:15:26 +0000 (19:15 +0000)]
Variable names should start with uppercase letters.

llvm-svn: 265239

8 years agoclang-cl: Don't skip i_group flags other than -include when building pchs.
Nico Weber [Sat, 2 Apr 2016 19:10:07 +0000 (19:10 +0000)]
clang-cl: Don't skip i_group flags other than -include when building pchs.

Before this change, e.g. -isystem flags in front of the /FI corresponding to the
pch file would be incorrectly ignored.

llvm-svn: 265238

8 years agoRename a variable. NFC.
Rui Ueyama [Sat, 2 Apr 2016 19:09:07 +0000 (19:09 +0000)]
Rename a variable. NFC.

We had variables MB and Mb in this function. Rename of one them.

llvm-svn: 265237

8 years agoDo not return early.
Rui Ueyama [Sat, 2 Apr 2016 18:52:23 +0000 (18:52 +0000)]
Do not return early.

Early return in this context is a bit confusing, so avoid doing it.

llvm-svn: 265236

8 years agoMove code to initialize LLVM to one place.
Rui Ueyama [Sat, 2 Apr 2016 18:18:44 +0000 (18:18 +0000)]
Move code to initialize LLVM to one place.

llvm-svn: 265235

8 years agoRemove DefinedElf class.
Rui Ueyama [Sat, 2 Apr 2016 18:06:18 +0000 (18:06 +0000)]
Remove DefinedElf class.

DefinedElf was a superclass of DefinedRegular and SharedSymbol classes
and represented the notion of defined symbols created for ELF symbols.

It turned out that we didn't use that class often. We had only two
occurrences of dyn_cast'ing to DefinedElf, and both were easily
rewritten without it.

The class was also a bit confusing. The concept of "created for ELF
symbol" is orthogonal to defined/undefined types. However, we had
two distinct classes, DefinedElf and UndefinedElf.

This patch simply removes the class. Now the class hierarchy is one
level shallower.

llvm-svn: 265234

8 years agoLinker: Split mapUnneededSubprograms into two; almost NFC
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 17:54:01 +0000 (17:54 +0000)]
Linker: Split mapUnneededSubprograms into two; almost NFC

Split the loop through compile units in mapUnneededSubprograms in two.
First, visit imported entities to ensure that we've visited all need
subprograms.  Second, visit subprograms, and drop the ones we don't
need.

Hypothetically this protects against a subprogram from one compile unit
being referenced from an imported entity in a different compile unit.  I
don't think that's valid IR (a debug info expert could confirm), but I
think the refactor makes the code more clear.

llvm-svn: 265233

8 years agoRemove redundant assertion after cast, NFC
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 17:41:52 +0000 (17:41 +0000)]
Remove redundant assertion after cast, NFC

llvm-svn: 265232

8 years agoLinker: Avoid unnecessary work when moving named metadata
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 17:39:31 +0000 (17:39 +0000)]
Linker: Avoid unnecessary work when moving named metadata

IRLinker::mapUnneededSubprograms has to be sure that any "needed"
subprograms get linked in.  Rather than traversing through imported
entities using llvm::getSubprogram, call MapMetadata.  The latter
memoizes the result in the ValueMap (sharing work with
IRLinker::linkNamedMDNodes proper), and makes the local SmallPtrSet
redundant.

llvm-svn: 265231

8 years agoRename FunctionIndex into GlobalValueIndex to reflect the recent changes (NFC)
Mehdi Amini [Sat, 2 Apr 2016 17:29:47 +0000 (17:29 +0000)]
Rename FunctionIndex into GlobalValueIndex to reflect the recent changes (NFC)

The index used to contain only Function, but now contains GlobalValue
in general.

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

8 years agoLinker: Remove IRMover::isMetadataUnneeded indirection; almost NFC
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 17:12:00 +0000 (17:12 +0000)]
Linker: Remove IRMover::isMetadataUnneeded indirection; almost NFC

Instead of checking live during MapMetadata whether a subprogram is
needed, seed the ValueMap with `nullptr` up-front.

There is a small hypothetical functionality change.  Previously, calling
MapMetadataOp on a node whose "scope:" chain led to an unneeded
subprogram would return nullptr.  However, if that were ever called,
then the subprogram would be needed; a situation that the IRMover is
supposed to avoid a priori!

Besides cleaning up the code a little, this restores a nice property:
MapMetadataOp returns the same as MapMetadata.

llvm-svn: 265229

8 years agoValueMapper: Add support for seeding metadata with nullptr
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 17:04:38 +0000 (17:04 +0000)]
ValueMapper: Add support for seeding metadata with nullptr

Support seeding a ValueMap with nullptr for Metadata entries, a
situation I didn't consider in the Metadata/Value split.

I added a ValueMapper::getMappedMD accessor that returns an
Optional<Metadata*> with the mapped (possibly null) metadata.  IRMover
needs to use this to avoid modifying the map when it's checking for
unneeded subprograms.  I updated a call from bugpoint since I find the
new code clearer.

llvm-svn: 265228

8 years agoDocument end of anonymous namespaces, NFC
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 16:45:51 +0000 (16:45 +0000)]
Document end of anonymous namespaces, NFC

Prevent clang-format from deleting the preceding newline.

llvm-svn: 265227

8 years agoBitcode: Try to emit metadata in function blocks
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 15:22:57 +0000 (15:22 +0000)]
Bitcode: Try to emit metadata in function blocks

Whenever metadata is only referenced by a single function, emit the
metadata just in that function block.  This should improve lazy-loading
by reducing the amount of metadata in the global block.

For now, this should catch all DILocations, and anything else that
happens to be referenced only by a single function.

It's also a first step toward a couple of possible future directions
(which this commit does *not* implement):

 1. Some debug info metadata is only referenced from compile units and
    individual functions.  If we can drop the link from the compile
    unit, this optimization will get more powerful.

 2. Any uniqued metadata that isn't referenced globally can in theory be
    emitted in every function block that references it (trading off
    bitcode size and full-parse time vs. lazy-load time).

Note: this assumes the new BitcodeReader error checking from r265223.
The metadata stored in function blocks gets purged after parsing each
function, which means unresolved forward references will get lost.
Since all the global metadata should have already been resolved by the
time we get to the function metadata blocks we just need to check for
that case.  (If for some reason we need to handle bitcode that fails the
checks in r265223, the fix is to store about-to-be-dropped unresolved
nodes in MetadataList::shrinkTo until they can be handled succesfully by
a future call to MetadataList::tryToResolveCycles.)

llvm-svn: 265226

8 years agoFix doxygen comments from r265224, NFC
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 15:16:56 +0000 (15:16 +0000)]
Fix doxygen comments from r265224, NFC

llvm-svn: 265225

8 years agoBitcodeWriter: Further unify function metadata, NFC
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 15:09:42 +0000 (15:09 +0000)]
BitcodeWriter: Further unify function metadata, NFC

Further unify the handling of function-local metadata with global
metadata, by exposing the same interface in ValueEnumerator.  Both
contexts use the same accessors:

  - getMDStrings(): get the strings for this block.
  - getNonMDStrings(): get the non-strings for this block.

A future commit will start adding strings to the function-block.

llvm-svn: 265224

8 years agoBitcodeReader: Check for unresolved function metadata
Duncan P. N. Exon Smith [Sat, 2 Apr 2016 14:55:01 +0000 (14:55 +0000)]
BitcodeReader: Check for unresolved function metadata

A follow-up commit will start using function metadata blocks more
heavily.  This commit adds some error checking to confirm that metadata
is fully resolved before (and after) materializing each function.

This is valid even when reading very old bitcode from before the
metadata/value split.  The global metadata block always came before the
function blocks.  However, in case somehow this causes a regression
(i.e., an old LLVM did produce such bitcode after all) I'm committing
separately.

llvm-svn: 265223

8 years ago[X86][AVX] Added vector float truncation (double2float) tests
Simon Pilgrim [Sat, 2 Apr 2016 14:09:17 +0000 (14:09 +0000)]
[X86][AVX] Added vector float truncation (double2float) tests

llvm-svn: 265222

8 years agoReverts r265219.
Mehdi Amini [Sat, 2 Apr 2016 05:35:03 +0000 (05:35 +0000)]
Reverts r265219.

Unintentionally commited... time to call the day off!

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

8 years agoFix "warning: variabl 'XX’ set but not used" in release build (variable used in asser...
Mehdi Amini [Sat, 2 Apr 2016 05:34:19 +0000 (05:34 +0000)]
Fix "warning: variabl 'XX’ set but not used" in release build (variable used in assertion, NFC)

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

8 years agowip
Mehdi Amini [Sat, 2 Apr 2016 05:34:14 +0000 (05:34 +0000)]
wip

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

8 years ago[test] Don't use "UNSUPPORTED" in FileCheck prefixes
Greg Parker [Sat, 2 Apr 2016 05:29:00 +0000 (05:29 +0000)]
[test] Don't use "UNSUPPORTED" in FileCheck prefixes

lit uses "UNSUPPORTED:" for its own purposes and may be
confused if that text appears elsewhere in the test file.

llvm-svn: 265218

8 years agoconstify GlobalValue::getGUID() and GlobalValue::getGlobalIdentifier() (NFC)
Mehdi Amini [Sat, 2 Apr 2016 05:25:27 +0000 (05:25 +0000)]
constify GlobalValue::getGUID() and GlobalValue::getGlobalIdentifier() (NFC)

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

8 years agoRevert "ThinLTO: add module caching handling."
Mehdi Amini [Sat, 2 Apr 2016 05:08:18 +0000 (05:08 +0000)]
Revert "ThinLTO: add module caching handling."

This reverts commit r265214, unintentionally commited.

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

8 years agoCreate a typedef GlobalValue::GUID for uint64_t and RAUW (NFC)
Mehdi Amini [Sat, 2 Apr 2016 05:07:53 +0000 (05:07 +0000)]
Create a typedef GlobalValue::GUID for uint64_t and RAUW  (NFC)

Summary: This should make the code more readable, especially all the map declarations.

Reviewers: tejohnson

Subscribers: llvm-commits

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

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

8 years agoThinLTO: add module caching handling.
Mehdi Amini [Sat, 2 Apr 2016 05:07:08 +0000 (05:07 +0000)]
ThinLTO: add module caching handling.

Reviewers: tejohnson

Subscribers: llvm-commits, joker.eph

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

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

8 years agoCall cl::ParseCommandLineOptions from the driver.
Sean Silva [Sat, 2 Apr 2016 04:08:02 +0000 (04:08 +0000)]
Call cl::ParseCommandLineOptions from the driver.

Thanks to Rui for the suggestion; this simplifies things.

llvm-svn: 265213

8 years ago80 lines column after renaming "shouldDiscardValueNames" (NFC)
Mehdi Amini [Sat, 2 Apr 2016 03:59:58 +0000 (03:59 +0000)]
80 lines column after renaming "shouldDiscardValueNames" (NFC)

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

8 years agoRename Context::discardValueNames() to shouldDiscardValueNames() (NFC)
Mehdi Amini [Sat, 2 Apr 2016 03:46:17 +0000 (03:46 +0000)]
Rename Context::discardValueNames() to shouldDiscardValueNames() (NFC)

Suggested by Sean Silva.

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

8 years ago[clang-tidy] Update an example. NFC.
Alexander Kornienko [Sat, 2 Apr 2016 03:44:23 +0000 (03:44 +0000)]
[clang-tidy] Update an example. NFC.

llvm-svn: 265210

8 years agoAdd Cache Pruning support
Mehdi Amini [Sat, 2 Apr 2016 03:28:26 +0000 (03:28 +0000)]
Add Cache Pruning support

Incremental LTO will usea cache to store object files.
This patch handles the pruning part of the cache, exposing
a few knobs:

- Pruning interval: the implementation keeps a "timestamp" file in the
  directory and will scan it only after a given interval since the
  last modification of the timestamp file. This is for performance
  purpose, we don't want to scan continuously the folder.
- Entry expiration: this is the time after which a file that hasn't
  been used is remove from the cache.
- Maximum size: expressed in percentage of the available disk space,
  it helps to avoid that we blow up the disk space.

http://reviews.llvm.org/D18422

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

8 years ago[LTO] Fix symbols which were internalized incorrectly.
Davide Italiano [Sat, 2 Apr 2016 02:10:40 +0000 (02:10 +0000)]
[LTO] Fix symbols which were internalized incorrectly.

If a symbol is defined in an archive, when we replace its body
the isUsedInRegularObj wasn't set correctly. Internalize makes
its decision based on that bit so we ended up internalizing
symbols that we shouldn't (because they're referenced).
This should fix. Thanks to Peter and Rafael for discussion
and help diagnosing the issue!

Found during LTO of unittests.

llvm-svn: 265208

8 years agoFix MSVC build after r265206
Sean Silva [Sat, 2 Apr 2016 01:51:51 +0000 (01:51 +0000)]
Fix MSVC build after r265206

c:\b\slave\sanitizer-windows\llvm\tools\lld\elf\Config.h(94) : error C2797: 'lld::elf::Configuration::MLlvm': list initialization inside member initializer list or non-static data member initializer is not implemented

llvm-svn: 265207

8 years agoPR27104: Add -mllvm option
Sean Silva [Sat, 2 Apr 2016 01:39:56 +0000 (01:39 +0000)]
PR27104: Add -mllvm option

The argv[0] is based on the analogous thing in clang.

llvm-svn: 265206

8 years ago[Clang-tidy] Improve checks documentation consistency.
Eugene Zelenko [Sat, 2 Apr 2016 01:07:18 +0000 (01:07 +0000)]
[Clang-tidy] Improve checks documentation consistency.

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

llvm-svn: 265205

8 years agoFix -Wpedantic warning about extra semi-colon
Hans Wennborg [Sat, 2 Apr 2016 01:03:41 +0000 (01:03 +0000)]
Fix -Wpedantic warning about extra semi-colon

llvm-svn: 265204

8 years agoDon't create a plt when LD access is optimized.
Rafael Espindola [Sat, 2 Apr 2016 00:19:22 +0000 (00:19 +0000)]
Don't create a plt when LD access is optimized.

llvm-svn: 265203

8 years agoDon't create a PLT when we optimize out the plt use.
Rafael Espindola [Fri, 1 Apr 2016 23:36:56 +0000 (23:36 +0000)]
Don't create a PLT when we optimize out the plt use.

llvm-svn: 265202

8 years ago[Objective-C] Introduce objc_runtime_visible attribute.
Douglas Gregor [Fri, 1 Apr 2016 23:23:52 +0000 (23:23 +0000)]
[Objective-C] Introduce objc_runtime_visible attribute.

The objc_runtime_visible attribute deals with an odd corner case where
a particular Objective-C class is known to the Objective-C runtime
(and, therefore, accessible by name) but its symbol has been hidden
for some reason. For such classes, teach CodeGen to use
objc_lookUpClass to retrieve the Class object, rather than referencing
the class symbol directly.

Classes annotated with objc_runtime_visible have two major limitations
that fall out from places where Objective-C metadata needs to refer to
the class (or metaclass) symbol directly:

* One cannot implement a subclass of an objc_runtime_visible class.
* One cannot implement a category on an objc_runtime_visible class.

Implements rdar://problem/25494092.

llvm-svn: 265201

8 years agoAdd some unit tests for ClangASTContext.
Zachary Turner [Fri, 1 Apr 2016 23:20:35 +0000 (23:20 +0000)]
Add some unit tests for ClangASTContext.

In doing so, two bugs were uncovered (and fixed).  The first bug
is that ClangASTContext::RemoveFastQualifiers() was broken, and
was not removing fast qualifiers (or doing anything else for that
matter).  The second bug is that UnifyAccessSpecifiers treated
AS_None asymmetrically, which is probably an edge case, but seems
like a bug nonetheless.

llvm-svn: 265200

8 years ago[PGO] Use a helper function to find all indirect call-sites
Rong Xu [Fri, 1 Apr 2016 23:16:44 +0000 (23:16 +0000)]
[PGO] Use a helper function to find all indirect call-sites

Use a helper function to find all the direct-calls-sites in a function.
Also split the code into a separated file as this will be use by
indirect-call-promotion transformation.

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

llvm-svn: 265199

8 years agoAArch64: avoid clobbering SP for dead MOVimm pseudos.
Tim Northover [Fri, 1 Apr 2016 23:14:52 +0000 (23:14 +0000)]
AArch64: avoid clobbering SP for dead MOVimm pseudos.

We were producing ORR, which actually defines a GPR32sp rather than a GPR32.

Should fix PR23209.

llvm-svn: 265198

8 years ago[CodeGen] Emit lifetime.end intrinsic after objects are destructed in
Akira Hatanaka [Fri, 1 Apr 2016 22:58:55 +0000 (22:58 +0000)]
[CodeGen] Emit lifetime.end intrinsic after objects are destructed in
landing pads.

Previously, lifetime.end intrinsics were inserted only on normal control
flows. This prevented StackColoring from merging stack slots for objects
that were destroyed on the exception handling control flow since it
couldn't tell their lifetime ranges were disjoint. This patch fixes
code-gen to emit the intrinsic on both control flows.

rdar://problem/22181976

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

llvm-svn: 265197

8 years agoFixed an issue where if we have DWARF in an executable that has multiple languages...
Greg Clayton [Fri, 1 Apr 2016 22:57:22 +0000 (22:57 +0000)]
Fixed an issue where if we have DWARF in an executable that has multiple languages where these languages use different type systems, you can end up trying to find the actualy definition for a forward declaration for a type, you will call:

TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &dwarf_decl_ctx);

The problem was we might be looking for a type "Foo", and find one from another langauge. Then the DWARFASTParserClang would try to make an AST type using a CompilerType that might return an empty.

This fix makes sure that when we create a DWARFDeclContext from a DWARFDIE that the DWARFDeclContext we set the language of the DIE. Then when we go to find matches for DWARFDeclContext, we end up with bunch of DIEs. We check each DWARFDIE that we found by asking it for its language and making sure the language is compatible with the type system that we want to use. This keeps us from using the wrong types to resolve forward declarations.

<rdar://problem/25276165>

llvm-svn: 265196

8 years ago[modules] Start moving the code for encoding AST records out of ASTWriter into
Richard Smith [Fri, 1 Apr 2016 22:52:03 +0000 (22:52 +0000)]
[modules] Start moving the code for encoding AST records out of ASTWriter into
a separate class. The goal is for this class to have a separate lifetime from
the AST writer so that it can meaningfully track pending statement nodes and
context for more compact encoding of various types.

llvm-svn: 265195

8 years agoRename a few variables. NFC.
Rui Ueyama [Fri, 1 Apr 2016 22:42:04 +0000 (22:42 +0000)]
Rename a few variables. NFC.

We had Phdr, PHdr and Phdrs in one line. That was a bit confusing.

llvm-svn: 265194

8 years agoMake DIASession work if msdia*.dll isn't registered.
Nico Weber [Fri, 1 Apr 2016 22:21:51 +0000 (22:21 +0000)]
Make DIASession work if msdia*.dll isn't registered.

This fixes various symbolization test failures for me when I build with a
hermetic VS2015 without having run the 2015 installer.

http://reviews.llvm.org/D18707

llvm-svn: 265193

8 years agoAdd missing emissionKind flags to the DICompileUnits of several old testcases.
Adrian Prantl [Fri, 1 Apr 2016 22:18:43 +0000 (22:18 +0000)]
Add missing emissionKind flags to the DICompileUnits of several old testcases.

llvm-svn: 265192

8 years agoThinLTO: special handling for LinkOnce functions
Mehdi Amini [Fri, 1 Apr 2016 21:53:50 +0000 (21:53 +0000)]
ThinLTO: special handling for LinkOnce functions

These function can be dropped by the compiler if they are no longer
referenced in the current module. However there is a change that
another module is still referencing them because of the import.

Multiple solutions can be used:

- Always import LinkOnce when a caller is imported. This ensure that
  every module with a call to a LinkOnce has the definition and will
  be able to emit it if it emits the call.
- Turn the LinkOnce into Weak, so that it is always emitted.
- Turn all LinkOnce into available_externally and come back after all
  modules are codegen'ed to emit only one copy of the linkonce, when
  there is still a reference to it.

This patch implement the second option, with am optimization that
only *one* module will turn the LinkOnce into Weak, while the others
will turn it into available_externally, so that there is exactly one
copy emitted for the whole compilation.

http://reviews.llvm.org/D18346

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

8 years agoSwift Calling Convention: add swifterror attribute.
Manman Ren [Fri, 1 Apr 2016 21:41:15 +0000 (21:41 +0000)]
Swift Calling Convention: add swifterror attribute.

A ``swifterror`` attribute can be applied to a function parameter or an
AllocaInst.

This commit does not include any target-specific change. The target-specific
optimization will come as a follow-up patch.

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

llvm-svn: 265189

8 years agoskip and xfail two std::list-related libcxx tests that fail on OS X with TOT libcxx
Todd Fiala [Fri, 1 Apr 2016 21:36:58 +0000 (21:36 +0000)]
skip and xfail two std::list-related libcxx tests that fail on OS X with TOT libcxx

Enrico has a bug on him to make this work across older libcxx list
and newer libcxx list simultaneously.  Needed in preparation of
getting the OS X public CI to run the TSAN tests.

tracked by:
rdar://25499635

llvm-svn: 265188

8 years agoClean up a couple more preprocessor tests to use match-full-lines.
James Y Knight [Fri, 1 Apr 2016 21:33:20 +0000 (21:33 +0000)]
Clean up a couple more preprocessor tests to use match-full-lines.

llvm-svn: 265187

8 years ago[X86][SSE] Regenerated vector float tests - fabs / floor(etc.) / fneg / float2double
Simon Pilgrim [Fri, 1 Apr 2016 21:30:48 +0000 (21:30 +0000)]
[X86][SSE] Regenerated vector float tests - fabs / floor(etc.) / fneg / float2double

llvm-svn: 265186

8 years ago[X86][SSE] Vector i64 load tests
Simon Pilgrim [Fri, 1 Apr 2016 21:06:17 +0000 (21:06 +0000)]
[X86][SSE] Vector i64 load tests

llvm-svn: 265185

8 years ago[X86][SSE] Regenerated comparison mask and float immediate tests
Simon Pilgrim [Fri, 1 Apr 2016 21:00:00 +0000 (21:00 +0000)]
[X86][SSE] Regenerated comparison mask and float immediate tests

llvm-svn: 265184

8 years ago[X86][SSE] Regenerated the vec_extract tests.
Simon Pilgrim [Fri, 1 Apr 2016 20:55:19 +0000 (20:55 +0000)]
[X86][SSE] Regenerated the vec_extract tests.

llvm-svn: 265183

8 years agoUpdate owners to reflect recent changes
David Blaikie [Fri, 1 Apr 2016 20:40:49 +0000 (20:40 +0000)]
Update owners to reflect recent changes

llvm-svn: 265182

8 years agoRemove more of the code-running ObjC data formatter support
Enrico Granata [Fri, 1 Apr 2016 20:33:22 +0000 (20:33 +0000)]
Remove more of the code-running ObjC data formatter support

llvm-svn: 265181

8 years agoFix buildbot lldb-amd64-ninja-netbsd7 failure
Rong Xu [Fri, 1 Apr 2016 20:15:04 +0000 (20:15 +0000)]
Fix buildbot lldb-amd64-ninja-netbsd7 failure

llvm-svn: 265180

8 years ago[X86][SSE] Regenerated the vec_insert tests.
Simon Pilgrim [Fri, 1 Apr 2016 19:42:23 +0000 (19:42 +0000)]
[X86][SSE] Regenerated the vec_insert tests.

llvm-svn: 265179

8 years agoRemove useless check for ThreadModel==Single in ARMISelLowering. NFC.
James Y Knight [Fri, 1 Apr 2016 19:33:19 +0000 (19:33 +0000)]
Remove useless check for ThreadModel==Single in ARMISelLowering. NFC.

ThreadModel::Single is already handled already by ARMPassConfig adding
LowerAtomicPass to the pass list, which lowers all atomics to non-atomic
ops and deletes fences.

So by the time we get to ISel, there's no atomic fences left, so they
don't need special handling.

llvm-svn: 265178

8 years agoDiagnose missing macro argument following charize operator.
Andy Gibbs [Fri, 1 Apr 2016 19:02:20 +0000 (19:02 +0000)]
Diagnose missing macro argument following charize operator.

For completeness, add a test-case for the equivalent stringize operator
diagnostic too.

llvm-svn: 265177

8 years agoLowerBitSets: Move declarations to separate namespace.
Peter Collingbourne [Fri, 1 Apr 2016 18:46:50 +0000 (18:46 +0000)]
LowerBitSets: Move declarations to separate namespace.

Should fix modules build.

llvm-svn: 265176

8 years agomark TestCallWithTimeout.py XFAIL on macosx.
Todd Fiala [Fri, 1 Apr 2016 18:42:45 +0000 (18:42 +0000)]
mark TestCallWithTimeout.py XFAIL on macosx.

This test is failing on the CI but not locally for me.  Needs
investigation.

tracked by:
https://llvm.org/bugs/show_bug.cgi?id=27182

llvm-svn: 265175

8 years ago[libfuzzer] adding license headers to cpp files
Mike Aizatsky [Fri, 1 Apr 2016 18:38:58 +0000 (18:38 +0000)]
[libfuzzer] adding license headers to cpp files

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

llvm-svn: 265174

8 years ago[X86][SSE] Regenerated vec_partial tests.
Simon Pilgrim [Fri, 1 Apr 2016 18:30:29 +0000 (18:30 +0000)]
[X86][SSE] Regenerated vec_partial tests.

llvm-svn: 265173

8 years ago[x86] add an SSE2 + fast-unaligned accesses run for memset nonzero tests
Sanjay Patel [Fri, 1 Apr 2016 18:29:25 +0000 (18:29 +0000)]
[x86] add an SSE2 + fast-unaligned accesses run for memset nonzero tests

Was there really no other way to splat a byte in SSE2?
    punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
    pshuflw {{.*#+}} xmm0 = xmm0[0,0,0,0,4,5,6,7]
    pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]

llvm-svn: 265172

8 years ago[X86][SSE] Regenerated vec_logical tests.
Simon Pilgrim [Fri, 1 Apr 2016 18:28:23 +0000 (18:28 +0000)]
[X86][SSE] Regenerated vec_logical tests.

llvm-svn: 265171

8 years agoAMDGPU: Implement {BUFFER,FLAT}_ATOMIC_CMPSWAP{,_X2}
Tom Stellard [Fri, 1 Apr 2016 18:27:37 +0000 (18:27 +0000)]
AMDGPU: Implement {BUFFER,FLAT}_ATOMIC_CMPSWAP{,_X2}

Summary:
Implement BUFFER_ATOMIC_CMPSWAP{,_X2} instructions on all GCN targets, and FLAT_ATOMIC_CMPSWAP{,_X2} on CI+.

32-bit instruction variants tested manually on Kabini and Bonaire. Tests and parts of code provided by Jan Veselý.

Patch by: Vedran Miletić

Reviewers: arsenm, tstellarAMD, nhaehnle

Subscribers: jvesely, scchan, kanarayan, arsenm

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

llvm-svn: 265170

8 years ago[X86][SSE] Regenerated vector sdiv to shifts tests
Simon Pilgrim [Fri, 1 Apr 2016 18:18:40 +0000 (18:18 +0000)]
[X86][SSE] Regenerated vector sdiv to shifts tests

Added SSE + AVX1 tests as well as AVX2

llvm-svn: 265169

8 years ago[sancov] save entry block from pruning (it is always full dominator)
Mike Aizatsky [Fri, 1 Apr 2016 18:13:19 +0000 (18:13 +0000)]
[sancov] save entry block from pruning (it is always full dominator)

llvm-svn: 265168