2738 Commits

Author SHA1 Message Date
Justin Bogner
13579ede05 unittests: Explicitly ignore some return values in crash tests
Ideally these would actually check that the results are reasonable,
but given that we're looping over so many different kinds of path that
isn't really practical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284350 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 22:09:24 +00:00
Richard Smith
6ae3d4e42d PR30711: Fix incorrect profiling of 'long long' in FoldingSet, then use it to
fix TBAA violation in profiling of pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 17:49:09 +00:00
Tim Northover
ee325b9e96 GlobalISel: rename legalizer components to match others.
The previous names were both misleading (the MachineLegalizer actually
contained the info tables) and inconsistent with the selector & translator (in
having a "Machine") prefix. This should make everything sensible again.

The only functional change is the name of a couple of command-line options.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284287 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 22:18:18 +00:00
Vedant Kumar
20bdbbe5e9 [Coverage] Support loading multiple binaries into a CoverageMapping
Add support for loading multiple coverage readers into a single
CoverageMapping instance. This should make it easier to prepare a
unified coverage report for multiple binaries.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 17:16:53 +00:00
David L Kreitzer
9b8425db90 Define "contiki" OS specifier.
Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D24897


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 14:41:46 +00:00
Diana Picus
d1a990ddbb [GlobalISel] Get the AArch64 tests to work on Linux
Mostly this just means changing the triple from aarch64-apple-ios to the generic
aarch64--. Only one test needs more significant changes, but GlobalISel already
does the right thing so it's ok to just change the checks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 10:19:40 +00:00
Teresa Johnson
0a9d04f218 Add interface for querying physical hardware concurrency
Summary:
This will be used by ThinLTO to set the amount of backend
parallelism, which performs better when restricted to the number
of physical cores (on X86 at least, where getHostNumPhysicalCores is
currently defined). If not available this falls back to
thread::hardware_concurrency.

Note I didn't add to the thread class since that is a typedef to
std::thread where available.

Reviewers: mehdi_amini

Subscribers: beanz, llvm-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 00:13:59 +00:00
Teresa Johnson
26cb3d9e11 Add interface to compute number of physical cores on host system
Summary:
For now I have only added support for x86_64 Linux, but other systems
can be added incrementally.

This is to be used for setting the default parallelism for ThinLTO
backends (instead of thread::hardware_concurrency which includes
hyperthreading and is too aggressive). I'll send this as a follow-on
patch, and it will fall back to hardware_concurrency when the new
getHostNumPhysicalCores returns -1 (when not supported for a given
host system).

I also added an interface to MemoryBuffer to force reading a file
as a stream - this is required for /proc/cpuinfo which is a special
file that looks like a normal file but appears to have 0 size.
The existing readers of this file in Host.cpp are reading the first
1024 or so bytes from it, because the necessary info is near the top.
But for the new functionality we need to be able to read the entire
file. I can go back and change the other readers to use the new
getFileAsStream as a follow-on patch since it seems much more robust.

Added a unittest.

Reviewers: mehdi_amini

Subscribers: beanz, mgorny, llvm-commits, modocache

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 17:43:20 +00:00
Vedant Kumar
87963ed606 [unittests] Remove a redundant test fixture (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284135 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 17:22:44 +00:00
Eric Liu
e0d080d15d Do not delete leading ../ in remove_dots.
Reviewers: bkramer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284129 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 15:07:14 +00:00
Diana Picus
bc668c9c34 Remove a FIXME that I forgot about. NFC.
Sorry about the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284103 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-13 05:28:55 +00:00
Vedant Kumar
7c9f5f9286 [unittests] Delete even more copy constructors (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 22:44:50 +00:00
Vedant Kumar
f466ec4545 [unittests] Delete some copy constructors (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284066 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 22:27:54 +00:00
Vedant Kumar
3d6253492a [unittest] Pass a reference instead of making a copy (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284065 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 22:27:52 +00:00
Mehdi Amini
fed07c121e Revert "[ADT] Zip range adapter"
This reverts commit r284035, which breaks with MSVC 2013.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284037 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 19:54:08 +00:00
Mehdi Amini
7227e00003 [ADT] Zip range adapter
This augments the STLExtras toolset with a zip iterator and range
adapter. Zip comes in two varieties: `zip`, which will zip to the
shortest of the input ranges, and `zip_first`, which limits its
`begin() == end()` checks to just the first krange.

Patch by: Bryant Wong <github.com/bryant>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 19:43:02 +00:00
Diana Picus
126de9311e Add AArch64 unit tests
Add unit tests for checking a few tricky instruction sizes. Also remove the old
tests for the instruction sizes, which were clunky and brittle.

Since this is the first set of target-specific unit tests, we need to add some
CMake plumbing. In the future, adding unit tests for a given target will be as
simple as creating a directory with the same name as the target under
unittests/Target. The tests are only run if the target is enabled in
LLVM_TARGETS_TO_BUILD.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 09:00:44 +00:00
Chandler Carruth
94162a40bb [LCG] Add the necessary functionality to the LazyCallGraph to support inlining.
The basic inlining operation makes the following changes to the call graph:
1) Add edges that were previously transitive edges. This is always trivial and
   this patch gives the LCG helper methods to make this more convenient.
2) Remove the inlined edge. We had existing support for this, but it contained
   bugs that needed to be fixed. Testing in the same pattern as the inliner
   exposes these bugs very nicely.
3) Delete a function when it becomes dead because it is internal and all calls
   have been inlined. The LCG had no support at all for this operation, so this
   adds that support.

Two unittests have been added that exercise this specific mutation pattern to
the call graph. They were extremely effective in uncovering bugs. Sadly,
a large fraction of the code here is just to implement those unit tests, but
I think they're paying for themselves. =]

This was split out of a patch that actually uses the routines to
implement inlining in the new pass manager in order to isolate (with
unit tests) the logic that was entirely within the LCG.

Many thanks for the careful review from folks! There will be a few minor
follow-up patches based on the comments in the review as well.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 07:59:56 +00:00
Jordan Rose
8f3f50aeef Re-apply "Disallow ArrayRef assignment from temporaries."
This re-applies r283798, disabled in r283803, with the static_assert
tests disabled under MSVC. The deleted functions still seem to catch
mistakes in MSVC, so it's not a significant loss.

Part of rdar://problem/16375365

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283935 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 20:39:16 +00:00
Reid Kleckner
ef587f51d8 Avoid unnecessary constexpr to appease MSVC 2013
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 18:35:13 +00:00
Mehdi Amini
6a59bc7c7d Make RandomNumberGenerator compatible with <random>
LLVM's RandomNumberGenerator wasn't compatible with
the random distribution from <random>.

Fixes PR25105

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 07:13:01 +00:00
Zachary Turner
b260e3ad99 Revert "Disallow ArrayRef assignment from temporaries."
This reverts commit r283798, as it causes static asserts on
MSVC 2015 with the following errors:

ArrayRefTest.cpp(38): error C2338: Assigning from single prvalue element
ArrayRefTest.cpp(41): error C2338: Assigning from single xvalue element
ArrayRefTest.cpp(47): error C2338: Assigning from an initializer list

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283803 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 21:36:23 +00:00
Zachary Turner
1793ab4506 Rename llvm::apply -> llvm::apply_tuple.
llvm::cl already has a function called llvm::apply() so this is
causing an ODR violation.  The STLExtras version should win the
vote on which one gets to be called apply() since it is named
after the equivalent STL function, but since renaiming the cl
version is more difficult, let's do this for now to get the
bots green.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283800 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 21:24:34 +00:00
Jordan Rose
31b90a7187 Disallow ArrayRef assignment from temporaries.
Without this, the following statements will create ArrayRefs that
refer to temporary storage that goes out of scope by the end of the
line:

  someArrayRef = getSingleElement();
  someArrayRef = {elem1, elem2};

Note that the constructor still has this problem:

  ArrayRef<Element> someArrayRef = getSingleElement();
  ArrayRef<Element> someArrayRef = {elem1, elem2};

but that's a little harder to get rid of because we want to be able to
use this in calls:

  takesArrayRef(getSingleElement());
  takesArrayRef({elem1, elem2});

Part of rdar://problem/16375365. Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283798 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 20:57:33 +00:00
Justin Lebar
58ae36f407 [ADT] Don't use make_pointee_iterator in IteratorTest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 19:56:52 +00:00
Zachary Turner
bd90bcccca Add llvm::apply to STLExtras.
This is equivalent to the C++14 std::apply().  Since we are not
using C++14 yet, this allows us to still make use of apply anyway.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283779 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 16:44:09 +00:00
Justin Lebar
a5afae3a31 [ADT] Add make_pointe{e,r}_iterator.
Reviewers: timshen

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283765 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 16:26:03 +00:00
Justin Lebar
f086ef8c8b [ADT] Let MapVector handle non-copyable values.
Summary: The keys must still be copyable, because we store two copies of them.

Reviewers: timshen

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283764 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 16:25:59 +00:00
Javed Absar
a297939a6a [ARM]: Add Cortex-R52 target to LLVM
This patch adds Cortex-R52, the new ARM real-time processor, to LLVM. 
Cortex-R52 implements the ARMv8-R architecture.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283542 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 12:06:40 +00:00
Mehdi Amini
a47cbd993e Use StringReg in TargetParser APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283527 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 08:37:29 +00:00
Tim Northover
2d767ebb66 GlobalISel: fix misuse of using declaration in test.
Clang didn't diagnose it before. Oops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 13:57:31 +00:00
Petr Hosek
fc05fb6f65 [Triple] Add triple for Fuchsia
Fuchsia is a new operating system.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 05:17:26 +00:00
Reid Kleckner
81e3914a00 Remove extra semicolon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 21:46:56 +00:00
Reid Kleckner
87bf0196f2 Fix the build with MSVC 2013, still cannot default move ctors yet
Ten days.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 21:44:46 +00:00
David Callahan
8be61a8c7e Modify df_iterator to support post-order actions
Summary: This makes a change to the state used to maintain visited information for depth first iterator. We know assume a method "completed(...)" which is called after all children of a node have been visited. In all existing cases, this method does nothing so this patch has no functional changes.  It will however allow a client to distinguish back from cross edges in a DFS tree.

Reviewers: nadav, mehdi_amini, dberlin

Subscribers: MatzeB, mzolotukhin, twoh, freik, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 21:36:16 +00:00
Vitaly Buka
7326421de8 [ADT] Add missing const_iterator DenseSet::find() const
Summary: Probably overlooked.

Reviewers: eugenis, dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283377 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 20:36:39 +00:00
Zachary Turner
e53904ebe7 Fix build due to comparison of std::pairs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283342 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 17:04:36 +00:00
Zachary Turner
5844b06a17 Add llvm::enumerate() range adapter.
This allows you to enumerate over a range using a range-based
for while the return type contains the index of the enumeration.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 16:54:09 +00:00
Mehdi Amini
f9bb6bcf37 Re-commit "Use StringRef in Support/Darf APIs (NFC)"
This reverts commit r283285 and re-commit r283275 with
a fix for format("%s", Str); where Str is a StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 05:59:29 +00:00
Dean Michael Berris
f6b865d41a [Support][CommandLine] Add cl::getRegisteredSubcommands()
This should allow users of the library to get a range to iterate through
all the subcommands that are registered to the global parser. This
allows users to define subcommands in libraries that self-register to
have dispatch done at a different stage (like main). It allows for
writing code like the following:

    for (auto *S : cl::getRegisteredSubcommands()) {
      if (*S) {
	// Dispatch on S->getName().
      }
    }

This change also contains tests that show this usage pattern.

Reviewers: zturner, dblaikie, echristo

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 05:20:08 +00:00
Mehdi Amini
ef350f2eb3 Revert "Re-commit "Use StringRef in Support/Darf APIs (NFC)""
One test seems randomly broken: DebugInfo/X86/gnu-public-names.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 01:04:02 +00:00
Mehdi Amini
a2df9c87e9 Re-commit "Use StringRef in Support/Darf APIs (NFC)"
This reverts commit r283278 and re-commit r283275 with
the update to fix the build on the LLDB side.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 00:37:18 +00:00
Mehdi Amini
c441cc0af2 Revert "Use StringRef in Support/Darf APIs (NFC)"
This reverts commit r283275, it broke LLDB Android debug server.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 00:21:14 +00:00
Mehdi Amini
ba4c13cb88 Use StringRef in Support/Darf APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 23:55:40 +00:00
Rafael Espindola
2638e45e83 Misc improvements to StringTableBuilder.
This patch adds write methods to StringTableBuilder so that it is
easier to change the underlying implementation.

Using the write methods, avoid creating a temporary buffer when using
mmaped output.

It also uses a more compact key in the DenseMap. Overall this produces
a slightly faster lld:

firefox
  master 6.853419709
  patch  6.841968912 1.00167361138x faster
chromium
  master 4.297280174
  patch  4.298712163 1.00033323147x slower
chromium fast
  master 1.802335952
  patch  1.806872459 1.00251701521x slower
the gold plugin
  master 0.3247149
  patch  0.321971644 1.00852017888x faster
clang
  master 0.551279945
  patch  0.543733194 1.01387951128x faster
llvm-as
  master 0.032743458
  patch  0.032143478 1.01866568391x faster
the gold plugin fsds
  master 0.350814247
  patch  0.348571741 1.00643341309x faster
clang fsds
  master 0.6281672
  patch  0.621130222 1.01132931187x faster
llvm-as fsds
  master 0.030168899
  patch  0.029797155 1.01247582194x faster
scylla
  master 3.104222518
  patch  3.059590248 1.01458766252x faster

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 22:43:25 +00:00
Zachary Turner
0030b47dc1 [Support] Add case-insensitive versions of StringSwitch members.
This adds support for CaseLower, CasesLower, StartsWithLower, and
EndsWithLower.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 19:33:13 +00:00
George Burgess IV
e602ff91e3 [MSSA] Allow unittests to use BasicAA when building.
We now build MemorySSA in its ctor, instead of waiting until the user
calls MemorySSA::getWalker. This silently changed our unittests, since
we add BasicAA to AAResults *after* constructing MemorySSA (...but
before calling MemorySSA::getWalker).

None of them broke because we do most of our "did this get optimized
correctly?" tests in .ll files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283158 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 23:12:35 +00:00
Zachary Turner
f378e2727f Add unit tests for StringSwitch.
Differential revision: https://reviews.llvm.org/D25205

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 19:56:50 +00:00
Sanjoy Das
53936b83aa [ConstantRange] Make getEquivalentICmp smarter
This change teaches getEquivalentICmp to be smarter about generating
ICMP_NE and ICMP_EQ predicates.

An earlier version of this change was landed as rL283057 which had a
use-after-free bug.  This new version has a fix for that bug, and a (C++
unittests/) test case that would have triggered it rL283057.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-02 20:59:05 +00:00
Sanjoy Das
d3000982c5 Revert r283057 and r283058
They've broken the sanitizer-bootstrap bots.  Reverting while I investigate.

Original commit messages:

r283057: "[ConstantRange] Make getEquivalentICmp smarter"

r283058: "[SCEV] Rely on ConstantRange instead of custom logic; NFCI"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283062 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-02 02:40:27 +00:00