Commit Graph

2757 Commits

Author SHA1 Message Date
Artur Pilipenko
57ea7480ce Introduce ConstantRange.addWithNoSignedWrap
To be used by upcoming change to IndVarSimplify

Reviewed By: sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 14:44:23 +00:00
Pavel Labath
bca3cda284 Add Chrono.h - std::chrono support header
Summary:
std::chrono mostly covers the functionality of llvm::sys::TimeValue and
lldb_private::TimeValue. This header adds a bit of utility functions and
typedefs, which make the usage of the library and porting code from TimeValues
easier.

Rationale:
- TimePoint typedef - precision of system_clock is implementation defined -
  using a well-defined precision helps maintain consistency between platforms,
  makes it interact better with existing TimeValue classes, and avoids cases
  there a time point is implicitly convertible to a specific precision on some
  platforms but not on others.
- system_clock::to_time_t only accepts time_points with the default system
  precision (even though time_t has only second precision on all platforms we
  support). To avoid the need for explicit casts, I have added a toTimeT()
  wrapper function. toTimePoint(time_t) was not strictly necessary, but I have
  added it for symmetry.

Reviewers: zturner, mehdi_amini

Subscribers: beanz, mgorny, llvm-commits, modocache

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 13:58:55 +00:00
Vitaly Buka
6b9bef9d05 [asan] Simplify calculation of stack frame layout extraction calculation of stack description into separate function.
Reviewers: eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 23:29:52 +00:00
Vitaly Buka
298a3d2a9a [asan] Append line number to variable name if line is available and in the same file as the function.
PR30498

Reviewers: eugenis

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284546 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 23:29:41 +00:00
Justin Lebar
433154b92a [ADT] Remove CachedHash<T>.
Nobody is using it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284503 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 17:50:39 +00:00
Sanjoy Das
de57b39da0 [SCEV] Make CompareValueComplexity a little bit smarter
This helps canonicalization in some cases.

Thanks to Pankaj Chawla for the investigation and the test case!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 17:45:16 +00:00
Victor Leschuk
58be60c483 DebugInfo: change alignment type from uint64_t to uint32_t to save space.
In futher patches we shall have alignment field added to DIVariable family
and switching from uint64_t to uint32_t will save 4 bytes per variable.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 14:31:22 +00:00
Renato Golin
8bb4ccc94b Revert "Resubmit "Add support for advanced number formatting.""
This reverts commits 284436 and 284437 because they still break AArch64 bots:

Value of: format_number(-10, IntegerStyle::Integer, 1)
  Actual: "-0"
  Expected: "-10"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 09:30:18 +00:00
Zachary Turner
88bc637ad2 Rename HexStyle -> HexFormatStyle, and remove a constexpr.
This should fix the remaining broken builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 23:08:47 +00:00
Zachary Turner
b3a18516ab Resubmit "Add support for advanced number formatting."
This resubmits commits 284425 and r284428, which were reverted
in r284429 due to some infinite recursion caused by an incorrect
selection of function overloads.  Reproduced the failure on Linux
using GCC 4.8.4, and confirmed that with the new patch the tests
path on GCC as well as MSVC.  So hopefully this fixes everything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:49:24 +00:00
Justin Lebar
fd7d73fae5 [ADT] Move CachedHashString to its own header in ADT, and rename to CachedHashStringRef.
Summary:
Reclaiming the name 'CachedHashString' will let us add a type with that
name that owns its value.

Reviewers: timshen

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:24:36 +00:00
Justin Lebar
afb36183fc [ADT] Add an initializer_list constructor to {Small,}DenseSet.
Reviewers: timshen

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:24:32 +00:00
Justin Lebar
6461aabcfc [ADT] Add SmallDenseSet.
Summary: This matches SmallDenseMap.

Reviewers: timshen

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:24:28 +00:00
Zachary Turner
fdfb1c554e Revert formatting changes.
This reverts r288425 and r284428 as they are causing test crashes
on some systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:25:41 +00:00
Zachary Turner
d4bb10c270 Try to fix build after invalid pointer conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:14:27 +00:00
Zachary Turner
0a7eca8829 [Support] Add support for "advanced" number formatting.
raw_ostream has not afforded a lot of flexibility in terms of
how to format numbers when outputting.  Wrap this all up into
a set of low level helper functions that can be used to output
numbers with arbitrary precision, alignment, format, etc and
then update raw_ostream to use these functions.

This will be useful for upcoming improvements to llvm's string
formatting libraries, but are still useful independently.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 20:57:45 +00:00
Teresa Johnson
6fb063ad06 Rename interface for querying physical hardware concurrency
Based on post-commit review for D25585/r284180, rename
hardware_physical_concurrency to heavyweight_hardware_concurrency,
to better reflect what type of tasks it should be used for and
to enable other systems to map this to something other than the
number of physical cores.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 14:56:53 +00:00
Benjamin Kramer
573d9cc8f2 [Support] remove_dots: Remove windows test.
Windows doesn't have roots, so I think this test doesn't make sense
there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 13:57:16 +00:00
Benjamin Kramer
94b3ee41bc [Support] remove_dots: Remove .. from absolute paths.
/../foo is still a proper path after removing the dotdot. This should
now finally match https://9p.io/sys/doc/lexnames.html [Cleaning names].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 13:28:21 +00:00
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