platform/upstream/llvm.git
8 years ago[GlobalISel] Fix LLT::unsized to match LLT(LabelTy).
Ahmed Bougacha [Fri, 29 Jul 2016 16:11:02 +0000 (16:11 +0000)]
[GlobalISel] Fix LLT::unsized to match LLT(LabelTy).

When coming from an IR label type, we set a 0 NumElements, but not
when constructing an LLT using unsized(), causing comparisons to fail.

Pick one variant and fix the other.

llvm-svn: 277161

8 years ago[GlobalISel] Add unittests for LowLevelType.
Ahmed Bougacha [Fri, 29 Jul 2016 16:10:57 +0000 (16:10 +0000)]
[GlobalISel] Add unittests for LowLevelType.

llvm-svn: 277160

8 years agoRemove dead declaration.
Rui Ueyama [Fri, 29 Jul 2016 16:08:04 +0000 (16:08 +0000)]
Remove dead declaration.

llvm-svn: 277159

8 years agoReinstate optnone test for GVN Hoisting, removed in r276479.
Paul Robinson [Fri, 29 Jul 2016 16:05:50 +0000 (16:05 +0000)]
Reinstate optnone test for GVN Hoisting, removed in r276479.

llvm-svn: 277158

8 years agoRevert "updated Xcode project r277139"
Todd Fiala [Fri, 29 Jul 2016 16:00:25 +0000 (16:00 +0000)]
Revert "updated Xcode project r277139"

This undoes my last commit.  It collided with Pavel undoing
his change that my previous commit was adjusting for in the
Xcode file.

This reverts commit f6f29cb7d7c56f96f21d9c115ecc66d652639df3.

llvm-svn: 277157

8 years agoupdated Xcode project r277139
Todd Fiala [Fri, 29 Jul 2016 15:51:43 +0000 (15:51 +0000)]
updated Xcode project r277139

llvm-svn: 277156

8 years ago[ASTMatcher] Add templateName matcher.
Haojian Wu [Fri, 29 Jul 2016 15:45:11 +0000 (15:45 +0000)]
[ASTMatcher] Add templateName matcher.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 277155

8 years agoRevert "Rewrite gdb-remote's SendContinuePacketAndWaitForResponse"
Pavel Labath [Fri, 29 Jul 2016 15:41:52 +0000 (15:41 +0000)]
Revert "Rewrite gdb-remote's SendContinuePacketAndWaitForResponse"

This reverts commit r277139, because:
- broken unittest on windows (likely typo on my part)
- seems to break TestCallThatRestart (needs investigation)

llvm-svn: 277154

8 years ago[ELF] - Linkerscript: Implemented SORT command.
George Rimar [Fri, 29 Jul 2016 15:32:46 +0000 (15:32 +0000)]
[ELF] - Linkerscript: Implemented SORT command.

When the SORT keyword is used, the linker will sort the files or sections into ascending order by name before placing them in the output file.
It is used in FreeBSD script:
https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l139

This is PR28689.

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

llvm-svn: 277153

8 years agoRemove inline-comment-2.ll until I can debug why it fails on some builds
Nirav Dave [Fri, 29 Jul 2016 15:24:06 +0000 (15:24 +0000)]
Remove inline-comment-2.ll until I can debug why it fails on some builds

llvm-svn: 277152

8 years ago[Hexagon] Improve balancing of address calculation
Krzysztof Parzyszek [Fri, 29 Jul 2016 15:15:35 +0000 (15:15 +0000)]
[Hexagon] Improve balancing of address calculation

Rebalances address calculation trees and applies Hexagon-specific
optimizations to the trees to improve instruction selection.

Patch by Tobias Edler von Koch.

llvm-svn: 277151

8 years ago[ELF] - Linkerscript: make addSection() global function instead lambda. NFC.
George Rimar [Fri, 29 Jul 2016 15:12:48 +0000 (15:12 +0000)]
[ELF] - Linkerscript: make addSection() global function instead lambda. NFC.

llvm-svn: 277150

8 years agoFix inline-comment-2.ll triple
Nirav Dave [Fri, 29 Jul 2016 15:12:00 +0000 (15:12 +0000)]
Fix inline-comment-2.ll triple

llvm-svn: 277149

8 years agoAvoid unnecessary 32-bit to 64-bit zero extensions following
David L Kreitzer [Fri, 29 Jul 2016 15:09:54 +0000 (15:09 +0000)]
Avoid unnecessary 32-bit to 64-bit zero extensions following
32-bit CMOV instructions on x86_64. The 32-bit CMOV implicitly
zero extends.

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

llvm-svn: 277148

8 years ago[ELF] - Update comment. NFC.
George Rimar [Fri, 29 Jul 2016 15:07:11 +0000 (15:07 +0000)]
[ELF] - Update comment. NFC.

llvm-svn: 277147

8 years ago[MC] When emitting output hash comments always use standard line comment seperator
Nirav Dave [Fri, 29 Jul 2016 14:42:00 +0000 (14:42 +0000)]
[MC] When emitting output hash comments always use standard line comment seperator

llvm-svn: 277146

8 years agoFix license information in the file header
Krzysztof Parzyszek [Fri, 29 Jul 2016 14:04:17 +0000 (14:04 +0000)]
Fix license information in the file header

llvm-svn: 277145

8 years agoAdd missing files to r277143
Krzysztof Parzyszek [Fri, 29 Jul 2016 13:59:55 +0000 (13:59 +0000)]
Add missing files to r277143

llvm-svn: 277144

8 years ago[Hexagon] Implement DFA based hazard recognizer
Krzysztof Parzyszek [Fri, 29 Jul 2016 13:59:09 +0000 (13:59 +0000)]
[Hexagon] Implement DFA based hazard recognizer

The post register allocator scheduler can generate poor schedules
because the scoreboard hazard recognizer is unable to identify
hazards for Hexagon precisely. Instead, Hexagon should use a DFA
based hazard recognizer.

Patch by Brendon Cahoon.

llvm-svn: 277143

8 years ago[ASTMatcher] Add hasTemplateArgument/hasAnyTemplateArgument support in functionDecl.
Haojian Wu [Fri, 29 Jul 2016 13:57:27 +0000 (13:57 +0000)]
[ASTMatcher] Add hasTemplateArgument/hasAnyTemplateArgument support in functionDecl.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 277142

8 years agoAdd missing '-no-canonical-prefixes' in test.
Daniel Jasper [Fri, 29 Jul 2016 13:45:03 +0000 (13:45 +0000)]
Add missing '-no-canonical-prefixes' in test.

llvm-svn: 277141

8 years agoAdd/fix support for i386 elf core files
Dimitar Vlahovski [Fri, 29 Jul 2016 13:18:09 +0000 (13:18 +0000)]
Add/fix support for i386 elf core files

Summary:
There were places in the code, assuming(hardcoding) offsets
and types that were only valid for the x86_64 elf core file format.

The NT_PRSTATUS and NT_PRPSINFO structures are with the 64 bit layout.
I have reused them and parse i386 files manually, and fill them in the
same struct.

Also added some error handling during parsing that checks if the
available bytes in the buffer are enough to fill the structures.

The i386 core file test case now passes.

For reference on the structures layout, I generally used the
source of binutils (bfd, readelf)

Bug: https://llvm.org/bugs/show_bug.cgi?id=26947

Reviewers: labath

Subscribers: lldb-commits

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

llvm-svn: 277140

8 years agoRewrite gdb-remote's SendContinuePacketAndWaitForResponse
Pavel Labath [Fri, 29 Jul 2016 13:10:02 +0000 (13:10 +0000)]
Rewrite gdb-remote's SendContinuePacketAndWaitForResponse

SendContinuePacketAndWaitForResponse was huge function with very complex interactions with
several other functions (SendAsyncSignal, SendInterrupt, SendPacket). This meant that making any
changes to how packet sending functions and threads interact was very difficult and error-prone.

This change does not add any functionality yet, it merely paves the way for future changes. In a
follow-up, I plan to add the ability to have multiple query packets in flight (i.e.,
request,request,response,response instead of the usual request,response sequences) and use that
to speed up qModuleInfo packet processing.

Here, I introduce two special kinds of locks: ContinueLock, which is used by the continue thread,
and Lock, which is used by everyone else. ContinueLock (atomically) sends a continue packet, and
blocks any other async threads from accessing the connection. Other threads create an instance of
the Lock object when they want to access the connection. This object, while in scope prevents the
continue from being send. Optionally, it can also interrupt the process to gain access to the
connection for async processing.

Most of the syncrhonization logic is encapsulated within these two classes. Some of it still
had to bleed over into the SendContinuePacketAndWaitForResponse, but the function is still much
more manageable than before -- partly because of most of the work is done in the ContinueLock
class, and partly because I have factored out a lot of the packet processing code separate
functions (this also makes the functionality more easily testable). Most importantly, there is
none of syncrhonization code in the async thread users -- as far as they are concerned, they just
need to declare a Lock object, and they are good to go (SendPacketAndWaitForResponse is now a
very thin wrapper around the NoLock version of the function, whereas previously it had over 100
lines of synchronization code).  This will make my follow up changes there easy.

I have written a number of unit tests for the new code and I have ran the test suite on linux and
osx with no regressions.

Subscribers: tberghammer

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

llvm-svn: 277139

8 years agoMake test not fail on hosts where the default omp library is gomp.
Benjamin Kramer [Fri, 29 Jul 2016 13:07:09 +0000 (13:07 +0000)]
Make test not fail on hosts where the default omp library is gomp.

This is the case on some linuxes, just force libomp so we get the
desired results.

llvm-svn: 277138

8 years agotsan: Enable 48-bit VMA support on aarch64
Adhemerval Zanella [Fri, 29 Jul 2016 12:45:35 +0000 (12:45 +0000)]
tsan: Enable 48-bit VMA support on aarch64

This patch adds 48-bits VMA support for tsan on aarch64.  As current
mappings for aarch64, 48-bit VMA also supports PIE executable.  This
limits the mapping mechanism because the PIE address bits
(usually 0aaaaXXXXXXXX) makes it harder to create a mask/xor value
to include all memory regions.  I think it is possible to create a
large application VAM range by either dropping PIE support or tune
current range.

It also changes slight the way addresses are packed in SyncVar structure:
previously it assumes x86_64 as the maximum VMA range.  Since ID is 14 bits
wide, shifting 48 bits should be ok.

Tested on x86_64, ppc64le and aarch64 (39 and 48 bits VMA).

llvm-svn: 277137

8 years agoRe-commit: [mips][fastisel] Handle 0-4 arguments without SelectionDAG.
Daniel Sanders [Fri, 29 Jul 2016 12:27:28 +0000 (12:27 +0000)]
Re-commit: [mips][fastisel] Handle 0-4 arguments without SelectionDAG.

Summary:
Implements fastLowerArguments() to avoid the need to fall back on
SelectionDAG for 0-4 argument functions that don't do tricky things like
passing double in a pair of i32's.

This allows us to move all except one test to -fast-isel-abort=3. The
remaining one has function prototypes of the form 'i32 (i32, double, double)'
which requires floats to be passed in GPR's.

The previous commit had an uninitialized variable that caused the incoming
argument region to have undefined size. This has been fixed.

Reviewers: sdardis

Subscribers: dsanders, llvm-commits, sdardis

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

llvm-svn: 277136

8 years agoCleanup TransferDbgValues
Nirav Dave [Fri, 29 Jul 2016 11:49:32 +0000 (11:49 +0000)]
Cleanup TransferDbgValues

[DAG] Check debug values for invalidation before transferring and mark
old debug values invalid when transferring to another SDValue.

This fixes PR28613.

Reviewers: jyknight, hans, dblaikie, echristo

Subscribers: yaron.keren, ismail, llvm-commits

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

llvm-svn: 277135

8 years ago[GCC] Support for __final specifier
Andrey Bokhanko [Fri, 29 Jul 2016 10:42:48 +0000 (10:42 +0000)]
[GCC] Support for __final specifier

As reported in bug 28473, GCC supports "final" functionality in pre-C++11 code using the __final keyword. Clang currently supports the "final" keyword in accordance with the C++11 specification, however it ALSO supports it in pre-C++11 mode, with a warning.

This patch adds the "__final" keyword for compatibility with GCC in GCC Keywords mode (so it is enabled with existing flags), and issues a warning on its usage (suggesting switching to the C++11 keyword). This patch also adds a regression test for the functionality described. I believe this patch has minimal impact, as it simply adds a new keyword for existing behavior.

This has been validated with check-clang to avoid regressions. Patch is created in reference to revisions 276665.

Patch by Erich Keane.

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

llvm-svn: 277134

8 years agoFixup r277011 - wrong use of infinite timeout
Pavel Labath [Fri, 29 Jul 2016 10:34:52 +0000 (10:34 +0000)]
Fixup r277011 - wrong use of infinite timeout

The commit accidentally switched a timed wait on a condition variable into an infinite timeout.
Change that back. Android tests were timeing out without this.

llvm-svn: 277133

8 years ago[X86][SSE] Optimize the truncation of vector comparison results with PACKSS
Simon Pilgrim [Fri, 29 Jul 2016 10:23:10 +0000 (10:23 +0000)]
[X86][SSE] Optimize the truncation of vector comparison results with PACKSS

We currently default to using either generic shuffles or MASK+PACKUS/PACKSS to truncate all integer vectors. For vector comparisons, we know that the result will be either all or zero bits in every element, which can be efficiently truncated by directly using PACKSS to repeatedly halve the size of each element.

Due to the limited input values (-1 or 0) we don't need to account for vector element size, so for simplicity we just use the PACKSS(vXi16,vXi16) implementation in all cases. Additionally for AVX2 PACKSS of 256bit data we must perform a PERMQ shuffle to reorder the data into the correct order. I did investigate performing a single shuffle after all the PACKSS calls but the need to cross 128bit lanes makes this difficult to achieve efficiently.

We avoid performing this on AVX512 as it should have better alternative truncation instructions.

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

llvm-svn: 277132

8 years ago[clang-rename] speedup RenamingAction
Kirill Bobyrev [Fri, 29 Jul 2016 10:16:45 +0000 (10:16 +0000)]
[clang-rename] speedup RenamingAction

The complexity of renaming a USR is O(N) [N stands for number of nodes in
Translation Unit]. In some cases there are more than one USR for a single symbol
(see overridden functions and ctor/dtor handling), which means that the
complexity of finding all of the corresponding USRs is O(N * M) [M stands for
number of USRs corresponding to the symbols, which may be not quite small]. With
a simple tweak we can make it O(N * log(M)) by passing whole list of USRs
corresponding to the symbol to USRLocFinder.

llvm-svn: 277131

8 years agoFixed MSVC out of range shift warning
Simon Pilgrim [Fri, 29 Jul 2016 10:03:39 +0000 (10:03 +0000)]
Fixed MSVC out of range shift warning

llvm-svn: 277130

8 years agoFix for commit rL277126 that broke a build.
Sjoerd Meijer [Fri, 29 Jul 2016 09:57:37 +0000 (09:57 +0000)]
Fix for commit rL277126 that broke a build.

llvm-svn: 277129

8 years ago[Thumb] Emit Thumb move in both Thumb modes for struct_byval predicates
Prakhar Bahuguna [Fri, 29 Jul 2016 09:16:46 +0000 (09:16 +0000)]
[Thumb] Emit Thumb move in both Thumb modes for struct_byval predicates

Summary:
The MOV/MOVT instructions being chosen for struct_byval predicates was
conditional only on Thumb2, resulting in an ARM MOV/MOVT instruction
being incorrectly emitted in Thumb1 mode. This is especially apparent
with v8-m.base targets. This patch ensures that Thumb instructions are
emitted in both Thumb modes.

Reviewers: rengolin, t.p.northover

Subscribers: llvm-commits, aemerson, rengolin

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

llvm-svn: 277128

8 years ago[lanai] Update for Target API (TargetRegistry::RegisterMCAsmBackend) change
Jacques Pienaar [Fri, 29 Jul 2016 08:50:23 +0000 (08:50 +0000)]
[lanai] Update for Target API (TargetRegistry::RegisterMCAsmBackend) change

llvm-svn: 277127

8 years agoTargetInstrInfo: add virtual function getInstSizeInBytes
Sjoerd Meijer [Fri, 29 Jul 2016 08:16:16 +0000 (08:16 +0000)]
TargetInstrInfo: add virtual function getInstSizeInBytes

This adds a target hook getInstSizeInBytes to TargetInstrInfo that a lot of
subclasses already implement.

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

llvm-svn: 277126

8 years agoImprove code of loading plugins that provide cmnds
Abhishek Aggarwal [Fri, 29 Jul 2016 07:46:32 +0000 (07:46 +0000)]
Improve code of loading plugins that provide cmnds

Summary:
 - Modified code that enables writing new user-defined commands
   and use them through LLDB CLI. Modifications are:

  -- Define the 'syntax' for each user-defined command
    --- Added an argument in SBCommandInterpreter::AddCommand()
        and SBCommand::AddCommand() API
    --- Allow passing syntax for each user-defined command
    --- Earlier, only 'help' could be defined and passed for commands

  -- Passed 'number of arguments' entered on CLI for user-defined commands
    --- Added an argument (number of options) in SBCommandPluginInterface::DoExecute()
        API to know the number of arguments passed for commands

  -- In CommandPluginInterfaceImplementation class:
    --- Make the data member m_backend a shared_ptr
    --- Avoids memory leaks of dynamically allocated SBCommandPluginInterface instances
        created in lldb::PluginInitialize() API

Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>
Reviewers: jingham, granata.enrico, clayborg

Subscribers: labath, lldb-commits

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

llvm-svn: 277125

8 years ago[compiler-rt][XRay] Address follow-up comments to initial interface and initialisatio...
Dean Michael Berris [Fri, 29 Jul 2016 07:11:58 +0000 (07:11 +0000)]
[compiler-rt][XRay] Address follow-up comments to initial interface and initialisation code

This addresses some comments from D21612, which contains the following changes:

- Update __xray_patch() and __xray_unpatch() API documentation to not imply asynchrony.
- Introduce a scope cleanup mechanism to make sure we can roll-back changes to the XRayPatching global atomic.
- Introduce a few more comments for potential extension points for other platforms (for the implementation details of patching and un-patching).

Reviewers: eugenis, rnk, kcc, echristo, majnemer

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 277124

8 years agoPlatformDarwinKernel maintains a list of kexts and kernels
Jason Molenda [Fri, 29 Jul 2016 06:24:03 +0000 (06:24 +0000)]
PlatformDarwinKernel maintains a list of kexts and kernels
that it finds on the local computer in "well known" locations
when we start up the darwin-kernel platform.  It did not
distinguish between kexts/kernels with dSYMs from others -
when it needed a kernel/kext with a given UUID, it would grab
the first one it finds.

This change separates these into two vectors -- a collection
of kexts and kernels with dSYMs next t othem, and a collection
of kexts and kernels without dSYMs.  When we have a bundle ID
and uuid to search for, we first try the collections with
dSYMs, and if that fails, then we try the collections that
did not have dSYMs next to them.

Often times we'll have a situation where a kext will be
installed in multiple locations on a system, but only one
of them will have a dSYM next to it, where the dev just copied
it to a local directory.  This fixes that problem, giving
precedence to those binaries with debug information.

llvm-svn: 277123

8 years agoRemove `continue` at end of a for-loop.
Rui Ueyama [Fri, 29 Jul 2016 06:21:06 +0000 (06:21 +0000)]
Remove `continue` at end of a for-loop.

llvm-svn: 277122

8 years agoSplit readOutputSectionDescription.
Rui Ueyama [Fri, 29 Jul 2016 06:14:07 +0000 (06:14 +0000)]
Split readOutputSectionDescription.

llvm-svn: 277121

8 years ago[AVX512] Mark EVEX VMOVSSrm and VMOVSDrm as canFoldAsLoad and isReMaterializable.
Craig Topper [Fri, 29 Jul 2016 06:06:04 +0000 (06:06 +0000)]
[AVX512] Mark EVEX VMOVSSrm and VMOVSDrm as canFoldAsLoad and isReMaterializable.

llvm-svn: 277120

8 years ago[AVX512] Copy the patterns that recognize scalar arimetic operations inserting into...
Craig Topper [Fri, 29 Jul 2016 06:06:00 +0000 (06:06 +0000)]
[AVX512] Copy the patterns that recognize scalar arimetic operations inserting into the lower element of a packed vector from AVX/SSE so that we can use EVEX encoded instructions.

llvm-svn: 277119

8 years ago[AVX512] Add AVX512 run lines to some tests for scalar fma/add/sub/mul/div and regene...
Craig Topper [Fri, 29 Jul 2016 06:05:58 +0000 (06:05 +0000)]
[AVX512] Add AVX512 run lines to some tests for scalar fma/add/sub/mul/div and regenerate. Follow up commits will bring AVX512 code up to the same quality as AVX/SSE.

llvm-svn: 277118

8 years agoFix -break-insert not working when using absolute paths (MI)
Ilia K [Fri, 29 Jul 2016 06:01:20 +0000 (06:01 +0000)]
Fix -break-insert not working when using absolute paths (MI)

Summary:
When trying to parse the -break-insert arguments as a named location, the string parsing was not configured to allow directory paths. This patch adds a constructor to allow the parsing of string as directory path along with the other parameters.

This fixes https://llvm.org/bugs/show_bug.cgi?id=28709

Patch from malaperle@gmail.com
Reviewers: clayborg, ki.stfu
Subscribers: lldb-commits, ki.stfu
Differential Revision: https://reviews.llvm.org/D22902

llvm-svn: 277117

8 years agoAdd comments.
Rui Ueyama [Fri, 29 Jul 2016 05:52:33 +0000 (05:52 +0000)]
Add comments.

llvm-svn: 277116

8 years agoRemove `Ignore` flag from SymbolAssignment class.
Rui Ueyama [Fri, 29 Jul 2016 05:48:39 +0000 (05:48 +0000)]
Remove `Ignore` flag from SymbolAssignment class.

Previously, Ignore flag is set if we don't want to assign
a value to symbols. It happens if a symbol assingment is in
PROVIDE() and there's already a symbol with the same name.

The previous code had a subtle but that we assume that the
existing symbol is an absolute symbol even if it is not.
This patch fixes the issue by always overwriting an absolute
symbol.

llvm-svn: 277115

8 years ago[EarlyCSE] Correctly handle simplified, but live, instructions
David Majnemer [Fri, 29 Jul 2016 05:39:21 +0000 (05:39 +0000)]
[EarlyCSE] Correctly handle simplified, but live, instructions

Some instructions may have their uses replaced with a symbolic constant.
However, the instruction may still have side effects which percludes it
from being removed from the function.  EarlyCSE treated such an
instruction as if it were removed, resulting in PR28763.

llvm-svn: 277114

8 years ago[Typo police] s/proccess/process/, s/auxiliary/auxilliary/.
Justin Lebar [Fri, 29 Jul 2016 05:26:58 +0000 (05:26 +0000)]
[Typo police] s/proccess/process/, s/auxiliary/auxilliary/.

llvm-svn: 277113

8 years ago[ELF] Allow arbitrary code alignment in .eh_frame
Petr Hosek [Fri, 29 Jul 2016 04:41:38 +0000 (04:41 +0000)]
[ELF] Allow arbitrary code alignment in .eh_frame

According to the specification, CIE code alignment factor is an
arbitrary unsigned LEB128 encoded value.

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

llvm-svn: 277105

8 years ago[ConstantFolding] Fold bitcasts of vectors w/ undef elements
David Majnemer [Fri, 29 Jul 2016 04:06:09 +0000 (04:06 +0000)]
[ConstantFolding] Fold bitcasts of vectors w/ undef elements

An undef vector element can be treated as if it had any value.  Folding
such a vector element to 0 in a bitcast can open up further folding
opportunities.

llvm-svn: 277104

8 years agoRemove dependency to SymbolTable from CommonInputSection.
Rui Ueyama [Fri, 29 Jul 2016 03:39:44 +0000 (03:39 +0000)]
Remove dependency to SymbolTable from CommonInputSection.

llvm-svn: 277103

8 years agoRename DoLayout -> HasContents. NFC.
Rui Ueyama [Fri, 29 Jul 2016 03:31:09 +0000 (03:31 +0000)]
Rename DoLayout -> HasContents. NFC.

llvm-svn: 277102

8 years ago[ConstantFolding] Remove an unused ConstantFoldInstOperands overload
David Majnemer [Fri, 29 Jul 2016 03:27:33 +0000 (03:27 +0000)]
[ConstantFolding] Remove an unused ConstantFoldInstOperands overload

No functional change is intended.

llvm-svn: 277101

8 years ago[ConstantFolding] Use ConstantExpr::getWithOperands
David Majnemer [Fri, 29 Jul 2016 03:27:31 +0000 (03:27 +0000)]
[ConstantFolding] Use ConstantExpr::getWithOperands

ConstantExpr::getWithOperands does much of the hard work that
ConstantFoldInstOperandsImpl tries to do but more completely.

This lets us fold ExtractValue/InsertValue expressions.

llvm-svn: 277100

8 years ago[ConstnatFolding] Teach the folder how to fold ConstantVector
David Majnemer [Fri, 29 Jul 2016 03:27:26 +0000 (03:27 +0000)]
[ConstnatFolding] Teach the folder how to fold ConstantVector

A ConstantVector can have ConstantExpr operands and vice versa.
However, the folder had no ability to fold ConstantVectors which, in
some cases, was an optimization barrier.

Instead, rephrase the folder in terms of Constants instead of
ConstantExprs and teach callers how to deal with failure.

llvm-svn: 277099

8 years ago[AVX512] Remove the intrinsic forms of VMOVSS/VMOVSD. We don't need two different...
Craig Topper [Fri, 29 Jul 2016 02:49:08 +0000 (02:49 +0000)]
[AVX512] Remove the intrinsic forms of VMOVSS/VMOVSD. We don't need two different forms of 'rr' and 'rm'. This matches SSE/AVX.

I'm not convinced the patterns for the rm_Int was correct anyway. It had a tied source that should't exist for the unmasked version. The load form of MOVSS always zeros the most significant bits. I've left the patterns off the masked load instructions as I'm not sure what the correct pattern should be and we don't have any tests currently. Nor do we implement masked scalar load intrinsics in clang currently.

llvm-svn: 277098

8 years ago[clang-tidy] Fixes to modernize-use-emplace
Piotr Padlewski [Fri, 29 Jul 2016 02:10:23 +0000 (02:10 +0000)]
[clang-tidy] Fixes to modernize-use-emplace

Not everything is valid, but it should works for 99.8% cases

https://reviews.llvm.org/D22208

llvm-svn: 277097

8 years ago[CFLAA] Check for pointer types in more places.
George Burgess IV [Fri, 29 Jul 2016 01:23:45 +0000 (01:23 +0000)]
[CFLAA] Check for pointer types in more places.

This patch fixes an assertion that fires when we try to add non-pointer
Values to the CFLGraph. Centralizing the check for whether something
is/isn't a pointer type isn't completely trivial (and, in some cases,
would end up being entirely redundant), but it may be beneficial to do
so if this trips us up more in the future.

Patch by Jia Chen.

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

llvm-svn: 277096

8 years ago[Parser] Fix bug where delayed typo in conditional expression was corrected twice
Erik Pilkington [Fri, 29 Jul 2016 00:55:40 +0000 (00:55 +0000)]
[Parser] Fix bug where delayed typo in conditional expression was corrected twice

Patch by David Tarditi!

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

llvm-svn: 277095

8 years agoChange a test to be less prone to random failures due to
Wolfgang Pieb [Fri, 29 Jul 2016 00:54:13 +0000 (00:54 +0000)]
Change a test to be less prone to random failures due to
unintended matches of label numbers to debug metadata
handles in release builds.

llvm-svn: 277094

8 years agoAdd LLVM_ENABLE_LLD option to use LLD as C/C++ linker.
Eugene Zelenko [Fri, 29 Jul 2016 00:46:13 +0000 (00:46 +0000)]
Add LLVM_ENABLE_LLD option to use LLD as C/C++ linker.

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

llvm-svn: 277093

8 years agoCapture stderr when checking for gold version
Teresa Johnson [Fri, 29 Jul 2016 00:39:56 +0000 (00:39 +0000)]
Capture stderr when checking for gold version

On MacOS the ld version is emitted to stderr, resulting in lots of
messages in the ninja check output.

llvm-svn: 277092

8 years agoFixed comment
Piotr Padlewski [Fri, 29 Jul 2016 00:30:07 +0000 (00:30 +0000)]
Fixed comment

llvm-svn: 277091

8 years agoSimplify. readAssignment never returns a nullptr.
Rui Ueyama [Fri, 29 Jul 2016 00:29:25 +0000 (00:29 +0000)]
Simplify. readAssignment never returns a nullptr.

llvm-svn: 277090

8 years agoAdded ThinLTO inlining statistics
Piotr Padlewski [Fri, 29 Jul 2016 00:27:16 +0000 (00:27 +0000)]
Added ThinLTO inlining statistics

Summary:
copypasta doc of ImportedFunctionsInliningStatistics class
 \brief Calculate and dump ThinLTO specific inliner stats.
 The main statistics are:
 (1) Number of inlined imported functions,
 (2) Number of imported functions inlined into importing module (indirect),
 (3) Number of non imported functions inlined into importing module
 (indirect).
 The difference between first and the second is that first stat counts
 all performed inlines on imported functions, but the second one only the
 functions that have been eventually inlined to a function in the importing
 module (by a chain of inlines). Because llvm uses bottom-up inliner, it is
 possible to e.g. import function `A`, `B` and then inline `B` to `A`,
 and after this `A` might be too big to be inlined into some other function
 that calls it. It calculates this statistic by building graph, where
 the nodes are functions, and edges are performed inlines and then by marking
 the edges starting from not imported function.

 If `Verbose` is set to true, then it also dumps statistics
 per each inlined function, sorted by the greatest inlines count like
 - number of performed inlines
 - number of performed inlines to importing module

Reviewers: eraman, tejohnson, mehdi_amini

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 277089

8 years agoMove the code which knows how to get information about the shared
Jason Molenda [Fri, 29 Jul 2016 00:18:39 +0000 (00:18 +0000)]
Move the code which knows how to get information about the shared
cache from ObjectFileMachO (very wrong place) to the DynamicLoader
plugins (better place).  Not much change to the code itself, although
the old ObjectFileMachO method would try both the new dyld SPI and
reading the dyld_all_image_infos structure.  In the new methods,
I've separated those into the appropriate DynamicLoader plugins.

llvm-svn: 277088

8 years agoRevert "Don't invoke getName() from Function::isIntrinsic().", rL276942.
Justin Lebar [Thu, 28 Jul 2016 23:58:15 +0000 (23:58 +0000)]
Revert "Don't invoke getName() from Function::isIntrinsic().", rL276942.

This broke some out-of-tree AMDGPU tests that relied on the old behavior
wherein isIntrinsic() would return true for any function that starts
with "llvm.".  And in general that change will not play nicely with
out-of-tree backends.

llvm-svn: 277087

8 years ago[sanitizer] Simplify and future-proof maybeMarkSanitizerLibraryCallNoBuiltin().
Evgeniy Stepanov [Thu, 28 Jul 2016 23:45:15 +0000 (23:45 +0000)]
[sanitizer] Simplify and future-proof maybeMarkSanitizerLibraryCallNoBuiltin().

Sanitizers set nobuiltin attribute on certain library functions to
avoid a situation where such function is neither instrumented nor
intercepted.

At the moment the list of interesting functions is hardcoded. This
change replaces it with logic based on
TargetLibraryInfo::hasOptimizedCodegen and the presense of readnone
function attribute (sanitizers are generally interested in memory
behavior of library functions).

This is expected to be a no-op change: the new logic matches exactly
the same set of functions.

r276771 (currently reverted) added mempcpy() to the list, breaking
MSan tests. With this change, r276771 can be safely re-landed.

llvm-svn: 277086

8 years ago[IR] Introduce a non-integral pointer type
Sanjoy Das [Thu, 28 Jul 2016 23:43:38 +0000 (23:43 +0000)]
[IR] Introduce a non-integral pointer type

Summary:
This change adds a `ni` specifier in the `datalayout` string to denote
pointers in some given address spaces as "non-integral", and adds some
typing rules around these special pointers.

Reviewers: majnemer, chandlerc, atrick, dberlin, eli.friedman, tstellarAMD, arsenm

Subscribers: arsenm, mcrosier, llvm-commits

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

llvm-svn: 277085

8 years ago[BPI] Add new LazyBPI analysis
Adam Nemet [Thu, 28 Jul 2016 23:31:12 +0000 (23:31 +0000)]
[BPI] Add new LazyBPI analysis

Summary:
The motivation is the same as in D22141: In order to add the hotness
attribute to optimization remarks we need BFI to be available in all
passes that emit optimization remarks.  BFI depends on BPI so unless we
make this lazy as well we would still compute BPI unconditionally.

The solution is to use the new LazyBPI pass in LazyBFI and only compute
BPI when computation of BFI is requested by the client.

I extended the laziness test using a LoopDistribute test to also cover
BPI.

Reviewers: hfinkel, davidxl

Subscribers: llvm-commits

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

llvm-svn: 277083

8 years ago[docs] Coverage: Reference the new -output-dir option
Vedant Kumar [Thu, 28 Jul 2016 23:22:42 +0000 (23:22 +0000)]
[docs] Coverage: Reference the new -output-dir option

llvm-svn: 277081

8 years ago[docs] Mention some new options in llvm-cov
Vedant Kumar [Thu, 28 Jul 2016 23:18:48 +0000 (23:18 +0000)]
[docs] Mention some new options in llvm-cov

llvm-svn: 277080

8 years ago[asan] Enable the rest of use-after-scope tests
Vitaly Buka [Thu, 28 Jul 2016 23:03:27 +0000 (23:03 +0000)]
[asan] Enable the rest of use-after-scope tests

Summary:
Test where broken because of missing lifetime markers for temps and
because of aggressive optimization which removed markers in some cases.

PR27453

Reviewers: eugenis, kcc

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 277074

8 years agoAMDGPU/SI: Don't handle a loop if there is no loop at all for a terminator BB.
Changpeng Fang [Thu, 28 Jul 2016 23:01:45 +0000 (23:01 +0000)]
AMDGPU/SI: Don't handle a loop if there is no loop at all for a terminator BB.

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

Reviewed by: arsenm

llvm-svn: 277073

8 years agoDo not remove empty lifetime.start/lifetime.end ranges
Vitaly Buka [Thu, 28 Jul 2016 22:59:03 +0000 (22:59 +0000)]
Do not remove empty lifetime.start/lifetime.end ranges

Summary:
Asan stack-use-after-scope check should poison alloca even if there is
no access between start and end.

This is possible for code like this:
for (int i = 0; i < 3; i++) {
  int x;
  p = &x;
}

"Loop Invariant Code Motion" will move "p = &x;" out of the loop, making
start/end range empty.

PR27453

Reviewers: eugenis

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

llvm-svn: 277072

8 years agoShould be committed as one CL.
Vitaly Buka [Thu, 28 Jul 2016 22:59:01 +0000 (22:59 +0000)]
Should be committed as one CL.

This reverts commits r277068 r277067 r277066.

llvm-svn: 277071

8 years agoRevert "[ObjC] Consider availability of context when emitting availability warnings"
Erik Pilkington [Thu, 28 Jul 2016 22:51:11 +0000 (22:51 +0000)]
Revert "[ObjC] Consider availability of context when emitting availability warnings"

Reverting r277058, while I fugure out why it broke internal bots.

This reverts commit e514ffa8b657416c6784bbe6da9f5de19365103d.

llvm-svn: 277070

8 years ago[asan] Add const into few methods
Vitaly Buka [Thu, 28 Jul 2016 22:50:50 +0000 (22:50 +0000)]
[asan] Add const into few methods

Summary: No functional changes

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 277069

8 years agoDo not remove empty lifetime.start/lifetime.end ranges
Vitaly Buka [Thu, 28 Jul 2016 22:50:48 +0000 (22:50 +0000)]
Do not remove empty lifetime.start/lifetime.end ranges

Summary:
Asan stack-use-after-scope check should poison alloca even if there is
no access between start and end.

This is possible for code like this:
for (int i = 0; i < 3; i++) {
  int x;
  p = &x;
}

"Loop Invariant Code Motion" will move "p = &x;" out of the loop, making
start/end range empty.

PR27453

Reviewers: eugenis

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

llvm-svn: 277068

8 years agomaned
Vitaly Buka [Thu, 28 Jul 2016 22:50:45 +0000 (22:50 +0000)]
maned

llvm-svn: 277067

8 years agorange
Vitaly Buka [Thu, 28 Jul 2016 22:50:43 +0000 (22:50 +0000)]
range

llvm-svn: 277066

8 years agoSmall refinement on the memory segment support in core files that
Jason Molenda [Thu, 28 Jul 2016 22:43:10 +0000 (22:43 +0000)]
Small refinement on the memory segment support in core files that
Greg added in r272276 -- when working with a non-user-process mach-o
core file, force the permissions to readable + executable, else the
unwinder can stop backtracing early if it gets a pc value in a segment
that it thinks is non-executable.
<rdar://problem/27138456>
<rdar://problem/27462904>

llvm-svn: 277065

8 years ago[CUDA] Unswitch enumerators in the selection of the offloading tool chain.
Samuel Antao [Thu, 28 Jul 2016 22:42:42 +0000 (22:42 +0000)]
[CUDA] Unswitch enumerators in the selection of the offloading tool chain.

llvm-svn: 277064

8 years agoRework CFG simplification in bugpoint
Daniel Berlin [Thu, 28 Jul 2016 22:29:25 +0000 (22:29 +0000)]
Rework CFG simplification in bugpoint

Summary:
Depends on D22841

We now use a much simpler CFG simplification routine for bugpoint,
because SimplifyCFG is no longer a good match for what bugpoint wants
to do.

At the same time, to make sure we don't lose anything valuable it was doing,
SimplifyCFG is now run as a per-BB reduction pass.

With this and D22841 combined, bugpoint operates both much faster on
the large testcases i have, and reduces them to pretty much minimal
testcases (in one case, bugpoint used to leave about 6000 useless blocks, and
now it leaves 3 ...)

Reviewers: chandlerc, majnemer

Subscribers: llvm-commits

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

llvm-svn: 277063

8 years ago[ELF] - Removed excessive check. NFC.
George Rimar [Thu, 28 Jul 2016 22:15:44 +0000 (22:15 +0000)]
[ELF] - Removed excessive check. NFC.

Thanks to Rui Ueyama who noticed that.

llvm-svn: 277062

8 years agoRemove a duplicated block in cmake.
Stephane Sezer [Thu, 28 Jul 2016 22:11:54 +0000 (22:11 +0000)]
Remove a duplicated block in cmake.

Summary:
This is supposed to find the python lib dir and seems like it's just
been copied twice by mistake.

Reviewers: tfiala

Subscribers: lldb-commits

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

llvm-svn: 277060

8 years ago[ELF] - Attempt to fix BB after 277042.
George Rimar [Thu, 28 Jul 2016 22:10:50 +0000 (22:10 +0000)]
[ELF] - Attempt to fix BB after 277042.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/17294
Change:
std::make_unique -> llvm::make_unique

llvm-svn: 277059

8 years ago[ObjC] Consider availability of context when emitting availability warnings
Erik Pilkington [Thu, 28 Jul 2016 22:09:53 +0000 (22:09 +0000)]
[ObjC] Consider availability of context when emitting availability warnings

This means that a function marked with an availability attribute can safely
refer to a declaration that is greater than the deployment target, but less then
or equal to the context availability without -Wpartial-availability firing.

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

llvm-svn: 277058

8 years ago[PM] Port LowerGuardIntrinsic to the new PM.
Michael Kuperstein [Thu, 28 Jul 2016 22:08:41 +0000 (22:08 +0000)]
[PM] Port LowerGuardIntrinsic to the new PM.

llvm-svn: 277057

8 years ago[ELF] - Cosmetic change. NFC.
George Rimar [Thu, 28 Jul 2016 22:01:56 +0000 (22:01 +0000)]
[ELF] - Cosmetic change. NFC.

peek()[0] == '*' changed to peek().startswith("*")

llvm-svn: 277043

8 years ago[ELF] - Linkerscript: implemented filename specification.
George Rimar [Thu, 28 Jul 2016 21:51:30 +0000 (21:51 +0000)]
[ELF] - Linkerscript: implemented filename specification.

Scripts can contain something like:
KEEP (*crtbegin.o(.ctors))

What means that "*crtbegin.o" is a wildcard of file to take the sections from.
This is some kind of opposite to EXCLUDE_FILE and used in FreeBSD script:
https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l122

Patch implements this.

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

llvm-svn: 277042

8 years agoFix some sign compare warnings breaking the -Werror build
David Blaikie [Thu, 28 Jul 2016 21:42:12 +0000 (21:42 +0000)]
Fix some sign compare warnings breaking the -Werror build

llvm-svn: 277040

8 years agoRevert r277038 until clearing why tests fail.
Alina Sbirlea [Thu, 28 Jul 2016 21:35:20 +0000 (21:35 +0000)]
Revert r277038 until clearing why tests fail.

llvm-svn: 277039

8 years agoRemove TargetBaseAlign. Keep alignment for stack adjustments.
Alina Sbirlea [Thu, 28 Jul 2016 21:26:40 +0000 (21:26 +0000)]
Remove TargetBaseAlign. Keep alignment for stack adjustments.

Summary:
TargetBaseAlign is no longer required since LSV checks if target allows misaligned accesses.
A constant defining a base alignment is still needed for stack accesses where alignment can be adjusted.

Reviewers: llvm-commits, jlebar

Subscribers: mzolotukhin, arsenm

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

llvm-svn: 277038

8 years agoReally try to pacify the build bots :/
David Majnemer [Thu, 28 Jul 2016 21:22:31 +0000 (21:22 +0000)]
Really try to pacify the build bots :/

llvm-svn: 277037

8 years agoTry to passify the builders
David Majnemer [Thu, 28 Jul 2016 21:16:51 +0000 (21:16 +0000)]
Try to passify the builders

llvm-svn: 277036

8 years ago[ELF] - Linkerscript: implemented += operator.
George Rimar [Thu, 28 Jul 2016 21:08:56 +0000 (21:08 +0000)]
[ELF] - Linkerscript: implemented += operator.

Sometimes += is used to move the location counter.
Example from the wild is:

.dbg_excpt _DBG_EXCPT_ADDR (NOLOAD) :
{
  . += (DEFINED (_DEBUGGER) ? 0x8 : 0x0);
https://github.com/chipKIT32/pic32-Arduino-USB-Bootloader-original/blob/master/boot-linkerscript.ld

Patch implements it and opens way for others type of assignments (-= *= etc), though I think only += is
actual to support.

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

llvm-svn: 277035

8 years agoMake CommonInputSection singleton class.
Rui Ueyama [Thu, 28 Jul 2016 21:05:04 +0000 (21:05 +0000)]
Make CommonInputSection singleton class.

All other singleton instances are accessible globally.
CommonInputSection shouldn't be an exception.

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

llvm-svn: 277034

8 years ago[coroutines] Part 3 of N: Adding Boilerplate for Coroutine Passes
David Majnemer [Thu, 28 Jul 2016 21:04:31 +0000 (21:04 +0000)]
[coroutines] Part 3 of N: Adding Boilerplate for Coroutine Passes

This adds boilerplate code for all coroutine passes,
the passes are no-ops for now.
Also, a small test has been added to verify that passes execute in
the expected order or not at all if coroutine support is disabled.

Patch by Gor Nishanov!

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

llvm-svn: 277033