platform/upstream/llvm.git
8 years ago[AArch64] Define AArch64RegisterInfo as a class, not a struct. NFC.
Ahmed Bougacha [Wed, 27 Jul 2016 14:31:40 +0000 (14:31 +0000)]
[AArch64] Define AArch64RegisterInfo as a class, not a struct. NFC.

llvm-svn: 276873

8 years agoGlobalISel: remove variable_ops from output list.
Tim Northover [Wed, 27 Jul 2016 14:30:49 +0000 (14:30 +0000)]
GlobalISel: remove variable_ops from output list.

The instance in the input operand list allows both inputs and outputs,
but the one in (outs) is not treated specially which leads to the
MachineVerifier invoking UB (looking at an invalid MCInstrDesc field).

No functional change except in UBSan builds (maybe, who knows!), where
it fixes the legalize-add.mir test.

llvm-svn: 276872

8 years agofix typo in clang-rename and clang-tidy docs
Kirill Bobyrev [Wed, 27 Jul 2016 14:26:03 +0000 (14:26 +0000)]
fix typo in clang-rename and clang-tidy docs

llvm-svn: 276871

8 years agochange Vim key binding for include-fixer and clang-rename
Kirill Bobyrev [Wed, 27 Jul 2016 14:23:47 +0000 (14:23 +0000)]
change Vim key binding for include-fixer and clang-rename

Change Vim key binding for include-fixer (`,cf` -> `<leader>cf`) and
clang-rename (`,cr` -> `<leader>cr`) to use `<leader>` instead of `,` like
cool Vim people (tm) do.

Reviewers: ioeric

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

llvm-svn: 276870

8 years ago[ARM] Pass thumb as architecture to the underlying tools, when targeting windows
Renato Golin [Wed, 27 Jul 2016 14:12:20 +0000 (14:12 +0000)]
[ARM] Pass thumb as architecture to the underlying tools, when targeting windows

This makes sure that the thumb section flag gets set by the assembler.

Patch by Martin Storsjö.

llvm-svn: 276869

8 years agoMake toPhdrFlags a member function. NFC.
Rafael Espindola [Wed, 27 Jul 2016 14:10:56 +0000 (14:10 +0000)]
Make toPhdrFlags a member function. NFC.

llvm-svn: 276868

8 years ago[mips][ias] Check '$rs = $rd' constraints when both registers are in AsmText.
Daniel Sanders [Wed, 27 Jul 2016 13:49:44 +0000 (13:49 +0000)]
[mips][ias] Check '$rs = $rd' constraints when both registers are in AsmText.

Summary:
This is one possible solution to the problem of ignoring constraints that Simon
raised in D21473 but it's a bit of a hack.

The integrated assembler currently ignores violations of the tied register
constraints when the operands involved in a tie are both present in the AsmText.
For example, 'dati $rs, $rt, $imm' with the '$rs = $rt' will silently replace
$rt with $rs. So 'dati $2, $3, 1' is processed as if the user provided
'dati $2, $2, 1' without any diagnostic being emitted.

This is difficult to solve properly because there are multiple parts of the
matcher that are silently forcing these constraints to be met. Tied operands are
rendered to instructions by cloning previously rendered operands but this is
unnecessary because the matcher was already instructed to render the operand it
would have cloned. This is also unnecessary because earlier code has already
replaced the MCParsedOperand with the one it was tied to (so the parsed input
is matched as if it were 'dati <RegIdx 2>, <RegIdx 2>, <Imm 1>'). As a result,
it looks like fixing this properly amounts to a rewrite of the tied operand
handling which affects all targets.

This patch however, merely inserts a checking hook just before the
substitution of MCParsedOperands and the Mips target overrides it. It's not
possible to accurately check the registers are the same this early (because
numeric registers haven't been bound to a register class yet) so it cheats a
bit and checks that the tokens that produced the operand are lexically
identical. This works because tied registers need to have the same register
class but it does have a flaw. It will reject 'dati $4, $a0, 1' for violating
the constraint even though $a0 ends up as the same register as $4.

Reviewers: sdardis

Subscribers: dsanders, llvm-commits, sdardis

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

llvm-svn: 276867

8 years ago[clang-rename] skip CXXConversionDecl while searching for NamedDecl
Kirill Bobyrev [Wed, 27 Jul 2016 13:37:22 +0000 (13:37 +0000)]
[clang-rename] skip CXXConversionDecl while searching for NamedDecl

llvm-svn: 276866

8 years ago[PowerPC] Fix typo in PPCHazardRecognizers.cpp
Nemanja Ivanovic [Wed, 27 Jul 2016 13:24:54 +0000 (13:24 +0000)]
[PowerPC] Fix typo in PPCHazardRecognizers.cpp

Fixes PR28731.

llvm-svn: 276865

8 years agoPowerPC: Avoid implicit iterator conversions, NFC
Duncan P. N. Exon Smith [Wed, 27 Jul 2016 13:24:16 +0000 (13:24 +0000)]
PowerPC: Avoid implicit iterator conversions, NFC

Avoid implicit conversions from MachineInstrBundleIterator to
MachineInstr* in the PowerPC backend, mainly by preferring MachineInstr&
over MachineInstr* when a pointer isn't nullable and using range-based
for loops.

There was one piece of questionable code in PPCInstrInfo::AnalyzeBranch,
where a condition checked a pointer converted from an iterator for
nullptr.  Since this case is impossible (moreover, the code above
guarantees that the iterator is valid), I removed the check when I
changed the pointer to a reference.

Despite that case, there should be no functionality change here.

llvm-svn: 276864

8 years agoGPGPU: Add basic support for kernel launches
Tobias Grosser [Wed, 27 Jul 2016 13:20:16 +0000 (13:20 +0000)]
GPGPU: Add basic support for kernel launches

llvm-svn: 276863

8 years ago[include-fixer] Update document.
Haojian Wu [Wed, 27 Jul 2016 13:17:16 +0000 (13:17 +0000)]
[include-fixer] Update document.

llvm-svn: 276862

8 years ago[clang-tidy] Add cppcoreguidelines-slicing entry to list.rst.
Haojian Wu [Wed, 27 Jul 2016 13:11:50 +0000 (13:11 +0000)]
[clang-tidy] Add cppcoreguidelines-slicing entry to list.rst.

llvm-svn: 276861

8 years ago[test/gold] Add gold test subdirectory tests needing v1.12 (or higher)
Teresa Johnson [Wed, 27 Jul 2016 12:59:51 +0000 (12:59 +0000)]
[test/gold] Add gold test subdirectory tests needing v1.12 (or higher)

Summary:
As discussed in the review for D22677, added a subdirectory to
enable tests that require at least version 1.12 of gold.

Add an initial test requiring this version.

Reviewers: davidxl, mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 276860

8 years ago[ARM] Set a non-conflicting comment character for assembly in MSVC mode
Renato Golin [Wed, 27 Jul 2016 12:31:58 +0000 (12:31 +0000)]
[ARM] Set a non-conflicting comment character for assembly in MSVC mode

Currently, for ARMCOFFMCAsmInfoMicrosoft, no comment character is set, thus the
idefault, '#', is used.

The hash character doesn't work as comment character in ARM assembly, since '#'
is used for immediate values.

The comment character is set to ';', which is the comment character used by MS
armasm.exe. (The microsoft armasm.exe uses a different directive syntax than
what LLVM currently supports though, similar to ARM's armasm.)

This allows inline assembly with immediate constants to be built (and brings the
assembly output from clang -S closer to being possible to assemble).

A test is added that verifies that ';' is correctly interpreted as comments in
this mode, and verifies that assembling code that includes literal constants
with a '#' works.

Patch by Martin Storsjö.

llvm-svn: 276859

8 years ago[ARM] Adds test for immediate encoding
Renato Golin [Wed, 27 Jul 2016 12:15:26 +0000 (12:15 +0000)]
[ARM] Adds test for immediate encoding

The encoding of expressions as immediates wasn't correct, and was reported in
PR23000. However, we have done some refactoring on how immediates are handled
and now it seems the problem is fixed. This is a test just to make sure it
won't regress again.

llvm-svn: 276858

8 years agoRevert r276856 "Adjust Registry interface to not require plugins to export a registry"
John Brawn [Wed, 27 Jul 2016 11:41:18 +0000 (11:41 +0000)]
Revert r276856 "Adjust Registry interface to not require plugins to export a registry"

This is causing a huge pile of buildbot failures.

llvm-svn: 276857

8 years agoAdjust Registry interface to not require plugins to export a registry
John Brawn [Wed, 27 Jul 2016 11:18:38 +0000 (11:18 +0000)]
Adjust Registry interface to not require plugins to export a registry

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.

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

llvm-svn: 276856

8 years ago[DAGCombiner] Use APInt directly to detect out of range shift constants
Simon Pilgrim [Wed, 27 Jul 2016 10:30:55 +0000 (10:30 +0000)]
[DAGCombiner] Use APInt directly to detect out of range shift constants

Using getZExtValue() will assert if the value doesn't fit into uint64_t - SHL was already doing this, I've just updated ASHR/LSHR to match

As mentioned on D22726

llvm-svn: 276855

8 years agoclang-format: Fix incorrect detection of QT-signals access specifier.
Daniel Jasper [Wed, 27 Jul 2016 10:13:24 +0000 (10:13 +0000)]
clang-format: Fix incorrect detection of QT-signals access specifier.

Before:
  void f() {
  label:
    signals
    .baz();
  }

After:
  void f() {
  label:
    signals.baz();
  }

llvm-svn: 276854

8 years ago[clang-include-fixer] Added Emacs integration for clang-include-fixer.
Benjamin Kramer [Wed, 27 Jul 2016 10:11:06 +0000 (10:11 +0000)]
[clang-include-fixer] Added Emacs integration for clang-include-fixer.

Patch by Jens Massberg! Thanks a lot.

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

llvm-svn: 276853

8 years agoRemoved unusued template function declaration that has no definition - fixes MSVC...
Simon Pilgrim [Wed, 27 Jul 2016 10:11:05 +0000 (10:11 +0000)]
Removed unusued template function declaration that has no definition - fixes MSVC warning.

llvm-svn: 276852

8 years ago[ARM] Pass -mimplcit-it= to integrated assembler
Oliver Stannard [Wed, 27 Jul 2016 08:54:13 +0000 (08:54 +0000)]
[ARM] Pass -mimplcit-it= to integrated assembler

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

llvm-svn: 276851

8 years ago[mips] Update the link to the MIPS documentation in CompilerWriterInfo.rst.
Daniel Sanders [Wed, 27 Jul 2016 08:52:15 +0000 (08:52 +0000)]
[mips] Update the link to the MIPS documentation in CompilerWriterInfo.rst.

llvm-svn: 276850

8 years ago[MBP] Added some more debug messages and some clean ups /NFC
Sjoerd Meijer [Wed, 27 Jul 2016 08:49:23 +0000 (08:49 +0000)]
[MBP] Added some more debug messages and some clean ups /NFC

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

llvm-svn: 276849

8 years agoSupport setting default value for -rtlib at build time
Jonas Hahnfeld [Wed, 27 Jul 2016 08:15:54 +0000 (08:15 +0000)]
Support setting default value for -rtlib at build time

This patch introduces a new cmake variable: CLANG_DEFAULT_RTLIB, thru
which we can specify a default value for -rtlib (libgcc or
compiler-rt) at build time, just like how we set the default C++
stdlib thru CLANG_DEFAULT_CXX_STDLIB.

With these two options, we can configure clang to build binaries on
Linux that have no runtime dependence on any gcc libs (libstdc++ or
libgcc_s).

Patch by Lei Zhang!

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

llvm-svn: 276848

8 years agoRevert "Default COMPILER_RT_BUILD_XRAY=ON"
Dean Michael Berris [Wed, 27 Jul 2016 08:10:04 +0000 (08:10 +0000)]
Revert "Default COMPILER_RT_BUILD_XRAY=ON"

This reverts commit 23240d8de38c79220a888f645a1f4b686bfb87c6.

Broke the build because the build bots haven't gotten the latest config
from zorg yet.

llvm-svn: 276847

8 years agoRefactor - CodeExtractor : Move check for valid block to static utility
Sean Silva [Wed, 27 Jul 2016 08:02:46 +0000 (08:02 +0000)]
Refactor - CodeExtractor : Move check for valid block to static utility

This lets you actually check to see if a block is valid before trying to
extract.

Patch by River Riddle!

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

llvm-svn: 276846

8 years agoDefault COMPILER_RT_BUILD_XRAY=ON
Dean Michael Berris [Wed, 27 Jul 2016 07:27:35 +0000 (07:27 +0000)]
Default COMPILER_RT_BUILD_XRAY=ON

llvm-svn: 276845

8 years ago[GVNHoist] Fix typo in assert.
George Burgess IV [Wed, 27 Jul 2016 06:34:53 +0000 (06:34 +0000)]
[GVNHoist] Fix typo in assert.

This fixes PR28730.

llvm-svn: 276844

8 years agoFix Coroutines doc example
Mehdi Amini [Wed, 27 Jul 2016 06:03:47 +0000 (06:03 +0000)]
Fix Coroutines doc example

SSA was broken.

llvm-svn: 276843

8 years ago[MC] Add command-line option to choose the max nest level in asm macros.
Davide Italiano [Wed, 27 Jul 2016 05:51:56 +0000 (05:51 +0000)]
[MC] Add command-line option to choose the max nest level in asm macros.

Submitted by: t83wCSLq
Differential Revision:  https://reviews.llvm.org/D22313

llvm-svn: 276842

8 years agoGVN-hoist: improve code generation for recursive GEPs
Sebastian Pop [Wed, 27 Jul 2016 05:48:12 +0000 (05:48 +0000)]
GVN-hoist: improve code generation for recursive GEPs

When loading or storing in a field of a struct like "a.b.c", GVN is able to
detect the equivalent expressions, and GVN-hoist would fail in the code
generation.  This is because the GEPs are not hoisted as scalar operations to
avoid moving the GEPs too far from their ld/st instruction when the ld/st is not
movable.  So we end up having to generate code for the GEP of a ld/st when we
move the ld/st.  In the case of a GEP referring to another GEP as in "a.b.c" we
need to code generate all the GEPs necessary to make all the operands available
at the new location for the ld/st.  With this patch we recursively walk through
the GEP operands checking whether all operands are available, and in the case of
a GEP operand, it recursively makes all its operands available. Code generation
happens from the inner GEPs out until reaching the GEP that appears as an
operand of the ld/st.

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

llvm-svn: 276841

8 years agoGVN-hoist: use DFS numbers instead of walking the instruction stream
Sebastian Pop [Wed, 27 Jul 2016 05:13:52 +0000 (05:13 +0000)]
GVN-hoist: use DFS numbers instead of walking the instruction stream

The patch replaces a function that walks the IR with a call to firstInBB() that
uses the DFS numbering.  NFC.

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

llvm-svn: 276840

8 years ago[coroutines] Part 2 of N: Adding Coroutine Intrinsics
David Majnemer [Wed, 27 Jul 2016 05:12:35 +0000 (05:12 +0000)]
[coroutines] Part 2 of N: Adding Coroutine Intrinsics

This is the second patch in the coroutine series. It adds coroutine
intrinsics and updates intrinsic cost in TargetTransformInfoImpl.h.

Patch by Gor Nishanov!

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

llvm-svn: 276839

8 years agoadd a verbose mode to Loop->print() to print all the basic blocks of a loop
Sebastian Pop [Wed, 27 Jul 2016 05:02:17 +0000 (05:02 +0000)]
add a verbose mode to Loop->print() to print all the basic blocks of a loop

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

llvm-svn: 276838

8 years agoadd function isLoopLatch
Sebastian Pop [Wed, 27 Jul 2016 05:02:15 +0000 (05:02 +0000)]
add function isLoopLatch

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

llvm-svn: 276837

8 years agotest: simplify commands, NFC
Saleem Abdulrasool [Wed, 27 Jul 2016 04:43:15 +0000 (04:43 +0000)]
test: simplify commands, NFC

Rather than copying the file and then doing an in-place edit, perform the
replacements to stdout and pass the output to FileCheck directly.  Avoids
unnecessary copying and seds.

llvm-svn: 276836

8 years agorefactor code in verifyLoop: NFC.
Sebastian Pop [Wed, 27 Jul 2016 04:36:06 +0000 (04:36 +0000)]
refactor code in verifyLoop: NFC.

Use std::any_of as requested in https://reviews.llvm.org/D22816

llvm-svn: 276835

8 years agoUse RAII for ensuring that mprotect calls are undone
Dean Michael Berris [Wed, 27 Jul 2016 04:30:25 +0000 (04:30 +0000)]
Use RAII for ensuring that mprotect calls are undone

Summary: This fixes an mprotect leak identified in D21612.

Reviewers: echristo, rSerge

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 276833

8 years ago[llvm-cov] Escape '\' in strings when emitting JSON
Vedant Kumar [Wed, 27 Jul 2016 04:08:32 +0000 (04:08 +0000)]
[llvm-cov] Escape '\' in strings when emitting JSON

Test that Windows path separators are escaped properly. Add a round-trip
test to verify the JSON produced by the exporter.

llvm-svn: 276832

8 years agoFix for compiling with clang <= 3.7 and g++6 headers
Vedant Kumar [Wed, 27 Jul 2016 03:43:34 +0000 (03:43 +0000)]
Fix for compiling with clang <= 3.7 and g++6 headers

Make integers explicitly unsigned, so the tuple constructor will resolve
properly when but with clang 3.6, 3.7 and gcc 6.1.1 libstdc++ headers.

Patch by Frederich Munch!

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

llvm-svn: 276831

8 years agoMove assert as early as possible
Sebastian Pop [Wed, 27 Jul 2016 03:30:11 +0000 (03:30 +0000)]
Move assert as early as possible

Patch written by Aditya Kumar.

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

llvm-svn: 276830

8 years ago[llvm-go] parameterize $GOPATH construction
Andrew Wilkins [Wed, 27 Jul 2016 03:21:51 +0000 (03:21 +0000)]
[llvm-go] parameterize $GOPATH construction

Summary:
To build llgo, you must currently ensure that llgo
is in the tools/llgo directory, due to a hard-coded
path in llvm-go.

To support the use of LLVM_EXTERNAL_LLGO_SOURCE_DIR,
we introduce a flag to llvm-go that enables the
caller to specify the paths to symlink in the
temporary $GOPATH.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 276829

8 years ago[llgo] add llgo source path to LLVM_GO_PACKAGES
Andrew Wilkins [Wed, 27 Jul 2016 03:01:00 +0000 (03:01 +0000)]
[llgo] add llgo source path to LLVM_GO_PACKAGES

Summary:
To support the use of LLVM_EXTERNAL_LLGO_SOURCE_DIR,
with llgo situated in a location other than tools/llgo,
we add the llgo source directory to LLVM_GO_PACKAGES.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 276828

8 years ago[ConstantFolding] Correctly handle failures in ConstantFoldConstantExpressionImpl
David Majnemer [Wed, 27 Jul 2016 02:39:16 +0000 (02:39 +0000)]
[ConstantFolding] Correctly handle failures in ConstantFoldConstantExpressionImpl

Failures in ConstantFoldConstantExpressionImpl were ignored causing
crashes down the line.

This fixes PR28725.

llvm-svn: 276827

8 years ago[ELF] Support --output. Also output= can take two dashes.
Davide Italiano [Wed, 27 Jul 2016 01:57:15 +0000 (01:57 +0000)]
[ELF] Support --output. Also output= can take two dashes.

llvm-svn: 276826

8 years ago[ELF/LinkerScript] Support EXCLUDE_FILE inside KEEP.
Davide Italiano [Wed, 27 Jul 2016 01:44:01 +0000 (01:44 +0000)]
[ELF/LinkerScript] Support EXCLUDE_FILE inside KEEP.

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

llvm-svn: 276825

8 years agoReverting r276771 due to MSan failures.
Andrew Kaylor [Wed, 27 Jul 2016 01:19:24 +0000 (01:19 +0000)]
Reverting r276771 due to MSan failures.

llvm-svn: 276824

8 years agoAMDGPU: Use rcp for fdiv 1, x with fpmath metadata
Matt Arsenault [Tue, 26 Jul 2016 23:25:44 +0000 (23:25 +0000)]
AMDGPU: Use rcp for fdiv 1, x with fpmath metadata

Using rcp should be OK for safe math usually, so this
should not be replacing the original fdiv.

llvm-svn: 276823

8 years agoRevert r276136 "Use ValueOffsetPair to enhance value reuse during SCEV expansion."
Hans Wennborg [Tue, 26 Jul 2016 23:25:13 +0000 (23:25 +0000)]
Revert r276136 "Use ValueOffsetPair to enhance value reuse during SCEV expansion."

It causes Clang tests to fail after Windows self-host (PR28705).

(Also reverts follow-up r276139.)

llvm-svn: 276822

8 years agoAMDGPU: Add more tests for LDS size with occupancy
Matt Arsenault [Tue, 26 Jul 2016 23:15:59 +0000 (23:15 +0000)]
AMDGPU: Add more tests for LDS size with occupancy

llvm-svn: 276821

8 years ago[docs] Fix a sphinx error in llvm-cov.rst
Vedant Kumar [Tue, 26 Jul 2016 23:09:57 +0000 (23:09 +0000)]
[docs] Fix a sphinx error in llvm-cov.rst

Failing bot:

  http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12025

Fix tested with `ninja docs-llvm-html`.

llvm-svn: 276820

8 years agoAMDGPU: Use implicit_def for selecting anyext
Matt Arsenault [Tue, 26 Jul 2016 23:06:33 +0000 (23:06 +0000)]
AMDGPU: Use implicit_def for selecting anyext

llvm-svn: 276819

8 years agoRetry: [llvm-cov] Add support for exporting coverage data to JSON
Vedant Kumar [Tue, 26 Jul 2016 22:50:58 +0000 (22:50 +0000)]
Retry: [llvm-cov] Add support for exporting coverage data to JSON

This enables users to export coverage information as portable JSON for use by
analysis tools and storage in document based databases.

The export sub-command is invoked just like the others:

  llvm-cov export -instr-profile path/to/foo.profdata path/to/foo.binary

The resulting JSON contains a list of files and functions. Every file object
contains a list of segments, expansions, and a summary of the file's region,
function, and line coverage. Every function object contains the function's name
and regions. There is also a total summary for the entire object file.

Changes since the initial commit (r276813):

  - Fixed the regexes in the tests to handle Windows filepaths.

Patch by Eddie Hurtig!

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

llvm-svn: 276818

8 years agodocs: Add reference to type metadata to langref.
Peter Collingbourne [Tue, 26 Jul 2016 22:31:30 +0000 (22:31 +0000)]
docs: Add reference to type metadata to langref.

llvm-svn: 276817

8 years agoRevert "[llvm-cov] Add support for exporting coverage data to JSON"
Vedant Kumar [Tue, 26 Jul 2016 21:55:39 +0000 (21:55 +0000)]
Revert "[llvm-cov] Add support for exporting coverage data to JSON"

This reverts commit r276813. The Windows bots are complaining about some
of the filename regexes in the tests:

  http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/5299

llvm-svn: 276816

8 years agoMIRParser: Use dot instead of colon to mark subregisters
Matthias Braun [Tue, 26 Jul 2016 21:49:34 +0000 (21:49 +0000)]
MIRParser: Use dot instead of colon to mark subregisters

Change the syntax to use `%0.sub8` to denote a subregister.

This seems like a more natural fit to denote subregisters; I also plan
to introduce a new ":classname" syntax in upcoming patches to denote the
register class of a vreg.

Note that this commit disallows plain identifiers to start with a '.'
character.  This shouldn't affect anything as external names/IR
references are all prefixed with '$'/'%', plain identifiers are only
used for instruction names, register mask names and subreg indexes.

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

llvm-svn: 276815

8 years agoFix LLDBConfig.cmake to enable python enabled build for all 64 bit lldb targets
Omair Javaid [Tue, 26 Jul 2016 21:43:02 +0000 (21:43 +0000)]
Fix LLDBConfig.cmake to enable python enabled build for all 64 bit lldb targets

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

llvm-svn: 276814

8 years ago[llvm-cov] Add support for exporting coverage data to JSON
Vedant Kumar [Tue, 26 Jul 2016 21:35:43 +0000 (21:35 +0000)]
[llvm-cov] Add support for exporting coverage data to JSON

This enables users to export coverage information as portable JSON for use by
analysis tools and storage in document based databases.

The export sub-command is invoked just like the others:

  llvm-cov export -instr-profile path/to/foo.profdata path/to/foo.binary

The resulting JSON contains a list of files and functions. Every file object
contains a list of segments, expansions, and a summary of the file's region,
function, and line coverage. Every function object contains the function's name
and regions. There is also a total summary for the entire object file.

Patch by Eddie Hurtig!

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

llvm-svn: 276813

8 years ago[ELF][MIPS] Attempt to fix Windows buildbot
Simon Atanasyan [Tue, 26 Jul 2016 21:28:34 +0000 (21:28 +0000)]
[ELF][MIPS] Attempt to fix Windows buildbot

llvm-svn: 276812

8 years agoMove code for MIPS from createInputSection to initializeSections.
Rui Ueyama [Tue, 26 Jul 2016 21:26:02 +0000 (21:26 +0000)]
Move code for MIPS from createInputSection to initializeSections.

We already have code for ARM in initializeSections, so this
is more consistent.

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

llvm-svn: 276811

8 years ago[ELF][MIPS] Replace binary test input file by asembler code in the test. NFC
Simon Atanasyan [Tue, 26 Jul 2016 21:11:34 +0000 (21:11 +0000)]
[ELF][MIPS] Replace binary test input file by asembler code in the test.  NFC

llvm-svn: 276809

8 years ago[ELF][MIPS] Do not emit .got section in case of relocatable output
Simon Atanasyan [Tue, 26 Jul 2016 21:11:30 +0000 (21:11 +0000)]
[ELF][MIPS] Do not emit .got section in case of relocatable output

llvm-svn: 276808

8 years ago[ELF][MIPS] Use section type to recognize .reginfo and .MIPS.options sections
Simon Atanasyan [Tue, 26 Jul 2016 21:11:26 +0000 (21:11 +0000)]
[ELF][MIPS] Use section type to recognize .reginfo and .MIPS.options sections

It is faster and more correct method than string comparision.

llvm-svn: 276807

8 years agoFix docs/Coroutines.rst syntax highlighting on Linux
Sanjoy Das [Tue, 26 Jul 2016 21:03:41 +0000 (21:03 +0000)]
Fix docs/Coroutines.rst syntax highlighting on Linux

Summary:
s/code-block:: C++/code-block:: c++ in docs/Coroutines.rst .

Patch by Gor Nishanov!  Edited by Sanjoy to fix a missing s/C/c/.

Reviewers: sanjoy, rengolin

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

llvm-svn: 276806

8 years agoAMDGPU/R600: Remove dead custom inserters
Matt Arsenault [Tue, 26 Jul 2016 21:03:38 +0000 (21:03 +0000)]
AMDGPU/R600: Remove dead custom inserters

The intrinsics for these were removed, so this is dead.

llvm-svn: 276805

8 years agoAMDGPU: Minor AsmPrinter cleanups
Matt Arsenault [Tue, 26 Jul 2016 21:03:36 +0000 (21:03 +0000)]
AMDGPU: Minor AsmPrinter cleanups

llvm-svn: 276804

8 years ago[asan] Remove zero FSR check on ARM.
Evgeniy Stepanov [Tue, 26 Jul 2016 21:02:45 +0000 (21:02 +0000)]
[asan] Remove zero FSR check on ARM.

The kernel on Nexus 5X returns error_code in ucontext which has
correct FSR_WRITE flag, but empty (zero) abort type field. Removing
the checks means that we will report all SEGVs as READ on very old
kernels, but will properly distinguish READ vs WRITE on moderately
old ones.

llvm-svn: 276803

8 years ago[asan] Hardcode page size 4096 on Android.
Evgeniy Stepanov [Tue, 26 Jul 2016 21:02:44 +0000 (21:02 +0000)]
[asan] Hardcode page size 4096 on Android.

EXEC_PAGESIZE lies.
sysconf() is broken in .preinit_array.

llvm-svn: 276802

8 years ago[Hexagon] Post-increment loads/stores enhancements
Krzysztof Parzyszek [Tue, 26 Jul 2016 20:30:30 +0000 (20:30 +0000)]
[Hexagon] Post-increment loads/stores enhancements

- Generate vector post-increment stores more aggressively.
- Predicate post-increment and vector stores in early if-conversion.

llvm-svn: 276800

8 years agoGlobalISel: add generic load and store instructions.
Tim Northover [Tue, 26 Jul 2016 20:23:26 +0000 (20:23 +0000)]
GlobalISel: add generic load and store instructions.

Pretty straightforward, the only oddity is the MachineMemOperand (which it's
surprisingly difficult to share code for).

llvm-svn: 276799

8 years ago[X86] Split out absdiff detection from SAD combine. NFC.
Michael Kuperstein [Tue, 26 Jul 2016 20:01:29 +0000 (20:01 +0000)]
[X86] Split out absdiff detection from SAD combine. NFC.

Preparation for supporting PSADBW emission for straight-line code.

llvm-svn: 276798

8 years agoModules: follow up to r276769.
Manman Ren [Tue, 26 Jul 2016 19:56:12 +0000 (19:56 +0000)]
Modules: follow up to r276769.

In r276769, I forgot to forward the driver option, add that here.

rdar://26675801

llvm-svn: 276797

8 years agoThe ARM single-step handling needs to look for breakpoint on the next instruction.
Jim Ingham [Tue, 26 Jul 2016 19:50:25 +0000 (19:50 +0000)]
The ARM single-step handling needs to look for breakpoint on the next instruction.

<rdar://problem/27006685>

llvm-svn: 276796

8 years agoCheck both private & public states to decide if you need to halt before killing.
Jim Ingham [Tue, 26 Jul 2016 19:47:45 +0000 (19:47 +0000)]
Check both private & public states to decide if you need to halt before killing.

We were just checking the public state, but that meant if you were hung in a long
running hand-called function, we wouldn't know to interrupt the process, and we would
not succeed in killing it.

<rdar://problem/24805082>

llvm-svn: 276795

8 years agoRemove return type that can trivially be inferred.
Rui Ueyama [Tue, 26 Jul 2016 19:34:10 +0000 (19:34 +0000)]
Remove return type that can trivially be inferred.

llvm-svn: 276794

8 years ago[Hexagon] Gracefully handle reg class mismatch in HexagonLoopReschedule
Krzysztof Parzyszek [Tue, 26 Jul 2016 19:17:13 +0000 (19:17 +0000)]
[Hexagon] Gracefully handle reg class mismatch in HexagonLoopReschedule

llvm-svn: 276793

8 years ago[Hexagon] Rerun bit tracker on new instructions in RIE
Krzysztof Parzyszek [Tue, 26 Jul 2016 19:08:45 +0000 (19:08 +0000)]
[Hexagon] Rerun bit tracker on new instructions in RIE

Consider this case:
  vreg1 = A2_zxth vreg0   (1)
  ...
  vreg2 = A2_zxth vreg1   (2)

Redundant instruction elimination could delete the instruction (1)
because the user (2) only cares about the low 16 bits. Then it could
delete (2) because the input is already zero-extended. The problem
is that the properties allowing each individual instruction to be
deleted depend on the existence of the other instruction, so either
one can be deleted, but not both.
The existing check for this situation in RIE was insufficient. The
fix is to update all dependent cells when an instruction is removed
(replaced via COPY) in RIE.

llvm-svn: 276792

8 years ago[analyzer] Hotfix for build failure due to declaration shadowing in r276782.
Artem Dergachev [Tue, 26 Jul 2016 19:05:22 +0000 (19:05 +0000)]
[analyzer] Hotfix for build failure due to declaration shadowing in r276782.

CloneDetector member variable is shadowing the class with the same name,
which causes build failures on some platforms.

llvm-svn: 276791

8 years ago[ELF] - replace error() with llvm_unreachable.
George Rimar [Tue, 26 Jul 2016 18:46:13 +0000 (18:46 +0000)]
[ELF] - replace error() with llvm_unreachable.

llvm-svn: 276790

8 years agoAttemp to fix build bot:
George Rimar [Tue, 26 Jul 2016 18:41:06 +0000 (18:41 +0000)]
Attemp to fix build bot:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/25329/steps/build_Lld

llvm-svn: 276789

8 years agoAdd link to the Hexagon documentation
Krzysztof Parzyszek [Tue, 26 Jul 2016 18:40:25 +0000 (18:40 +0000)]
Add link to the Hexagon documentation

llvm-svn: 276788

8 years ago[Hexagon] Bitwise operations for insert/extract word not simplified
Krzysztof Parzyszek [Tue, 26 Jul 2016 18:30:11 +0000 (18:30 +0000)]
[Hexagon] Bitwise operations for insert/extract word not simplified

Change the bit simplifier to generate REG_SEQUENCE instructions in
addition to COPY, which will handle cases of word insert/extract.

llvm-svn: 276787

8 years agoFix NVPTX/call-with-alloca-buffer.ll after r276777.
Justin Lebar [Tue, 26 Jul 2016 18:28:33 +0000 (18:28 +0000)]
Fix NVPTX/call-with-alloca-buffer.ll after r276777.

r276777 makes InstSimplify stronger, letting it see through some
unnecessary addrspace casts.

llvm-svn: 276786

8 years agoMIRParser: Use shorter cfi identifiers
Matthias Braun [Tue, 26 Jul 2016 18:20:00 +0000 (18:20 +0000)]
MIRParser: Use shorter cfi identifiers

In an instruction like:
CFI_INSTRUCTION .cfi_def_cfa ...
we can drop the '.cfi_' prefix since that should be obvious by the
context:
CFI_INSTRUCTION def_cfa ...

While being a terser and cleaner syntax this also prepares to dropping
support for identifiers starting with a dot character so we can use it
for expressions.

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

llvm-svn: 276785

8 years ago[ELF] Linkerscript: symbol assignments with indentifiers on the right side of expression.
George Rimar [Tue, 26 Jul 2016 18:18:58 +0000 (18:18 +0000)]
[ELF] Linkerscript: symbol assignments with indentifiers on the right side of expression.

In symbol assignments symbol may appear on the right-hand side of the expression:
(https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l8)

kernphys = CONSTANT (MAXPAGESIZE);
 . = kernbase + kernphys + SIZEOF_HEADERS;

Patch implements that.

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

llvm-svn: 276784

8 years ago[MC] Don't crash when trying to emit a relocation against .bss.
Davide Italiano [Tue, 26 Jul 2016 18:16:33 +0000 (18:16 +0000)]
[MC] Don't crash when trying to emit a relocation against .bss.

Turn that into an error instead.

llvm-svn: 276783

8 years ago[analyzer] Add basic capabilities to detect source code clones.
Artem Dergachev [Tue, 26 Jul 2016 18:13:12 +0000 (18:13 +0000)]
[analyzer] Add basic capabilities to detect source code clones.

This patch adds the CloneDetector class which allows searching source code
for clones.

For every statement or group of statements within a compound statement,
CloneDetector computes a hash value, and finds clones by detecting
identical hash values.

This initial patch only provides a simple hashing mechanism
that hashes the kind of each sub-statement.

This patch also adds CloneChecker - a simple static analyzer checker
that uses CloneDetector to report copy-pasted code.

Patch by Raphael Isemann!

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

llvm-svn: 276782

8 years ago[CMAKE] Find ld64 using xcrun
Bruno Cardoso Lopes [Tue, 26 Jul 2016 18:09:23 +0000 (18:09 +0000)]
[CMAKE] Find ld64 using xcrun

Given similar reasons from r276710, ld64 scrubs DYLD_* environment if
called from the shim executable /usr/bin/ld.

Add support for finding ld64 via xcrun.

This is needed in order to get LIT to have the full path to the ld4
executable.

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

rdar://problem/24300926

llvm-svn: 276781

8 years ago[ELF] - Linkerscript: implemented ALIGN modificatior of output sections.
George Rimar [Tue, 26 Jul 2016 18:06:29 +0000 (18:06 +0000)]
[ELF] - Linkerscript: implemented ALIGN modificatior of output sections.

Output section description can contain ALIGN modificator:
https://sourceware.org/binutils/docs/ld/Output-Section-Description.html#Output-Section-Description

Patch implements it.

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

llvm-svn: 276780

8 years ago[sanitizer] Try to fix LargeMmapAllocator test on Windows
Reid Kleckner [Tue, 26 Jul 2016 17:59:09 +0000 (17:59 +0000)]
[sanitizer] Try to fix LargeMmapAllocator test on Windows

This test attempts to allocate 100 512MB aligned pages of memory. This
is implemented in the usual way by allocating size + alignment bytes and
aligning the result. As a result, this test allocates 51.2GB of memory.
Windows allocates swap for all memory allocated, and our bots do not
have this much swap available.

Avoid the failure by using a more reasonable alignment, like 16MB, as we
do on 32-bit.

llvm-svn: 276779

8 years ago[ELF] Linkerscript: implement DATA_SEGMENT_RELRO_END.
George Rimar [Tue, 26 Jul 2016 17:58:44 +0000 (17:58 +0000)]
[ELF] Linkerscript: implement DATA_SEGMENT_RELRO_END.

In compare with what GNU linkers do (https://sourceware.org/binutils/docs/ld/Builtin-Functions.html),
this implementation simple:

Do not touch DATA_SEGMENT_ALIGN, it do what it do now - just aligns to the page boundary.
Parameters of DATA_SEGMENT_RELRO_END is ignored. That should be correct as it is usually just a 24 bytes
shift that allows to protect first 3 entries of got.plt with relro.
(https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l146).

DATA_SEGMENT_RELRO_END just aligns to the page boundary.
That is what expected because all sections that are not affected by relro should be on another memory page.
So at fact the difference with documented behavior is that we do not pad DATA_SEGMENT_ALIGN.
3 entries of got.plt are uncovered by relro, but functionality is simple and equal to lld behavior
for case when script is not given.

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

llvm-svn: 276778

8 years ago[InstSimplify] Cast folding can be made more generic
David Majnemer [Tue, 26 Jul 2016 17:58:05 +0000 (17:58 +0000)]
[InstSimplify] Cast folding can be made more generic

Use isEliminableCastPair to determine if a pair of casts are foldable.

llvm-svn: 276777

8 years ago[LoopUtils] Sort headers
Adam Nemet [Tue, 26 Jul 2016 17:52:02 +0000 (17:52 +0000)]
[LoopUtils] Sort headers

llvm-svn: 276776

8 years agoGlobalISel: add correct operand type to G_FRAME_INDEX instrs.
Tim Northover [Tue, 26 Jul 2016 17:42:40 +0000 (17:42 +0000)]
GlobalISel: add correct operand type to G_FRAME_INDEX instrs.

Frame indices should use "addFrameIndex", not "addImm".

llvm-svn: 276775

8 years agoAdd `static` to a function that is used only in one file.
Rui Ueyama [Tue, 26 Jul 2016 17:35:42 +0000 (17:35 +0000)]
Add `static` to a function that is used only in one file.

llvm-svn: 276774

8 years ago[Hexagon] Add support for proper handling of H and L constraints
Krzysztof Parzyszek [Tue, 26 Jul 2016 17:31:02 +0000 (17:31 +0000)]
[Hexagon] Add support for proper handling of H and L constraints

H -> High part of reg pair.
L -> Low part of reg pair.

Patch by Sundeep Kushwaha.

llvm-svn: 276773

8 years agoGlobalISel: omit braces on MachineInstr types when there's only one.
Tim Northover [Tue, 26 Jul 2016 17:28:01 +0000 (17:28 +0000)]
GlobalISel: omit braces on MachineInstr types when there's only one.

Tidies up the representation a bit in the common case.

llvm-svn: 276772

8 years agoRe-committing r275284: add support to inline __builtin_mempcpy
Andrew Kaylor [Tue, 26 Jul 2016 17:23:13 +0000 (17:23 +0000)]
Re-committing r275284: add support to inline __builtin_mempcpy

Patch by Sunita Marathe

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

llvm-svn: 276771