platform/upstream/llvm.git
7 years ago[SystemZ] Improve use of conditional instructions
Ulrich Weigand [Mon, 28 Nov 2016 13:34:08 +0000 (13:34 +0000)]
[SystemZ] Improve use of conditional instructions

This patch moves formation of LOC-type instructions from (late)
IfConversion to the early if-conversion pass, and in some cases
additionally creates them directly from select instructions
during DAG instruction selection.

To make early if-conversion work, the patch implements the
canInsertSelect / insertSelect callbacks.  It also implements
the commuteInstructionImpl and FoldImmediate callbacks to
enable generation of the full range of LOC instructions.

Finally, the patch adds support for all instructions of the
load-store-on-condition-2 facility, which allows using LOC
instructions also for high registers.

Due to the use of the GRX32 register class to enable high registers,
we now also have to handle the cases where there are still no single
hardware instructions (conditional move from a low register to a high
register or vice versa).  These are converted back to a branch sequence
after register allocation.  Since the expandRAPseudos callback is not
allowed to create new basic blocks, this requires a simple new pass,
modelled after the ARM/AArch64 ExpandPseudos pass.

Overall, this patch causes significantly more LOC-type instructions
to be used, and results in a measurable performance improvement.

llvm-svn: 288028

7 years agoskip android in @skipIfHostIncompatibleWithRemote
Pavel Labath [Mon, 28 Nov 2016 12:15:19 +0000 (12:15 +0000)]
skip android in @skipIfHostIncompatibleWithRemote

The current implementation of the decorator does not skip if the android target
arch is the same as host arch (as in both cases the platform comes out as linux).
Nonetheless android x86_64 binaries are not compatible with linux ones.

Technically this should be "skip if target is android and host is *not* android",
but currently nobody runs lldb test suite on an android host, so we don't even
have a way of specifying that the host is android.

llvm-svn: 288027

7 years agoFix a crash in ProcessPOSIXLog
Pavel Labath [Mon, 28 Nov 2016 11:47:14 +0000 (11:47 +0000)]
Fix a crash in ProcessPOSIXLog

We are getting a null pointer for the list of categories here (presumably due to
the args refactor).

llvm-svn: 288026

7 years ago[Sema] Set range end of constructors and destructors in template instantiations
Malcolm Parsons [Mon, 28 Nov 2016 11:11:34 +0000 (11:11 +0000)]
[Sema] Set range end of constructors and destructors in template instantiations

Summary:
clang-tidy checks frequently use source ranges of functions.
The source range of constructors and destructors in template instantiations
is currently a single token.
The factory method for constructors and destructors does not allow the
end source location to be specified.
Set end location manually after creating instantiation.

Reviewers: aaron.ballman, rsmith, arphaman

Subscribers: arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D26849

llvm-svn: 288025

7 years ago[InlineCost] Reduce inline thresholds to compensate for cost changes
James Molloy [Mon, 28 Nov 2016 11:07:37 +0000 (11:07 +0000)]
[InlineCost] Reduce inline thresholds to compensate for cost changes

In r286814, the algorithm for calculating inline costs changed. This
caused more inlining to take place which is especially apparent
in optsize and minsize modes.

As the cost calculation removed a skewed behaviour (we were inconsistent
about the cost of calls) it isn't possible to update the thresholds to
get exactly the same behaviour as before. However, this threshold change
accounts for the very common case where an inline candidate has no
calls within it. In this case, r286814 would inline around 5-6 more (IR)
instructions.

The changes to -Oz have been heavily benchmarked. The "obvious" value
for the inline threshold at -Oz is zero, but due to inaccuracies in the
inline heuristics this can actually cause code size increases due to
not inlining key thunk functions (that then disappear). Experimentally,
5 was the sweet spot for code size over the test-suite.

For -Os, this change removes the outlier results shown up by green dragon
(http://104.154.54.203/db_default/v4/nts/13248).

Fixes D26848.

llvm-svn: 288024

7 years ago[PM] Remove weird marking of invalidated analyses as "preserved".
Chandler Carruth [Mon, 28 Nov 2016 10:42:21 +0000 (10:42 +0000)]
[PM] Remove weird marking of invalidated analyses as "preserved".

This never made a lot of sense. They've been invalidated for one IR unit
but they aren't really preserved in any normal sense. It seemed like it
would be an elegant way of communicating to outer IR units that pass
managers and adaptors had already handled invalidation, but we've since
ended up adding sets that model this more clearly: we're now using
the 'AllAnalysesOn<IRUnitT>' set to handle cases where the trick of
"preserving" invalidated analyses didn't work.

This patch moves to rely on that technique exclusively and removes the
cumbersome API aspect of updating the preserved set when doing
invalidation. This in turn will simplify a *number* of upcoming patches.

This has a side benefit of exposing a number of places where we were
failing to mark the 'AllAnalysesOn<IRUnitT>' set as preserved. This
patch fixes those, and with those fixes shouldn't change any observable
behavior.

llvm-svn: 288023

7 years ago[ELF] - Do not put non exec sections first when -no-rosegment
George Rimar [Mon, 28 Nov 2016 10:26:21 +0000 (10:26 +0000)]
[ELF] - Do not put non exec sections first when -no-rosegment

That unifies handling cases when we have SECTIONS and when
-no-rosegment is given in compareSectionsNonScript()

Now Config->SingleRoRx is used for check, testcase is provided.

llvm-svn: 288022

7 years ago[ELF] - Set Config->SingleRoRx differently. NFC.
George Rimar [Mon, 28 Nov 2016 10:11:10 +0000 (10:11 +0000)]
[ELF] - Set Config->SingleRoRx differently. NFC.

Previously Config->SingleRoRx was set in
createFiles() and used HasSections.

This change moves it to readConfigs at place of
common flags handling, and adds logic that sets
this flag separatelly from ScriptParser if SECTIONS present.

llvm-svn: 288021

7 years ago[ELF] - Implemented -no-rosegment.
George Rimar [Mon, 28 Nov 2016 10:05:20 +0000 (10:05 +0000)]
[ELF] - Implemented -no-rosegment.

--no-rosegment: Do not put read-only non-executable sections in their own segment

Differential revision: https://reviews.llvm.org/D26889

llvm-svn: 288020

7 years ago[ELF] Print file:line for 'undefined section' errors
Eugene Leviant [Mon, 28 Nov 2016 09:58:04 +0000 (09:58 +0000)]
[ELF] Print file:line for 'undefined section' errors

Differential revision: https://reviews.llvm.org/D27108

llvm-svn: 288019

7 years ago[ThreadPool] Rollback recent changes until I figure out the breakage.
Davide Italiano [Mon, 28 Nov 2016 09:17:12 +0000 (09:17 +0000)]
[ThreadPool] Rollback recent changes until I figure out the breakage.

llvm-svn: 288018

7 years ago[ThreadPool] Remove outdated comment after r288016.
Davide Italiano [Mon, 28 Nov 2016 08:57:05 +0000 (08:57 +0000)]
[ThreadPool] Remove outdated comment after r288016.

llvm-svn: 288017

7 years ago[ThreadPool] Simplify the interface. NFCI.
Davide Italiano [Mon, 28 Nov 2016 08:53:41 +0000 (08:53 +0000)]
[ThreadPool] Simplify the interface. NFCI.

The callers don't use the return value. Found by Michael
Spencer.

llvm-svn: 288016

7 years agoRevert "Improve error handling in YAML parsing"
Mehdi Amini [Mon, 28 Nov 2016 04:57:04 +0000 (04:57 +0000)]
Revert "Improve error handling in YAML parsing"

This reverts commit r288014, the unittest isn't passing

llvm-svn: 288015

7 years agoImprove error handling in YAML parsing
Mehdi Amini [Mon, 28 Nov 2016 04:44:13 +0000 (04:44 +0000)]
Improve error handling in YAML parsing

Some scanner errors were not checked and reported by the parser.

Fix PR30934

Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>

Differential Revision: https://reviews.llvm.org/D26419

llvm-svn: 288014

7 years ago[PM] Add an ASCII-art diagram for the call graph in the CGSCC unit test.
Chandler Carruth [Mon, 28 Nov 2016 03:40:33 +0000 (03:40 +0000)]
[PM] Add an ASCII-art diagram for the call graph in the CGSCC unit test.

No functionality changed.

llvm-svn: 288013

7 years agoAlways create a PT_ARM_EXIDX if needed.
Rafael Espindola [Mon, 28 Nov 2016 00:40:21 +0000 (00:40 +0000)]
Always create a PT_ARM_EXIDX if needed.

Unfortunatelly PT_ARM_EXIDX is special. There is no way to create it
from linker scripts, so we have to create it even if PHDRS is used.

This matches bfd and is required for the lld output to survive bfd's strip.

llvm-svn: 288012

7 years ago[X86][FMA4] Remove isCommutable from FMA4 scalar intrinsics. They aren't commutable...
Craig Topper [Sun, 27 Nov 2016 21:37:04 +0000 (21:37 +0000)]
[X86][FMA4] Remove isCommutable from FMA4 scalar intrinsics. They aren't commutable as operand 0 should pass its upper bits through to the output.

llvm-svn: 288011

7 years ago[X86][FMA] Add missing Predicates qualifier around scalar FMA intrinsic patterns.
Craig Topper [Sun, 27 Nov 2016 21:37:02 +0000 (21:37 +0000)]
[X86][FMA] Add missing Predicates qualifier around scalar FMA intrinsic patterns.

llvm-svn: 288010

7 years ago[X86][FMA4] Add load folding support for FMA4 scalar intrinsic instructions.
Craig Topper [Sun, 27 Nov 2016 21:37:00 +0000 (21:37 +0000)]
[X86][FMA4] Add load folding support for FMA4 scalar intrinsic instructions.

llvm-svn: 288009

7 years ago[X86][FMA4] Add test cases to demonstrate missed folding opportunities for FMA4 scala...
Craig Topper [Sun, 27 Nov 2016 21:36:58 +0000 (21:36 +0000)]
[X86][FMA4] Add test cases to demonstrate missed folding opportunities for FMA4 scalar intrinsics.

llvm-svn: 288008

7 years ago[X86] Add SHL by 1 to the load folding tables.
Craig Topper [Sun, 27 Nov 2016 21:36:54 +0000 (21:36 +0000)]
[X86] Add SHL by 1 to the load folding tables.

I don't think isel selects these today, favoring adding the register to itself instead. But the load folding tables shouldn't be so concerned with what isel will use and just represent the relationships.

llvm-svn: 288007

7 years ago[X86][SSE] Add support for combining target shuffles to 128/256-bit PSLL/PSRL bit...
Simon Pilgrim [Sun, 27 Nov 2016 21:08:19 +0000 (21:08 +0000)]
[X86][SSE] Add support for combining target shuffles to 128/256-bit PSLL/PSRL bit shifts

llvm-svn: 288006

7 years ago[InstSimplify] allow integer vector types to use computeKnownBits
Sanjay Patel [Sun, 27 Nov 2016 21:07:28 +0000 (21:07 +0000)]
[InstSimplify] allow integer vector types to use computeKnownBits

Note that the non-splat lshr+lshr test folded, but that does not
work in general. Something is missing or wrong in computeKnownBits
as the non-splat shl+shl test still shows.

llvm-svn: 288005

7 years ago[AVX-512] Add integer and fp unpck instructions to load folding tables.
Craig Topper [Sun, 27 Nov 2016 19:51:41 +0000 (19:51 +0000)]
[AVX-512] Add integer and fp unpck instructions to load folding tables.

llvm-svn: 288004

7 years ago[X86][SSE] Split lowerVectorShuffleAsShift ready for combines. NFCI.
Simon Pilgrim [Sun, 27 Nov 2016 19:28:39 +0000 (19:28 +0000)]
[X86][SSE] Split lowerVectorShuffleAsShift ready for combines. NFCI.

Moved most of matching code into matchVectorShuffleAsShift to share with target shuffle combines (in a future commit).

llvm-svn: 288003

7 years agoAdd paralell_for and use it where appropriate.
Rui Ueyama [Sun, 27 Nov 2016 19:28:32 +0000 (19:28 +0000)]
Add paralell_for and use it where appropriate.

When we iterate over numbers as opposed to iterable elements,
parallel_for fits better than parallel_for_each.

llvm-svn: 288002

7 years ago[X86] Add TB_NO_REVERSE to entries in the load folding table where the instruction...
Craig Topper [Sun, 27 Nov 2016 18:51:13 +0000 (18:51 +0000)]
[X86] Add TB_NO_REVERSE to entries in the load folding table where the instruction's load size is smaller than the register size.

If we were to unfold these, the load size would be increased to the register size. This is not safe to do since the enlarged load can do things like cross a page boundary into a page that doesn't exist.

I probably missed some instructions, but this should be a large portion of them.

llvm-svn: 288001

7 years ago[X86][SSE] Added tests showing missed combines for shuffle to shifts.
Simon Pilgrim [Sun, 27 Nov 2016 18:25:02 +0000 (18:25 +0000)]
[X86][SSE] Added tests showing missed combines for shuffle to shifts.

llvm-svn: 288000

7 years agoAdjust type-trait evaluation to properly handle Using(Shadow)Decls
Hal Finkel [Sun, 27 Nov 2016 16:26:14 +0000 (16:26 +0000)]
Adjust type-trait evaluation to properly handle Using(Shadow)Decls

Since r274049, for an inheriting constructor declaration, the name of the using
declaration (and using shadow declaration comes from the using declaration) is
the name of a derived class, not the base class (line 8225-8232 of
lib/Sema/SemaDeclCXX.cpp in https://reviews.llvm.org/rL274049). Because of
this, name-based lookup performed inside Sema::LookupConstructors returns not
only CXXConstructorDecls but also Using(Shadow)Decls, which results assertion
failure reported in PR29087.

Patch by Taewook Oh, thanks!

Differential Revision: https://reviews.llvm.org/D23765

llvm-svn: 287999

7 years agoadd tests to show missing analysis; NFC
Sanjay Patel [Sun, 27 Nov 2016 15:54:45 +0000 (15:54 +0000)]
add tests to show missing analysis; NFC

llvm-svn: 287998

7 years agofix formatting; NFC
Sanjay Patel [Sun, 27 Nov 2016 15:53:48 +0000 (15:53 +0000)]
fix formatting; NFC

llvm-svn: 287997

7 years agoAlso skip regular symbol assignment at the start of a script.
Rafael Espindola [Sun, 27 Nov 2016 09:44:45 +0000 (09:44 +0000)]
Also skip regular symbol assignment at the start of a script.

Unfortunatelly some scripts look like

kernphys = ...
. = ....

and the expectation in that every orphan section is after the
assignment.

llvm-svn: 287996

7 years ago[AVX-512] Add masked EVEX vpmovzx/sx instructions to load folding tables.
Craig Topper [Sun, 27 Nov 2016 08:55:31 +0000 (08:55 +0000)]
[AVX-512] Add masked EVEX vpmovzx/sx instructions to load folding tables.

llvm-svn: 287995

7 years agoDon't put an orphan before the first . assignment.
Rafael Espindola [Sun, 27 Nov 2016 07:39:45 +0000 (07:39 +0000)]
Don't put an orphan before the first . assignment.

This is an horrible special case, but seems to match bfd's behaviour
and is important for avoiding placing an orphan section before the
expected start of the file.

llvm-svn: 287994

7 years ago[SLP] Add new and update existing lit testfor providing more context to incoming...
Mohammad Shahid [Sun, 27 Nov 2016 03:35:31 +0000 (03:35 +0000)]
[SLP] Add new and update existing lit testfor providing more context to incoming patch for vectorization of jumbled load

Change-Id: Ifb9091bb0f84c1937c2c8bd2fc345734f250d2f9
llvm-svn: 287992

7 years ago[X86] Remove alignment restrictions from load folding table for some instructions...
Craig Topper [Sun, 27 Nov 2016 01:52:51 +0000 (01:52 +0000)]
[X86] Remove alignment restrictions from load folding table for some instructions that don't have a restriction.

Most of these are the SSE4.1 PMOVZX/PMOVSX instructions which all read less than 128-bits. The only other was PMOVUPD which by definition is an unaligned load.

llvm-svn: 287991

7 years ago[DOXYGEN] Updated instruction names corresponding to avxintrin.h intrinsics.
Ekaterina Romanova [Sat, 26 Nov 2016 19:38:19 +0000 (19:38 +0000)]
[DOXYGEN] Updated instruction names corresponding to avxintrin.h intrinsics.

Documentation for some of the avxintrin.h's intrinsics errorneously said that
non VEX-prefixed instructions could be generated. This was fixed.

I tried several different solutions to achieve pretty printing of unordered lists (nested and non-nested) in param sections in doxygen.

llvm-svn: 287990

7 years ago[tsan] Fix the lit expansion of %deflake not to eat a space
Kuba Mracek [Sat, 26 Nov 2016 19:09:32 +0000 (19:09 +0000)]
[tsan] Fix the lit expansion of %deflake not to eat a space

The lit expansion of "%deflake " (notice the space after) expands in a way that the space is removed, this fixes that.

Differential Revision: https://reviews.llvm.org/D27139

llvm-svn: 287989

7 years agoImplement conjuntion/disjuntion/negation for LFTS v2. Same code and tests for the...
Marshall Clow [Sat, 26 Nov 2016 18:45:03 +0000 (18:45 +0000)]
Implement conjuntion/disjuntion/negation for LFTS v2. Same code and tests for the ones in std::

llvm-svn: 287988

7 years ago[X86] Remove hasOneUse check that is redundant with the one in IsProfitableToFold.
Craig Topper [Sat, 26 Nov 2016 18:43:26 +0000 (18:43 +0000)]
[X86] Remove hasOneUse check that is redundant with the one in IsProfitableToFold.

llvm-svn: 287987

7 years ago[X86] Fix the zero extending load detection in X86DAGToDAGISel::selectScalarSSELoad...
Craig Topper [Sat, 26 Nov 2016 18:43:24 +0000 (18:43 +0000)]
[X86] Fix the zero extending load detection in X86DAGToDAGISel::selectScalarSSELoad to pass the load node to IsProfitableToFold and IsLegalToFold.

Previously we were passing the SCALAR_TO_VECTOR node.

llvm-svn: 287986

7 years ago[X86] Simplify control flow. NFCI
Craig Topper [Sat, 26 Nov 2016 18:43:21 +0000 (18:43 +0000)]
[X86] Simplify control flow. NFCI

llvm-svn: 287985

7 years ago[ScopInfo] Use SCEVRewriteVisitor to simplify SCEVSensitiveParameterRewriter [NFC]
Tobias Grosser [Sat, 26 Nov 2016 17:58:40 +0000 (17:58 +0000)]
[ScopInfo] Use SCEVRewriteVisitor to simplify SCEVSensitiveParameterRewriter [NFC]

llvm-svn: 287984

7 years ago[X86] Add a hasOneUse check to selectScalarSSELoad to keep the same load from being...
Craig Topper [Sat, 26 Nov 2016 17:29:25 +0000 (17:29 +0000)]
[X86] Add a hasOneUse check to selectScalarSSELoad to keep the same load from being folded multiple times.

Summary: When selectScalarSSELoad is looking for a scalar_to_vector of a scalar load, it makes sure the load is only used by the scalar_to_vector. But it doesn't make sure the scalar_to_vector is only used once. This can cause the same load to be folded multiple times. This can be bad for performance. This also causes the chain output to be duplicated, but not connected to anything so chain dependencies will not be satisfied.

Reviewers: RKSimon, zvi, delena, spatel

Subscribers: andreadb, llvm-commits

Differential Revision: https://reviews.llvm.org/D26790

llvm-svn: 287983

7 years ago[InstCombine] add test to show missing vector optimization; NFC
Sanjay Patel [Sat, 26 Nov 2016 16:13:23 +0000 (16:13 +0000)]
[InstCombine] add test to show missing vector optimization; NFC

llvm-svn: 287982

7 years agoImplement the 'detection idiom' from LFTS v2
Marshall Clow [Sat, 26 Nov 2016 15:49:40 +0000 (15:49 +0000)]
Implement the 'detection idiom' from LFTS v2

llvm-svn: 287981

7 years ago[InstCombine] don't drop metadata in FoldOpIntoSelect()
Sanjay Patel [Sat, 26 Nov 2016 15:23:20 +0000 (15:23 +0000)]
[InstCombine] don't drop metadata in FoldOpIntoSelect()

llvm-svn: 287980

7 years agoChange return types of split{Non,}Strings.
Rui Ueyama [Sat, 26 Nov 2016 15:15:11 +0000 (15:15 +0000)]
Change return types of split{Non,}Strings.

They return new vectors, but at the same time they mutate other vectors,
so returning values doesn't make much sense. We should just mutate two
vectors.

llvm-svn: 287979

7 years agoMake getColorDiagnostics return a boolean value instead of an enum.
Rui Ueyama [Sat, 26 Nov 2016 15:10:01 +0000 (15:10 +0000)]
Make getColorDiagnostics return a boolean value instead of an enum.

Config->ColorDiagnostics was of type enum before. Now it is just a
boolean flag. Thanks Rafael for suggestion.

llvm-svn: 287978

7 years agoSplit MergeOutputSection::finalize.
Rui Ueyama [Sat, 26 Nov 2016 15:09:58 +0000 (15:09 +0000)]
Split MergeOutputSection::finalize.

llvm-svn: 287977

7 years agoadd optional param to copy metadata when creating selects; NFC
Sanjay Patel [Sat, 26 Nov 2016 15:01:59 +0000 (15:01 +0000)]
add optional param to copy metadata when creating selects; NFC

There are other spots where we can use this; we're currently dropping
metadata in some places, and there are proposed changes where we will
want to propagate metadata.

IRBuilder's CreateSelect() already has a parameter like this, so this
change makes the regular 'Create' API line up with that.

llvm-svn: 287976

7 years ago[AVX-512] Add unmasked EVEX vpmovzx/sx instructions to load folding tables.
Craig Topper [Sat, 26 Nov 2016 08:21:52 +0000 (08:21 +0000)]
[AVX-512] Add unmasked EVEX vpmovzx/sx instructions to load folding tables.

llvm-svn: 287975

7 years ago[AVX-512] Add masked 128/256-bit integer add/sub instructions to load folding tables.
Craig Topper [Sat, 26 Nov 2016 08:21:48 +0000 (08:21 +0000)]
[AVX-512] Add masked 128/256-bit integer add/sub instructions to load folding tables.

llvm-svn: 287974

7 years ago[ScopDetect] Expand statistics of the detected scops
Tobias Grosser [Sat, 26 Nov 2016 07:37:46 +0000 (07:37 +0000)]
[ScopDetect] Expand statistics of the detected scops

We now collect:

  Number of total loops
  Number of loops in scops
  Number of scops
  Number of scops with maximal loop depth 1
  Number of scops with maximal loop depth 2
  Number of scops with maximal loop depth 3
  Number of scops with maximal loop depth 4
  Number of scops with maximal loop depth 5
  Number of scops with maximal loop depth 6 and larger
  Number of loops in scops (profitable scops only)
  Number of scops (profitable scops only)
  Number of scops with maximal loop depth 1 (profitable scops only)
  Number of scops with maximal loop depth 2 (profitable scops only)
  Number of scops with maximal loop depth 3 (profitable scops only)
  Number of scops with maximal loop depth 4 (profitable scops only)
  Number of scops with maximal loop depth 5 (profitable scops only)
  Number of scops with maximal loop depth 6 and larger (profitable scops only)

These statistics are certainly completely accurate as we might drop scops
when building up their polyhedral representation, but they should give a good
indication of the number of scops we detect.

llvm-svn: 287973

7 years ago[AVX-512] Add masked 512-bit integer add/sub instructions to load folding tables.
Craig Topper [Sat, 26 Nov 2016 07:21:00 +0000 (07:21 +0000)]
[AVX-512] Add masked 512-bit integer add/sub instructions to load folding tables.

llvm-svn: 287972

7 years ago[AVX-512] Teach LowerFormalArguments to use the extended register class when availabl...
Craig Topper [Sat, 26 Nov 2016 07:20:57 +0000 (07:20 +0000)]
[AVX-512] Teach LowerFormalArguments to use the extended register class when available. Fix the avx512vl stack folding tests to clobber more registers or otherwise they use xmm16 after this change.

llvm-svn: 287971

7 years ago[AVX-512] Add VLX versions of VDIVPD/PS and VMULPD/PS to load folding tables.
Craig Topper [Sat, 26 Nov 2016 07:20:53 +0000 (07:20 +0000)]
[AVX-512] Add VLX versions of VDIVPD/PS and VMULPD/PS to load folding tables.

llvm-svn: 287970

7 years agoCreate sections with just assignments as STT_NOBITS.
Rafael Espindola [Sat, 26 Nov 2016 06:55:35 +0000 (06:55 +0000)]
Create sections with just assignments as STT_NOBITS.

This matches the behaviour of bfd ld. Using 0 was causing problems
with strip, which would remove these sections.

llvm-svn: 287969

7 years ago[ScopDetectionDiagnostic] Collect statistics for each diagnostic type
Tobias Grosser [Sat, 26 Nov 2016 05:53:09 +0000 (05:53 +0000)]
[ScopDetectionDiagnostic] Collect statistics for each diagnostic type

Our original statistics were added before we introduced a more fine-grained
diagnostic system, but the granularity of our statistics has never been
increased accordingly. This change introduces now one statistic counter per
diagnostic to enable us to collect fine-grained statistics about who certain
scops are not detected. In case coarser grained statistics are needed, the
user is expected to combine counters manually.

llvm-svn: 287968

7 years ago[ELF] Be compliant with LLVM and rename Lto into LTO. NFCI.
Davide Italiano [Sat, 26 Nov 2016 05:37:04 +0000 (05:37 +0000)]
[ELF] Be compliant with LLVM and rename Lto into LTO. NFCI.

llvm-svn: 287967

7 years ago[lldb] Fix typos in file headers
Alexander Shaposhnikov [Sat, 26 Nov 2016 05:23:44 +0000 (05:23 +0000)]
[lldb] Fix typos in file headers

This diff fixes typos in file headers (incorrect file names).

Test plan:

Under llvm/tools/lldb/source:
find ./* -type f | grep -e '\(cpp\|h\)$' | while read F; do B=$(basename $F); echo $F head -n 1 $F | grep -v $B | wc -l ; done

Differential revision: https://reviews.llvm.org/D27115

llvm-svn: 287966

7 years ago[ScopDetectionDiagnostic] IrreducibleRegion is a subclasses of CFG
Tobias Grosser [Sat, 26 Nov 2016 05:08:27 +0000 (05:08 +0000)]
[ScopDetectionDiagnostic] IrreducibleRegion is a subclasses of CFG

Reflect this correctly in the RejectReasonKind enum. The definition of
RejectReasonKind::IrreducibleRegion was introduced in r258497, when we started
to refuse regions containing irreducible loops.

llvm-svn: 287965

7 years ago[ScopDetectionDiagnostic] Remove leftover RejectReasonKind for Conditions [NFC]
Tobias Grosser [Sat, 26 Nov 2016 05:08:24 +0000 (05:08 +0000)]
[ScopDetectionDiagnostic] Remove leftover RejectReasonKind for Conditions [NFC]

In r248118 some diagnostics for unstructured control flow have been removed,
but the corresponding RejectReasonKind was accidentally not removed. This
change removes it, as it is not needed any more.

llvm-svn: 287964

7 years ago[ScopDectionDiagnostic] Use scoped enums instead three letter prefix [NFC]
Tobias Grosser [Sat, 26 Nov 2016 03:44:31 +0000 (03:44 +0000)]
[ScopDectionDiagnostic] Use scoped enums instead three letter prefix [NFC]

This improves readability of the code.

llvm-svn: 287963

7 years agoAMDGPU/SI: Use float as the operand type for amdgcn.interp intrinsics
Tom Stellard [Sat, 26 Nov 2016 02:26:04 +0000 (02:26 +0000)]
AMDGPU/SI: Use float as the operand type for amdgcn.interp intrinsics

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

Differential Revision: https://reviews.llvm.org/D26724

llvm-svn: 287962

7 years ago[X86][XOP] Add a reversed reg/reg form for VPROT instructions.
Craig Topper [Sat, 26 Nov 2016 02:14:00 +0000 (02:14 +0000)]
[X86][XOP] Add a reversed reg/reg form for VPROT instructions.

The W bit distinquishes which operand is the memory operand. But if the mod bits are 3 then the memory operand is a register and there are two possible encodings. We already did this correctly for several other XOP instructions.

llvm-svn: 287961

7 years ago[X86] Add SSE, AVX, and AVX2 version of MOVDQU to the load/store folding tables for...
Craig Topper [Sat, 26 Nov 2016 02:13:58 +0000 (02:13 +0000)]
[X86] Add SSE, AVX, and AVX2 version of MOVDQU to the load/store folding tables for consistency.

Not sure this is truly needed but we had the floating point equivalents, the aligned equivalents, and the EVEX equivalents. So this just makes it complete.

llvm-svn: 287960

7 years ago[asan] Support handle_sigill on Darwin
Kuba Mracek [Sat, 26 Nov 2016 01:30:31 +0000 (01:30 +0000)]
[asan] Support handle_sigill on Darwin

Handling SIGILL on Darwin works fine, so let's just make this feature work and re-enable the ill.cc testcase.

Differential Revision: https://reviews.llvm.org/D27141

llvm-svn: 287959

7 years agoUn-XFAIL an AVR CodeGen test
Dylan McKay [Sat, 26 Nov 2016 01:07:32 +0000 (01:07 +0000)]
Un-XFAIL an AVR CodeGen test

llvm-svn: 287958

7 years ago[asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGV
Kuba Mracek [Sat, 26 Nov 2016 00:50:08 +0000 (00:50 +0000)]
[asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGV

This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag.

Differential Revision: https://reviews.llvm.org/D11365

llvm-svn: 287957

7 years ago[AVX-512] Put the AVX-512 sections of the load folding tables into mostly alphabetica...
Craig Topper [Fri, 25 Nov 2016 23:21:34 +0000 (23:21 +0000)]
[AVX-512] Put the AVX-512 sections of the load folding tables into mostly alphabetical order. This is consistent with the older sections of the table. NFC

llvm-svn: 287956

7 years agoReplace some callers of setTailCall with setTailCallKind
David Majnemer [Fri, 25 Nov 2016 22:35:09 +0000 (22:35 +0000)]
Replace some callers of setTailCall with setTailCallKind

We were a little sloppy with adding tailcall markers.  Be more
consistent by using setTailCallKind instead of setTailCall.

llvm-svn: 287955

7 years ago[SimplifyCFG] auto-generate better checks; NFC
Sanjay Patel [Fri, 25 Nov 2016 21:12:39 +0000 (21:12 +0000)]
[SimplifyCFG] auto-generate better checks; NFC

llvm-svn: 287954

7 years ago[SimplifyCFG] auto-generate better checks; NFC
Sanjay Patel [Fri, 25 Nov 2016 21:07:13 +0000 (21:07 +0000)]
[SimplifyCFG] auto-generate better checks; NFC

llvm-svn: 287953

7 years agoFix buildbots.
Rui Ueyama [Fri, 25 Nov 2016 20:42:39 +0000 (20:42 +0000)]
Fix buildbots.

llvm-svn: 287952

7 years agoFix typo.
Rui Ueyama [Fri, 25 Nov 2016 20:41:45 +0000 (20:41 +0000)]
Fix typo.

llvm-svn: 287951

7 years agoDo not print out ARGV0 in white because it's unreadable on white background.
Rui Ueyama [Fri, 25 Nov 2016 20:37:16 +0000 (20:37 +0000)]
Do not print out ARGV0 in white because it's unreadable on white background.

llvm-svn: 287950

7 years agoSupport -color-diagnostics={auto,always,never}.
Rui Ueyama [Fri, 25 Nov 2016 20:27:32 +0000 (20:27 +0000)]
Support -color-diagnostics={auto,always,never}.

-color-diagnostics=auto is default because that's the same as
Clang's default. When color is enabled, error or warning messages
are colored like this.

  error:
  <bold>ld.lld</bold> <red>error:</red> foo.o: no such file

  warning:
  <bold>ld.lld</bold> <magenta>warning:</magenta> foo.o: no such file

Differential Revision: https://reviews.llvm.org/D27117

llvm-svn: 287949

7 years agoWe shouldn't call parallle_for_each if -no-thread is given.
Rui Ueyama [Fri, 25 Nov 2016 20:20:57 +0000 (20:20 +0000)]
We shouldn't call parallle_for_each if -no-thread is given.

llvm-svn: 287948

7 years agoTypo.
Joerg Sonnenberger [Fri, 25 Nov 2016 20:15:57 +0000 (20:15 +0000)]
Typo.

llvm-svn: 287947

7 years agoParallelize uncompress() and splitIntoPieces().
Rui Ueyama [Fri, 25 Nov 2016 20:05:08 +0000 (20:05 +0000)]
Parallelize uncompress() and splitIntoPieces().

Uncompressing section contents and spliting mergeable section contents
into smaller chunks are heavy tasks. They scan entire section contents
and do CPU-intensive tasks such as uncompressing zlib-compressed data
or computing a hash value for each section piece.

Luckily, these tasks are independent to each other, so we can do that
in parallel_for_each. The number of input sections is large (as opposed
to the number of output sections), so there's a large parallelism here.

Actually the current design to call uncompress() and splitIntoPieces()
in batch was chosen with doing this in mind. Basically what we need to
do here is to replace `for` with `parallel_for_each`.

It seems this patch improves latency significantly if linked programs
contain debug info (which in turn contain lots of mergeable strings.)
For example, the latency to link Clang (debug build) improved by 20% on
my machine as shown below. Note that ld.gold took 19.2 seconds to do
the same thing.

Before:
    30801.782712 task-clock (msec)         #    3.652 CPUs utilized            ( +-  2.59% )
         104,084 context-switches          #    0.003 M/sec                    ( +-  1.02% )
           5,063 cpu-migrations            #    0.164 K/sec                    ( +- 13.66% )
       2,528,130 page-faults               #    0.082 M/sec                    ( +-  0.47% )
  85,317,809,130 cycles                    #    2.770 GHz                      ( +-  2.62% )
  67,352,463,373 stalled-cycles-frontend   #   78.94% frontend cycles idle     ( +-  3.06% )
 <not supported> stalled-cycles-backend
  44,295,945,493 instructions              #    0.52  insns per cycle
                                           #    1.52  stalled cycles per insn  ( +-  0.44% )
   8,572,384,877 branches                  #  278.308 M/sec                    ( +-  0.66% )
     141,806,726 branch-misses             #    1.65% of all branches          ( +-  0.13% )

     8.433424003 seconds time elapsed                                          ( +-  1.20% )

After:
    35523.764575 task-clock (msec)         #    5.265 CPUs utilized            ( +-  2.67% )
         159,107 context-switches          #    0.004 M/sec                    ( +-  0.48% )
           8,123 cpu-migrations            #    0.229 K/sec                    ( +- 23.34% )
       2,372,483 page-faults               #    0.067 M/sec                    ( +-  0.36% )
  98,395,342,152 cycles                    #    2.770 GHz                      ( +-  2.62% )
  79,294,670,125 stalled-cycles-frontend   #   80.59% frontend cycles idle     ( +-  3.03% )
 <not supported> stalled-cycles-backend
  46,274,151,813 instructions              #    0.47  insns per cycle
                                           #    1.71  stalled cycles per insn  ( +-  0.47% )
   8,987,621,670 branches                  #  253.003 M/sec                    ( +-  0.60% )
     148,900,624 branch-misses             #    1.66% of all branches          ( +-  0.27% )

     6.747548004 seconds time elapsed                                          ( +-  0.40% )

llvm-svn: 287946

7 years agoMove typedefs inside a class definition.
Rui Ueyama [Fri, 25 Nov 2016 18:51:56 +0000 (18:51 +0000)]
Move typedefs inside a class definition.

llvm-svn: 287945

7 years agoRemove a parameter from ScriptParser.
Rui Ueyama [Fri, 25 Nov 2016 18:51:54 +0000 (18:51 +0000)]
Remove a parameter from ScriptParser.

llvm-svn: 287944

7 years agoMove getLocation from Relocations.cpp to InputSection.cpp.
Rui Ueyama [Fri, 25 Nov 2016 18:51:53 +0000 (18:51 +0000)]
Move getLocation from Relocations.cpp to InputSection.cpp.

The function was used only within Relocations.cpp, but now we are
using it in many places, so this patch moves it to a file that fits
to the functionality.

llvm-svn: 287943

7 years agoAMDGPU/SI: Add back reverted SGPR spilling code, but disable it
Marek Olsak [Fri, 25 Nov 2016 17:37:09 +0000 (17:37 +0000)]
AMDGPU/SI: Add back reverted SGPR spilling code, but disable it

suggested as a better solution by Matt

llvm-svn: 287942

7 years agoUse SDValue helpers instead of explicitly going via SDValue::getNode(). NFCI
Simon Pilgrim [Fri, 25 Nov 2016 17:25:21 +0000 (17:25 +0000)]
Use SDValue helpers instead of explicitly going via SDValue::getNode(). NFCI

llvm-svn: 287941

7 years agoUse SDValue helper instead of explicitly going via SDValue::getNode(). NFCI
Simon Pilgrim [Fri, 25 Nov 2016 17:19:53 +0000 (17:19 +0000)]
Use SDValue helper instead of explicitly going via SDValue::getNode(). NFCI

llvm-svn: 287940

7 years ago[AVX-512] Add support for changing VSHUFF64x2 to VSHUFF32x4 when its feeding a vselec...
Craig Topper [Fri, 25 Nov 2016 16:48:05 +0000 (16:48 +0000)]
[AVX-512] Add support for changing VSHUFF64x2 to VSHUFF32x4 when its feeding a vselect with 32-bit element size.

Summary:
Shuffle lowering may have widened the element size of a i32 shuffle to i64 before selecting X86ISD::SHUF128. If this shuffle was used by a vselect this can prevent us from selecting masked operations.

This patch detects this and changes the element size to match the vselect.

I don't handle changing integer to floating point or vice versa as its not clear if its better to push such a bitcast to the inputs of the shuffle or to the user of the vselect. So I'm ignoring that case for now.

Reviewers: delena, zvi, RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27087

llvm-svn: 287939

7 years ago[ELF] Add explicit template instantiations for toString
Eugene Leviant [Fri, 25 Nov 2016 16:42:04 +0000 (16:42 +0000)]
[ELF] Add explicit template instantiations for toString

llvm-svn: 287938

7 years ago[AVX-512] Add VPERMT2* and VPERMI2* instructions to load folding tables.
Craig Topper [Fri, 25 Nov 2016 16:33:53 +0000 (16:33 +0000)]
[AVX-512] Add VPERMT2* and VPERMI2* instructions to load folding tables.

llvm-svn: 287937

7 years agoRevert "AMDGPU: Implement SGPR spilling with scalar stores"
Marek Olsak [Fri, 25 Nov 2016 16:03:34 +0000 (16:03 +0000)]
Revert "AMDGPU: Implement SGPR spilling with scalar stores"

This reverts commit 4404d0d6e354e80dd7f8f0a0e12d8ad809cf007e.

llvm-svn: 287936

7 years agoRevert "AMDGPU: Fix MMO when splitting spill"
Marek Olsak [Fri, 25 Nov 2016 16:03:27 +0000 (16:03 +0000)]
Revert "AMDGPU: Fix MMO when splitting spill"

This reverts commit 79d4f8b8b1ce430c3d5dac4fc72a9eebaed24fe1.

llvm-svn: 287935

7 years agoRevert "AMDGPU: Fix adding extra implicit def of register"
Marek Olsak [Fri, 25 Nov 2016 16:03:22 +0000 (16:03 +0000)]
Revert "AMDGPU: Fix adding extra implicit def of register"

This reverts commit e834ce5976567575621901fb967b8018b9916d71.

llvm-svn: 287934

7 years agoRevert "AMDGPU: Fix not setting kill flag on temp reg when spilling"
Marek Olsak [Fri, 25 Nov 2016 16:03:19 +0000 (16:03 +0000)]
Revert "AMDGPU: Fix not setting kill flag on temp reg when spilling"

This reverts commit 057bbbe4ae170247ba37f08f2e70ef185267d1bb.

llvm-svn: 287933

7 years agoRevert "AMDGPU: Make m0 unallocatable"
Marek Olsak [Fri, 25 Nov 2016 16:03:15 +0000 (16:03 +0000)]
Revert "AMDGPU: Make m0 unallocatable"

This reverts commit 124ad83dae04514f943902446520c859adee0e96.

llvm-svn: 287932

7 years agoRevert "AMDGPU: Remove m0 spilling code"
Marek Olsak [Fri, 25 Nov 2016 16:03:06 +0000 (16:03 +0000)]
Revert "AMDGPU: Remove m0 spilling code"

This reverts commit f18de36554eb22416f8ba58e094e0272523a4301.

llvm-svn: 287931

7 years agoRevert "AMDGPU: Preserve m0 value when spilling"
Marek Olsak [Fri, 25 Nov 2016 16:03:02 +0000 (16:03 +0000)]
Revert "AMDGPU: Preserve m0 value when spilling"

This reverts commit a5a179ffd94fd4136df461ec76fb30f04afa87ce.

llvm-svn: 287930

7 years agoDo not do raw name replacement when FromDecl is a class forward-declaration.
Eric Liu [Fri, 25 Nov 2016 16:02:49 +0000 (16:02 +0000)]
Do not do raw name replacement when FromDecl is a class forward-declaration.

Summary:
If the `FromDecl` is a class forward declaration, the reference is
still considered as referring to the original definition given the nature
of forward-declarations, so we can't do a raw name replacement in this case.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D27132

llvm-svn: 287929

7 years ago[X86][SSE] Added knownbits through bitcast test
Simon Pilgrim [Fri, 25 Nov 2016 15:07:15 +0000 (15:07 +0000)]
[X86][SSE] Added knownbits through bitcast test

llvm-svn: 287928