Commit Graph

226840 Commits

Author SHA1 Message Date
Kuba Brecka d0e83a6eb2 [sanitizer] Make AtosSymbolizer more resilient when symbolicating a zero address
llvm-svn: 265269
2016-04-03 19:13:03 +00:00
Duncan P. N. Exon Smith 829dc87a68 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
2016-04-03 19:06:24 +00:00
Simon Pilgrim d74f6e22f2 [X86][SSE] Refreshed MOVMSK sign bit tests
llvm-svn: 265267
2016-04-03 18:59:42 +00:00
Simon Pilgrim cd0dfc93eb [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
2016-04-03 18:22:03 +00:00
Peter Zotov f87e550e89 [CodeGenPrepare] Fix r265264.
The case where there was no TargetLowering was not handled,
leading to null pointer dereferences.

llvm-svn: 265265
2016-04-03 17:11:53 +00:00
Peter Zotov 0b6d7bc682 [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
2016-04-03 16:36:17 +00:00
Simon Pilgrim 20d1d4f045 [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
2016-04-03 14:14:32 +00:00
Peter Zotov 0218d0f383 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
2016-04-03 12:30:46 +00:00
Johannes Doerfert 2075b5d2a1 [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
2016-04-03 11:16:00 +00:00
Johannes Doerfert 7dcceb82e9 [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
2016-04-03 11:12:39 +00:00
Elena Demikhovsky 5e426f7356 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
2016-04-03 08:41:12 +00:00
Davide Italiano 842fa53026 [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
2016-04-03 03:39:09 +00:00
Akira Hatanaka 6bdfe01a20 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
2016-04-03 03:36:22 +00:00
Davide Italiano 88dbd3b1cf [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
2016-04-03 03:12:00 +00:00
Davide Italiano 8848d44e46 [LTO] Reject invalid optimization levels.
llvm-svn: 265255
2016-04-03 02:41:15 +00:00
Davide Italiano 887d76c392 [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
2016-04-03 02:16:56 +00:00
Davide Italiano d4f5a059e0 [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
2016-04-03 01:46:52 +00:00
Vedant Kumar f27d227409 [c-index-test] Fix leak in print_completion_result, NFC
llvm-svn: 265252
2016-04-03 00:54:46 +00:00
Jacques Pienaar 796975d311 [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
2016-04-03 00:49:27 +00:00
Davide Italiano c4965009bd [ELF] Prefer 'auto' over explicit type for consistency.
llvm-svn: 265250
2016-04-02 23:47:54 +00:00
Zoran Jovanovic 2b7cc5a4ae [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
2016-04-02 23:06:13 +00:00
Simon Pilgrim b2e837d875 [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
2016-04-02 21:33:09 +00:00
Simon Pilgrim 8fd7d852d5 [X86][AVX512] Added AVX512 comparison tests
llvm-svn: 265247
2016-04-02 21:24:42 +00:00
Ed Schouten 988b827992 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
2016-04-02 20:58:02 +00:00
Rui Ueyama 12dff23951 Simplify. NFC.
llvm-svn: 265242
2016-04-02 19:36:36 +00:00
Rui Ueyama 24d0d2f917 Merge two `if`s.
llvm-svn: 265241
2016-04-02 19:31:01 +00:00
Saleem Abdulrasool 85b43639b1 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
2016-04-02 19:29:52 +00:00
Rui Ueyama 8fe7ce5903 Variable names should start with uppercase letters.
llvm-svn: 265239
2016-04-02 19:15:26 +00:00
Nico Weber d8ff0eedbb 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
2016-04-02 19:10:07 +00:00
Rui Ueyama 7e71c61a7a Rename a variable. NFC.
We had variables MB and Mb in this function. Rename of one them.

llvm-svn: 265237
2016-04-02 19:09:07 +00:00
Rui Ueyama d1aa97b5c2 Do not return early.
Early return in this context is a bit confusing, so avoid doing it.

llvm-svn: 265236
2016-04-02 18:52:23 +00:00
Rui Ueyama 1fc5d48877 Move code to initialize LLVM to one place.
llvm-svn: 265235
2016-04-02 18:18:44 +00:00
Rui Ueyama bfc1d9d976 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
2016-04-02 18:06:18 +00:00
Duncan P. N. Exon Smith 6d72d166dc 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
2016-04-02 17:54:01 +00:00
Duncan P. N. Exon Smith 751114b39d Remove redundant assertion after cast, NFC
llvm-svn: 265232
2016-04-02 17:41:52 +00:00
Duncan P. N. Exon Smith 0d60a9887f 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
2016-04-02 17:39:31 +00:00
Mehdi Amini 8958c40430 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
2016-04-02 17:29:47 +00:00
Duncan P. N. Exon Smith 4b520e5ef6 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
2016-04-02 17:12:00 +00:00
Duncan P. N. Exon Smith da4a56d1ab 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
2016-04-02 17:04:38 +00:00
Duncan P. N. Exon Smith ddbb1cd45a Document end of anonymous namespaces, NFC
Prevent clang-format from deleting the preceding newline.

llvm-svn: 265227
2016-04-02 16:45:51 +00:00
Duncan P. N. Exon Smith 520f8542ff 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
2016-04-02 15:22:57 +00:00
Duncan P. N. Exon Smith 0b76b723f4 Fix doxygen comments from r265224, NFC
llvm-svn: 265225
2016-04-02 15:16:56 +00:00
Duncan P. N. Exon Smith 9342911f31 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
2016-04-02 15:09:42 +00:00
Duncan P. N. Exon Smith 8742de9b20 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
2016-04-02 14:55:01 +00:00
Simon Pilgrim a2c8da9e06 [X86][AVX] Added vector float truncation (double2float) tests
llvm-svn: 265222
2016-04-02 14:09:17 +00:00
Mehdi Amini 1e5fddda3d Reverts r265219.
Unintentionally commited... time to call the day off!

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265221
2016-04-02 05:35:03 +00:00
Mehdi Amini 89038a1071 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
2016-04-02 05:34:19 +00:00
Mehdi Amini 5921a3ae66 wip
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265219
2016-04-02 05:34:14 +00:00
Greg Parker 084f2312b2 [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
2016-04-02 05:29:00 +00:00
Mehdi Amini b049431bec constify GlobalValue::getGUID() and GlobalValue::getGlobalIdentifier() (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265217
2016-04-02 05:25:27 +00:00