Commit Graph

219483 Commits

Author SHA1 Message Date
Ahmed Bougacha 812d65a26a [libcxx] Set LC_ALL rather than LC_COLLATE to override collation.
r251131 replaced LANG with LC_COLLATE. But LC_ALL has precedence
over both, so the test still fails when LC_ALL=C.

llvm-svn: 257018
2016-01-07 02:36:09 +00:00
Rui Ueyama 76c0063eeb ELF: Improve performance of string table construction.
String tables in unstripped executable files are fairly large in size.
For example, lld's executable file is about 34.4 MB in my environment,
and of which 3.5 MB is the string table. Efficiency of string table
construction matters.

Previously, the string table was built in an inefficient way. We used
StringTableBuilder to build that and enabled string tail merging,
although tail merging is not effective for the symbol table (you can
only make the string table 0.3% smaller for lld.) Tail merging is
computation intensive task and slow.

This patch eliminates string tail merging.

I changed the way of adding strings to the string table in this patch
too. Previously, strings were added using add() and the same strings
were then passed to getOffset() to get their offsets in the string table.
In this way, getOffset() needs to look up a hash table to get offsets
for given strings. This is a violation of "we look up the symbol table
(or a hash table) only once for each symbol" dogma of the new LLD's
design. Hash table lookup for long C++ mangled names is slow.
I eliminated that lookup in this patch.

In total, this patch improves link time of lld itself about 12%
(3.50 seconds -> 3.08 seconds.)

llvm-svn: 257017
2016-01-07 02:35:32 +00:00
George Burgess IV 7204ed97dd [Sema] Teach overload resolution about unaddressable functions.
Given an expression like `(&Foo)();`, we perform overload resolution as
if we are calling `Foo` directly. This causes problems if `Foo` is a
function that can't have its address taken. This patch teaches overload
resolution to ignore functions that can't have their address taken in
such cases.

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

llvm-svn: 257016
2016-01-07 02:26:57 +00:00
Philip Reames 103d2381d6 [RS4GC] Add an option to suppress vector splitting
At the moment, this is essentially a diangostic option so that I can start collecting failing test cases, but we will eventually migrate to removing the vector splitting code entirely.

llvm-svn: 257015
2016-01-07 02:20:11 +00:00
Eric Christopher 5d1caa5bf3 Replace a loop with the call that does the same thing.
llvm-svn: 257014
2016-01-07 02:00:55 +00:00
Kostya Serebryany 152ac7ad70 [libFuzzer] add a position hint to the dictionary-based mutator
llvm-svn: 257013
2016-01-07 01:49:35 +00:00
Quentin Colombet 9ed52e9a9e [ShrinkWrapping] Give up on irreducible CFGs.
We need to know whether or not a given basic block is in a loop for the analysis
to be correct.
Loop information may be incomplete on irreducible CFGs, therefore we may
generate incorrect code if we use it in those situations.

This fixes PR25988.

llvm-svn: 257012
2016-01-07 01:23:49 +00:00
Eric Christopher d40f277b39 Remove leading space added in r227312.
llvm-svn: 257011
2016-01-07 01:23:21 +00:00
Eric Christopher 63e310872c Use an actual real architecture and massage a couple of comments.
llvm-svn: 257010
2016-01-07 01:23:19 +00:00
Eric Christopher 3db3a3b0d5 Test that we're not forwarding on -g options to the non integrated assembler.
This is adding a test for an old fixed PR to make sure we don't regress.

llvm-svn: 257009
2016-01-07 01:23:12 +00:00
Richard Smith 193eaf4912 Improve documentation comments for IdentifierNamespace values.
llvm-svn: 257008
2016-01-07 01:17:43 +00:00
Dan Gohman fbe544e947 [WebAssembly] Add a test to ensure that -fvisibility=default works.
It should override the default of -fvisibility=hidden.

llvm-svn: 257007
2016-01-07 01:15:05 +00:00
Dan Gohman e3d71e14d7 [WebAssembly] Enable -fvisibility=hidden by default.
This, along with many things in the WebAssembly target, is experimental.
Feedback is welcome.

llvm-svn: 257006
2016-01-07 01:00:21 +00:00
Dan Gohman a5b804be61 [WebAssembly] Enable -ffunction-sections and -fdata-sections by default.
These remain user-overridable with -fno-function-sections and
-fno-data-sections.

llvm-svn: 257005
2016-01-07 00:50:27 +00:00
Dan Gohman 4e480206b2 [WebAssembly] Only enable --gc-sections when optimizations are enabled.
Also, revamp the wasm-toolchain.c test and add a test to ensure that
a user-supplied --no-gc-sections comes after --gc-sections.

llvm-svn: 257004
2016-01-07 00:32:04 +00:00
Andrew Wilkins 5ae84fec4c tools/llvm-config: improve shared library support
Summary:
r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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

llvm-svn: 257003
2016-01-07 00:18:56 +00:00
Pete Cooper 69b18f4703 Set CMake ADDITIONAL_HEADER_DIRS on libraries with headers in /include. NFC.
In a UI such as XCode, it can group the headers for a library with that library.
This is done in the CMakeLists.txt for the library itself by setting the path(s)
as ADDITIONAL_HEADER_DIRS.

LLVM already does this for all of its libraries, so just adding this to lld to
make things easier.  Should be NFC.

llvm-svn: 257002
2016-01-07 00:14:09 +00:00
Pete Cooper f154b678c6 Set the folder for libraries to 'lld libraries'. NFC.
In a UI such as XCode, LLVM source files are in 'libraries' while clang
files are in 'clang libraries'.

This change moves the lld source to 'lld libraries' to make code browsing easier.

It should be NFC as the build itself is still the same, just the structure in a
UI differs.

llvm-svn: 257001
2016-01-07 00:14:04 +00:00
Teresa Johnson b951558294 Always treat DISubprogram reached by DIImportedEntity as needed.
It is illegal to have a null entity in a DIImportedEntity, so
we must link in a DISubprogram metadata node referenced by one,
even if the associated function is not linked in or inlined anywhere.

Fixes PR26037.

llvm-svn: 257000
2016-01-07 00:06:27 +00:00
Mehdi Amini 0535003bef Fix PR26051: Memcpy optimization should introduce a call to memcpy before the store destination position
This is a conservative fix, I expect Amaury to relax this.
Follow-up for r256923

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 256999
2016-01-06 23:50:22 +00:00
Sanjay Patel 882a8eed3e rangify; NFCI
llvm-svn: 256998
2016-01-06 23:45:05 +00:00
John McCall 8a43a0df68 Properly bind up any cleanups in an ExprWithCleanups after
instantiating a default argument expression.

This was previously just working implicitly by reinstantiating
in the current context, but caching means that we weren't
registering cleanups in subsequent uses.

llvm-svn: 256996
2016-01-06 23:34:20 +00:00
Rui Ueyama f1cbb93050 Use RoundUpToAlignment instead of writing the expression to round up.
The original code might be more readable than the new one if you
remember the expression. Otherwise the new one is probably better.

llvm-svn: 256995
2016-01-06 23:34:12 +00:00
Rui Ueyama e2e2a631bf Simplify. NFC.
llvm-svn: 256994
2016-01-06 23:34:11 +00:00
Rui Ueyama f71358dcc9 Define align() and use that instead of RoundUpToAlignment().
The name "RoundUpToAlignment" is too long compared to what it does.

llvm-svn: 256993
2016-01-06 23:25:42 +00:00
Simon Pilgrim bc82dedd26 [X86] Determine if target shuffle can contain zero elements
getTargetShuffleMask may return shuffle masks with SM_SentinelZero (-2) values (currently just for PSHUFB but VPERM2X128 as well with this patch). Although some calling functions can make use of this (mainly for shuffle combining), others can not and their inclusion makes shuffle mask comparisons more difficult.

This patch adds a flag to getTargetShuffleMask to indicate if the calling function can't handle SM_SentinelZero; getTargetShuffleMask will then return false if it occurs to make handling much easier.

I've tidied up some uses of getTargetShuffleMask to better indicate what is going on - more could be done but at present I don't have test cases to demonstrate it.

Some upcoming patches will make use of this to both support more uses where SM_SentinelZero is not permitted (e.g. combineShuffleToAddSub), and also will allow us to add INSERTPS support to getTargetShuffleMask as part of better zero handling discussed in D14261.

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

llvm-svn: 256992
2016-01-06 23:24:40 +00:00
Vedant Kumar e83538bcf9 [Bitcode] Remove superflous compatibility tests
With r256990, bogner introduced comprehensive tests for constant arrays
and vectors. We no longer need the existing ones because they are
redundant.

llvm-svn: 256991
2016-01-06 23:22:38 +00:00
Justin Bogner d99e71833c Bitcode: Move these tests into compatibility.ll
I added a couple of tests in r256982, but vedantk suggested that they
fit better into compatibility.ll, since they could catch format breaks
later on there.

llvm-svn: 256990
2016-01-06 23:16:37 +00:00
Anna Zaks ef9a56faa0 [compiler-rt] On Darwin, link all frameworks with -fapplication-extension
The ASan dylib as well as other compiler-rt dylibs work with app extensions,
so we should add -fapplication-extension to the link line when building them.
This will avoid linker warnings when using the dylibs in app extensions.

(APIs unavailable to app extensions are listed here: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/TP40014214-CH2-SW6)

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

llvm-svn: 256989
2016-01-06 23:15:04 +00:00
Anna Zaks 56c302fee6 [sanitizers] Log all output to CrashReport on OS X
Log all of sanitizers' output (not just ASan bug reports) to CrashReport,
which simplifies diagnosing failed checks as well as other errors. This
also allows to strip the color sequences early from the printed buffer,
which is more efficient than what we had perviously.

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

llvm-svn: 256988
2016-01-06 23:15:01 +00:00
Weiming Zhao 0f1762caf9 Recommit r256952 "Filtering IR printing for print-after-all/print-before-all"
Fix lit test fail due to outputting an extra line.

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

llvm-svn: 256987
2016-01-06 22:55:03 +00:00
Rui Ueyama cf07a31107 Remove redundant `llvm::ELF::`.
llvm-svn: 256986
2016-01-06 22:53:58 +00:00
Richard Smith 9f9518265f PR26048, PR26050: put non-type template parameters and indirect field decls
into IDNS_Tag in C++, because they conflict with redeclarations of tags. (This
doesn't affect elaborated-type-specifier lookup, which looks for IDNS_Type in
C++).

llvm-svn: 256985
2016-01-06 22:49:11 +00:00
Rui Ueyama 70eed364fc Simplify MipsReginfoInputSection.
MipsReginfoInputSection is basically just a container of Elf_Mips_Reginfo
struct. This patch makes that struct directly accessible from others.

llvm-svn: 256984
2016-01-06 22:42:43 +00:00
John McCall 32791cc3e1 Only instantiate a default argument once.
By storing the instantiated expression back in the ParmVarDecl,
we remove the last need for separately storing the sub-expression
of a CXXDefaultArgExpr.  This makes PCH/Modules merging quite
simple: CXXDefaultArgExpr records are serialized as references
to the ParmVarDecl, and we ignore redundant attempts to overwrite
the instantiated expression.

This has some extremely marginal impact on user-facing semantics.
However, the major effect is that it avoids IRGen errors about
conflicting definitions due to lambdas in the argument being
instantiated multiple times while sharing the same mangling.
It should also slightly improve memory usage and module file size.

rdar://23810407

llvm-svn: 256983
2016-01-06 22:34:54 +00:00
Justin Bogner a43eacbf9e Bitcode: Fix reading and writing of ConstantDataVectors of halfs
In r254991 I allowed ConstantDataVectors to contain elements of
HalfTy, but I missed updating the bitcode reader and writer to handle
this, so now we crash if we try to emit bitcode on programs that have
constant vectors of half.

This fixes the issue and adds test coverage for reading and writing
constant sequences in bitcode.

llvm-svn: 256982
2016-01-06 22:31:32 +00:00
Rui Ueyama 58a636ac06 Add llvm_unreachable to unreachable code.
The original code was an infinite recursion when the control reaches there.

llvm-svn: 256981
2016-01-06 22:01:25 +00:00
Nicolai Haehnle a61e5a8d4e AMDGPU/SI: Fix crash when inline assembly is used in a graphics shader
Summary:
This is admittedly something that you could only run into by manually
playing around with shader assembly because the SITypeWriter pass is
skipped for compute.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

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

llvm-svn: 256980
2016-01-06 22:01:04 +00:00
Richard Smith 0f56118c57 Fix half of PR26048. We don't yet diagnose the case where the anonymous union member is declared first and the tag name is declared second.
llvm-svn: 256979
2016-01-06 21:54:29 +00:00
Krzysztof Parzyszek 4954354666 [Hexagon] Expand -mvN to -mcpu=hexagonvN
llvm-svn: 256978
2016-01-06 21:27:42 +00:00
Krzysztof Parzyszek 972f72c4b5 [Hexagon] Treat -march and -mcpu as equivalent
llvm-svn: 256977
2016-01-06 21:12:03 +00:00
Richard Trieu 43b4c821e1 Improve conditional checking during template instantiation.
When the condition in an if statement, while statement, or for loop is created
during template instantiation, it calls MakeFullExpr with only the condition
expression.  However, when these conditions are created for non-templated
code in the Parser, an additional SourceLocation is passed to MakeFullExpr.
The impact of this was that non-dependent templated code could produce
diagnostics that the same code outside templates would not.  Adding the missing
SourceLocation makes diagnostics consistent between templated and non-templated
code.

llvm-svn: 256976
2016-01-06 21:11:18 +00:00
Nico Weber 337b08d8d6 Add -Wfor-loop-analysis to -Wall.
This warning seems to have 0 false positives and some true positives in
practice, without a measurable compile time cost.  It should be in -Wall, and
possibly even become a default warning at some point.

llvm-svn: 256975
2016-01-06 20:55:00 +00:00
Pete Cooper d53090ac5e Fix MachO arm64 delta32ToGOT reloc encoding in -r.
The fixup content we encode here should be the offset from the
fixup location back to the last nonlocal label.  We were only encoding
the address of the fixup, and not taking in to account the base address
of the atom we are in.

Updated the test case here to have a text section which will come before
the data section where the relocation lives.  .data being at offset 0 had
previously been hiding this bug.

llvm-svn: 256974
2016-01-06 20:53:19 +00:00
Sanjay Patel c2d6461a4a [LibCallSimplifier] less indenting; NFCI
llvm-svn: 256973
2016-01-06 20:52:21 +00:00
Chen Li 78bde83003 [SplitLandingPadPredecessors] Create a PHINode for the original landingpad only if it has some uses
Summary: This patch adds a check in SplitLandingPadPredecessors to see if the original landingpad instruction has any uses. If not, we don't need to create a PHINode for it in the joint block since it's gonna be a dead code anyway. The motivation for this patch is that we found a bug that SplitLandingPadPredecessors created a PHINode of token type landingpad, which failed the verifier since PHINode can not be token type. However, the created PHINode will never be used in our code pattern. This patch will workaround this bug, and we might add supports in SplitLandingPadPredecessors to handle token type landingpad with uses in the future.

Reviewers: reames

Subscribers: llvm-commits

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

llvm-svn: 256972
2016-01-06 20:32:05 +00:00
Rui Ueyama 33b3f21168 Rename GroupEntryType -> uint32_X.
GroupEntryType was a 32-bit integral type but that was not obvious
from its name.

llvm-svn: 256971
2016-01-06 20:30:02 +00:00
Rui Ueyama 83cd6e00e9 Remove unnecessary `lld::`.
llvm-svn: 256970
2016-01-06 20:11:55 +00:00
Amaury Sechet 3235c08253 Promote aggregate store to memset when possible
Summary: As per title. This will allow the optimizer to pick up on it.

Reviewers: craig.topper, spatel, dexonsmith, Prazek, chandlerc, joker.eph, majnemer

Subscribers: llvm-commits

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

llvm-svn: 256969
2016-01-06 19:47:24 +00:00
Amaury Sechet 5fc9f6999d Remove useless DEBUG
llvm-svn: 256968
2016-01-06 19:45:09 +00:00