platform/upstream/llvm.git
7 years agoQuick fix to D32609, it seems .o files are not transferred in all cases.
Eric Beckmann [Mon, 8 May 2017 02:47:25 +0000 (02:47 +0000)]
Quick fix to D32609, it seems .o files are not transferred in all cases.

Therefore the .o file in question is renamed to .obj.coff.

llvm-svn: 302400

7 years agoUpdate llvm-readobj -coff-resources to display tree structure.
Eric Beckmann [Mon, 8 May 2017 02:47:07 +0000 (02:47 +0000)]
Update llvm-readobj -coff-resources to display tree structure.

Summary: Continue making updates to llvm-readobj to display resource sections.  This is necessary for testing the up and coming cvtres tool.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302399

7 years ago[SCEV] Have getRangeForAffineARHelper take StartRange by const reference to avoid...
Craig Topper [Mon, 8 May 2017 02:29:15 +0000 (02:29 +0000)]
[SCEV] Have getRangeForAffineARHelper take StartRange by const reference to avoid a copy in many of the cases.

llvm-svn: 302398

7 years agoRevert "Hopefully one last commit to fix this patch, addresses string reference"
Eric Beckmann [Mon, 8 May 2017 02:25:03 +0000 (02:25 +0000)]
Revert "Hopefully one last commit to fix this patch, addresses string reference"

Summary:
This reverts commit 56beec1b1cfc6d263e5eddb7efff06117c0724d2.

Revert "Quick fix to D32609, it seems .o files are not transferred in all cases."

This reverts commit 7652eecd29cfdeeab7f76f687586607a99ff4e36.

Revert "Update llvm-readobj -coff-resources to display tree structure."

This reverts commit 422b62c4d302cfc92401418c2acd165056081ed7.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302397

7 years agoFix Windows locale detection
Eric Fiselier [Mon, 8 May 2017 02:09:48 +0000 (02:09 +0000)]
Fix Windows locale detection

llvm-svn: 302396

7 years agoHopefully one last commit to fix this patch, addresses string reference
Eric Beckmann [Mon, 8 May 2017 01:48:55 +0000 (01:48 +0000)]
Hopefully one last commit to fix this patch, addresses string reference
issues.

llvm-svn: 302395

7 years agoFix shared_mutex dll import errors on Windows
Eric Fiselier [Mon, 8 May 2017 01:31:50 +0000 (01:31 +0000)]
Fix shared_mutex dll import errors on Windows

llvm-svn: 302394

7 years ago[libc++] Implement exception_ptr on Windows
Eric Fiselier [Mon, 8 May 2017 01:17:50 +0000 (01:17 +0000)]
[libc++] Implement exception_ptr on Windows

Summary:
This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC.

The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well.

Note there are still 2 outstanding exception_ptr/nested_exception test failures.

* `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time.
* `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion.

This patch also gets most of the `<future>` tests passing as well.

Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT

Subscribers: mgorny, cfe-commits

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

llvm-svn: 302393

7 years ago[XRay][compiler-rt] XFAIL on ppc
Dean Michael Berris [Mon, 8 May 2017 00:38:13 +0000 (00:38 +0000)]
[XRay][compiler-rt] XFAIL on ppc

Follow-up on D32846.

llvm-svn: 302392

7 years agoFix DLL import/export on Win32 locale helpers
Eric Fiselier [Mon, 8 May 2017 00:37:31 +0000 (00:37 +0000)]
Fix DLL import/export on Win32 locale helpers

llvm-svn: 302391

7 years agoFix DLL import for __time_get_c_storage member functions.
Eric Fiselier [Mon, 8 May 2017 00:29:32 +0000 (00:29 +0000)]
Fix DLL import for __time_get_c_storage member functions.

llvm-svn: 302390

7 years agoRevert "Actually remove the MSVC STL when linking and testing libc++ on Windows"
Eric Fiselier [Sun, 7 May 2017 23:37:38 +0000 (23:37 +0000)]
Revert "Actually remove the MSVC STL when linking and testing libc++ on Windows"

This reverts commit r302387.

llvm-svn: 302389

7 years agoQuick fix to D32609, it seems .o files are not transferred in all cases.
Eric Beckmann [Sun, 7 May 2017 23:31:14 +0000 (23:31 +0000)]
Quick fix to D32609, it seems .o files are not transferred in all cases.

Therefore the .o file in question is renamed to .obj.coff.

llvm-svn: 302388

7 years agoActually remove the MSVC STL when linking and testing libc++ on Windows
Eric Fiselier [Sun, 7 May 2017 23:19:14 +0000 (23:19 +0000)]
Actually remove the MSVC STL when linking and testing libc++ on Windows

llvm-svn: 302387

7 years agoUpdate llvm-readobj -coff-resources to display tree structure.
Eric Beckmann [Sun, 7 May 2017 22:47:22 +0000 (22:47 +0000)]
Update llvm-readobj -coff-resources to display tree structure.

Summary: Continue making updates to llvm-readobj to display resource sections.  This is necessary for testing the up and coming cvtres tool.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302386

7 years ago[ConstantRange][SimplifyCFG] Add a helper method to allow SimplifyCFG to determine...
Craig Topper [Sun, 7 May 2017 22:22:11 +0000 (22:22 +0000)]
[ConstantRange][SimplifyCFG] Add a helper method to allow SimplifyCFG to determine if a ConstantRange has more than 8 elements without requiring an allocation if the ConstantRange is 64-bits wide.

Previously SimplifyCFG used getSetSize which returns an APInt that is 1 bit wider than the ConstantRange's bit width. In the reasonably common case that the ConstantRange is 64-bits wide, this requires returning a 65-bit APInt. APInt's can only store 64-bits without a memory allocation so this is inefficient.

The new method takes the 8 as an input and tells if the range contains more than that many elements without requiring any wider math.

llvm-svn: 302385

7 years agoTemporarly XFAIL aligned new/delete tests on Windows.
Eric Fiselier [Sun, 7 May 2017 22:10:56 +0000 (22:10 +0000)]
Temporarly XFAIL aligned new/delete tests on Windows.

Libc++ doesn't provide its own definitions of new/delete on Windows,
instead using the versions provided by VCRuntime. However VCRuntime
does not yet implement aligned new/delete so these tests fail.

It might be possible for libc++ to provide its own definitions only
for aligned new/delete as long as MSVC doesn't provide it. However
before this can be done libc++ needs to figure out how to implement
std::get_new_handler.

llvm-svn: 302384

7 years ago[ConstantRange] Remove 'Of' from name of ConstantRange::isSizeStrictlySmallerThanOf...
Craig Topper [Sun, 7 May 2017 21:48:08 +0000 (21:48 +0000)]
[ConstantRange] Remove 'Of' from name of ConstantRange::isSizeStrictlySmallerThanOf so that it reads better. NFC

llvm-svn: 302383

7 years agoFix Windows test failures caused by identical temp file names.
Eric Fiselier [Sun, 7 May 2017 21:41:58 +0000 (21:41 +0000)]
Fix Windows test failures caused by identical temp file names.

This patch fixes test failures that occur on Windows because
the tests attempt to generate two distinct temp file names but
get the same name both time.

The fix for this is to create the first temp file before requesting
a second temporary file name. This ensures that the second name
will be unique.

llvm-svn: 302382

7 years agoAccept Windows specific output in system error tests
Eric Fiselier [Sun, 7 May 2017 21:21:07 +0000 (21:21 +0000)]
Accept Windows specific output in system error tests

llvm-svn: 302381

7 years agoFix two test failures caused by Windows mangling of function types.
Eric Fiselier [Sun, 7 May 2017 21:15:28 +0000 (21:15 +0000)]
Fix two test failures caused by Windows mangling of function types.

On Windows the function template `template <class T> void test()` has
the same mangled name when instantiated with the distinct types `void()`
and `void() noexcept`. When this occurs Clang emits an error. This error
was causing two type-traits tests to fail.

However this can be worked around by using class templates instead of
function templates, which is what this patch does to fix the errors.

llvm-svn: 302380

7 years ago[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen
Siddharth Bhat [Sun, 7 May 2017 21:03:46 +0000 (21:03 +0000)]
[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen

Summary:
When compiling for GPU, one can now choose to compile for OpenCL or CUDA,
with the corresponding polly-gpu-runtime flag (libopencl / libcudart). The
GPURuntime library (GPUJIT) has been extended with the OpenCL Runtime library
for that purpose, correctly choosing the corresponding library calls to the
option chosen when compiling (via different initialization calls).

Additionally, a specific GPU Target architecture can now be chosen with -polly-gpu-arch (only nvptx64 implemented thus far).

Reviewers: grosser, bollu, Meinersbur, etherzhhb, singam-sanjay

Reviewed By: grosser, Meinersbur

Subscribers: singam-sanjay, llvm-commits, pollydev, nemanjai, mgorny, yaxunl, Anastasia

Tags: #polly

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

llvm-svn: 302379

7 years ago[X86][AVX1] Improve 256-bit vector costs for integer unary intrinsics.
Simon Pilgrim [Sun, 7 May 2017 20:58:55 +0000 (20:58 +0000)]
[X86][AVX1] Improve 256-bit vector costs for integer unary intrinsics.

Account for subvector extraction/insertion, helps prevent the vectorizers from selecting 256-bit vectors that will have to be split anyhow on AVX1 targets.

llvm-svn: 302378

7 years ago[Orc] Remove trailing whitespace.
Lang Hames [Sun, 7 May 2017 20:39:46 +0000 (20:39 +0000)]
[Orc] Remove trailing whitespace.

llvm-svn: 302377

7 years ago[Polly] [GPUJIT] Adapted argument capitalization to fit standard
Siddharth Bhat [Sun, 7 May 2017 19:53:35 +0000 (19:53 +0000)]
[Polly] [GPUJIT] Adapted argument capitalization to fit standard

Summary: Function argument naming changed to reflect capitalization standards.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

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

llvm-svn: 302376

7 years ago[Polly] [GPUJIT] Moved error prints to stderr
Siddharth Bhat [Sun, 7 May 2017 18:31:25 +0000 (18:31 +0000)]
[Polly] [GPUJIT] Moved error prints to stderr

Summary: Errors previously printed to stdout now get printed to stderr.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

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

llvm-svn: 302375

7 years ago[InstSimplify] add tests for PR32949 miscompile; NFC
Sanjay Patel [Sun, 7 May 2017 18:19:13 +0000 (18:19 +0000)]
[InstSimplify] add tests for PR32949 miscompile; NFC

llvm-svn: 302374

7 years agoInstructionSimplify: Relanding r301766
Zvi Rackover [Sun, 7 May 2017 18:16:37 +0000 (18:16 +0000)]
InstructionSimplify: Relanding r301766

Summary:
Re-applying r301766 with a fix to a typo and a regression test.

The log message for r301766 was:
==================================================================================
    InstructionSimplify: Canonicalize shuffle operands. NFC-ish.

    Summary:
     Apply canonicalization rules:
        1. Input vectors with no elements selected from can be replaced with undef.
        2. If only one input vector is constant it shall be the second one.

    This allows constant-folding to cover more ad-hoc simplifications that
    were in place and avoid duplication for RHS and LHS checks.

    There are more rules we may want to add in the future when we see a
    justification. e.g. mask elements that select undef elements can be
    replaced with undef.
==================================================================================

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 302373

7 years agoMake llvm-rtdlyd -check preserve automatic address mappings made by RuntimeDyld.
Lang Hames [Sun, 7 May 2017 17:19:53 +0000 (17:19 +0000)]
Make llvm-rtdlyd -check preserve automatic address mappings made by RuntimeDyld.

Currently llvm-rtdyld in -check mode will map sections to back-to-back 4k
aligned slabs starting at 0x1000. Automatically remapping sections by default is
helpful because it quickly exposes relocation bugs due to use of local addresses
rather than load addresses (these would silently pass if the load address was
not remapped). These mappings can be explicitly overridden on a per-section
basis using llvm-rtdlyd's -map-section option. This patch extends this scheme to
also preserve any mappings made by RuntimeDyld itself. Preserving RuntimeDyld's
automatic mappings allows us to write test cases to verify that these automatic
mappings have been applied.

This will allow the fix in https://reviews.llvm.org/D32899 to be tested with
llvm-rtdyld -check.

llvm-svn: 302372

7 years ago[SCEV] Use move semantics in ScalarEvolution::setRange
Craig Topper [Sun, 7 May 2017 16:28:17 +0000 (16:28 +0000)]
[SCEV] Use move semantics in ScalarEvolution::setRange

Summary: This makes setRange take ConstantRange by rvalue reference since most callers were passing an unnamed temporary ConstantRange. We can then move that ConstantRange into the DenseMap caches. For the callers that weren't passing a temporary, I've added std::move to to the local variable being passed.

Reviewers: sanjoy, mzolotukhin, efriedma

Reviewed By: sanjoy

Subscribers: takuto.ikuta, llvm-commits

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

llvm-svn: 302371

7 years ago[InstSimplify] use ConstantRange to simplify or-of-icmps
Sanjay Patel [Sun, 7 May 2017 15:11:40 +0000 (15:11 +0000)]
[InstSimplify] use ConstantRange to simplify or-of-icmps

We can simplify (or (icmp X, C1), (icmp X, C2)) to 'true' or one of the icmps in many cases.
I had to check some of these with Alive to prove to myself it's right, but everything seems
to check out. Eg, the deleted code in instcombine was completely ignoring predicates with
mismatched signedness.

This is a follow-up to:
https://reviews.llvm.org/rL301260
https://reviews.llvm.org/D32143

llvm-svn: 302370

7 years ago[Kaleidoscope] toy.cpp use after move fix
Peter Szecsi [Sun, 7 May 2017 11:00:01 +0000 (11:00 +0000)]
[Kaleidoscope] toy.cpp use after move fix

The variable Proto is moved at the beginning of the codegen() function.
According to the comment above, the pointed object should be used due the
reference P.

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

llvm-svn: 302369

7 years agoRemove unnecessary const_cast
Sanjoy Das [Sun, 7 May 2017 05:29:36 +0000 (05:29 +0000)]
Remove unnecessary const_cast

llvm-svn: 302368

7 years agoUse array_pod_sort instead of std::sort
Sanjoy Das [Sun, 7 May 2017 05:29:34 +0000 (05:29 +0000)]
Use array_pod_sort instead of std::sort

llvm-svn: 302367

7 years agoFix comment.
Lang Hames [Sun, 7 May 2017 03:54:53 +0000 (03:54 +0000)]
Fix comment.

llvm-svn: 302366

7 years agoCOFF: add ARM64 relocation types
Saleem Abdulrasool [Sat, 6 May 2017 23:48:02 +0000 (23:48 +0000)]
COFF: add ARM64 relocation types

Add the ARM64 COFF relocation types.  This will be needed to add support
for the AArch64 Windows object file emission support.

llvm-svn: 302365

7 years agoUpdate LanguageExtensions doc to refer to C++14 instead of C++1y
Eric Fiselier [Sat, 6 May 2017 23:26:04 +0000 (23:26 +0000)]
Update LanguageExtensions doc to refer to C++14 instead of C++1y

llvm-svn: 302364

7 years agoFix undefined pthread references when building against libc++
Eric Fiselier [Sat, 6 May 2017 22:10:14 +0000 (22:10 +0000)]
Fix undefined pthread references when building against libc++

llvm-svn: 302363

7 years agoEnsure showbase does not overflow do_put buffers
Dimitry Andric [Sat, 6 May 2017 20:58:50 +0000 (20:58 +0000)]
Ensure showbase does not overflow do_put buffers

Summary:
In https://bugs.freebsd.org/207918, Daniel McRobb describes how using
std::showbase with ostreams can cause truncation of unsigned long long
when output format is octal.  In fact, this can even happen with
unsigned int and unsigned long.

To ensure this does not happen, add one additional character to the
do_put buffers if std::showbase is on.  Also add a test case.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits, emaste

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

llvm-svn: 302362

7 years ago[X86][AVX512] Relax assertion and just exit combine for unsupported types (PR32907)
Simon Pilgrim [Sat, 6 May 2017 20:53:52 +0000 (20:53 +0000)]
[X86][AVX512] Relax assertion and just exit combine for unsupported types (PR32907)

llvm-svn: 302361

7 years agoReally disable test as intended in the previous commit
Tobias Grosser [Sat, 6 May 2017 19:18:19 +0000 (19:18 +0000)]
Really disable test as intended in the previous commit

llvm-svn: 302360

7 years ago[X86][AVX512] Move v2i64/v4i64 VPABS lowering to tablegen
Simon Pilgrim [Sat, 6 May 2017 19:11:59 +0000 (19:11 +0000)]
[X86][AVX512] Move v2i64/v4i64 VPABS lowering to tablegen

Extend NoVLX targets to use the 512-bit versions

llvm-svn: 302359

7 years agoDisable test to avoid buildbot noise
Tobias Grosser [Sat, 6 May 2017 18:50:28 +0000 (18:50 +0000)]
Disable test to avoid buildbot noise

This test was introduced in r302339. It works on my system, but breaks on the
buildbots.

llvm-svn: 302358

7 years ago[X86] Reduce code for setting operations actions by merging into loops across multipl...
Simon Pilgrim [Sat, 6 May 2017 18:17:56 +0000 (18:17 +0000)]
[X86] Reduce code for setting operations actions by merging into loops across multiple types/ops. NFCI.

llvm-svn: 302357

7 years ago[NVPTX] Add support for ISD::ABS lowering
Simon Pilgrim [Sat, 6 May 2017 17:42:09 +0000 (17:42 +0000)]
[NVPTX] Add support for ISD::ABS lowering

Use the ISD::ABS opcode directly

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

llvm-svn: 302356

7 years ago[X86][SSE] Break register dependencies on v16i8/v8i16 BUILD_VECTOR on SSE41
Simon Pilgrim [Sat, 6 May 2017 17:30:39 +0000 (17:30 +0000)]
[X86][SSE] Break register dependencies on v16i8/v8i16 BUILD_VECTOR on SSE41

rL294581 broke unnecessary register dependencies on partial v16i8/v8i16 BUILD_VECTORs, but on SSE41 we (currently) use insertion for full BUILD_VECTORs as well. By allowing full insertion to occur on SSE41 targets we can break register dependencies here as well.

llvm-svn: 302355

7 years ago[Analysis] Print out unreachable loops
Brian Gesiak [Sat, 6 May 2017 16:22:53 +0000 (16:22 +0000)]
[Analysis] Print out unreachable loops

Summary:
When writing a loop pass I made a mistake and hit the assertion
"Unreachable block in loop". Later, I hit an assertion when I called
`BasicBlock::eraseFromParent()` incorrectly: "Use still stuck around
after Def is destroyed". This latter assertion, however, printed out
exactly which value is being deleted and what uses remain, which helped
me debug the issue.

To help people debugging their loop passes in the future, print out
exactly which basic block is unreachable in a loop.

Reviewers: sanjoy, hfinkel, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: mzolotukhin

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

llvm-svn: 302354

7 years ago[builtins] Fixup emulated TLS for mingw.
Martell Malone [Sat, 6 May 2017 15:13:17 +0000 (15:13 +0000)]
[builtins] Fixup emulated TLS for mingw.

Enabled emulated TLS on WOA for mingw
Fix <windows.h> include for mingw

Reviewed By: chapuni, mstorsjo

Subscribers: compnerd, llvm-commits

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

llvm-svn: 302340

7 years ago[DeLICM] Known knowledge.
Michael Kruse [Sat, 6 May 2017 14:03:58 +0000 (14:03 +0000)]
[DeLICM] Known knowledge.

Extend the Knowledge class to store information about the contents
of array elements and which values are written. Two knowledges do
not conflict the known content is the same. The content information
if computed from writes to and loads from the array elements, and
represented by "ValInst": isl spaces that compare equal if the value
represented is the same.

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

llvm-svn: 302339

7 years ago[X86][AVX2] Add scheduling latency/throughput tests for some AVX2 instructions
Simon Pilgrim [Sat, 6 May 2017 13:46:09 +0000 (13:46 +0000)]
[X86][AVX2] Add scheduling latency/throughput tests for some AVX2 instructions

Many more to come...

llvm-svn: 302338

7 years ago[DAGCombiner] If ISD::ABS is legal/custom, use it directly instead of canonicalizing...
Simon Pilgrim [Sat, 6 May 2017 13:44:42 +0000 (13:44 +0000)]
[DAGCombiner] If ISD::ABS is legal/custom, use it directly instead of canonicalizing first.

Remove an extra canonicalization step if ISD::ABS is going to be used anyway.

Updated x86 abs combine to check that we are lowering from both canonicalizations.

llvm-svn: 302337

7 years ago[CMake] Introduce POLLY_BUNDLED_JSONCPP.
Michael Kruse [Sat, 6 May 2017 13:42:15 +0000 (13:42 +0000)]
[CMake] Introduce POLLY_BUNDLED_JSONCPP.

Allow using a system's install jsoncpp library instead of the bundled
one with the setting POLLY_BUNDLED_JSONCPP=OFF.

This fixes llvm.org/PR32929

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

llvm-svn: 302336

7 years ago[SCEV] Remove extra APInt copies from getRangeForAffineARHelper.
Craig Topper [Sat, 6 May 2017 06:03:07 +0000 (06:03 +0000)]
[SCEV] Remove extra APInt copies from getRangeForAffineARHelper.

This changes one parameter to be a const APInt& since we only read from it. Use std::move on local APInts once they are no longer needed so we can reuse their allocations. Lastly, use operator+=(uint64_t) instead of adding 1 to an APInt twice creating a new APInt each time.

llvm-svn: 302335

7 years ago[SCEV] Use std::move to avoid some APInt copies.
Craig Topper [Sat, 6 May 2017 05:22:56 +0000 (05:22 +0000)]
[SCEV] Use std::move to avoid some APInt copies.

llvm-svn: 302334

7 years ago[SCEV] Use APInt's uint64_t operations instead of creating a temporary APInt to hold 1.
Craig Topper [Sat, 6 May 2017 05:15:11 +0000 (05:15 +0000)]
[SCEV] Use APInt's uint64_t operations instead of creating a temporary APInt to hold 1.

llvm-svn: 302333

7 years ago[SCEV] Avoid a couple APInt copies by capturing by reference since the method returns...
Craig Topper [Sat, 6 May 2017 05:15:09 +0000 (05:15 +0000)]
[SCEV] Avoid a couple APInt copies by capturing by reference since the method returns a reference.

llvm-svn: 302332

7 years ago[LazyValueInfo] Avoid unnecessary copies of ConstantRanges
Craig Topper [Sat, 6 May 2017 03:35:15 +0000 (03:35 +0000)]
[LazyValueInfo] Avoid unnecessary copies of ConstantRanges

Summary:
ConstantRange contains two APInts which can allocate memory if their width is larger than 64-bits. So we shouldn't copy it when we can avoid it.

This changes LVILatticeVal::getConstantRange() to return its internal ConstantRange by reference. This allows many places that just need a ConstantRange reference to avoid making a copy.

Several places now capture the return value of getConstantRange() by reference so they can call methods on it that don't need a new object.

Lastly it adds std::move in one place to capture to move a local ConstantRange into an LVILatticeVal.

Reviewers: reames, dberlin, sanjoy, anna

Reviewed By: reames

Subscribers: grandinj, llvm-commits

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

llvm-svn: 302331

7 years agoFix lgamma_r linking errors on Windows. It appears the normal lgamma function is...
Eric Fiselier [Sat, 6 May 2017 02:58:43 +0000 (02:58 +0000)]
Fix lgamma_r linking errors on Windows. It appears the normal lgamma function is thread safe anyway

llvm-svn: 302330

7 years agoNote addition of NetBSD support in googletest
Kamil Rytarowski [Sat, 6 May 2017 02:45:42 +0000 (02:45 +0000)]
Note addition of NetBSD support in googletest

Recreated patch for __NetBSD__ has been pushed upstream to Google.

llvm-svn: 302329

7 years agoBe a little more permissive in DynamicLoaderMacOS::CanLoadImage
Jim Ingham [Sat, 6 May 2017 01:15:47 +0000 (01:15 +0000)]
Be a little more permissive in DynamicLoaderMacOS::CanLoadImage

If we can't find the "is dyld locked" symbol, assume it is safe
to load the image unless we only have 1 image loaded - in which case
we are in _dyld_start and it is definitely NOT safe.

Also add a little better errors to that function, and better logging
in SBProcess.cpp.

<rdar://problem/30174817>

llvm-svn: 302327

7 years agoUse the same terminology as ELF.
Rui Ueyama [Fri, 5 May 2017 23:52:24 +0000 (23:52 +0000)]
Use the same terminology as ELF.

This patch do s/color/class/g.

llvm-svn: 302326

7 years ago[libcxx] [test] Suppress MSVC's /analyze warning C6294 in a more fine-grained manner.
Stephan T. Lavavej [Fri, 5 May 2017 23:51:39 +0000 (23:51 +0000)]
[libcxx] [test] Suppress MSVC's /analyze warning C6294 in a more fine-grained manner.

Fixes D32926.

llvm-svn: 302325

7 years agoRemove dead file.
Rui Ueyama [Fri, 5 May 2017 23:44:26 +0000 (23:44 +0000)]
Remove dead file.

llvm-svn: 302324

7 years agoAdded "info threads", "thread 1" and "apropos".
Jim Ingham [Fri, 5 May 2017 23:38:26 +0000 (23:38 +0000)]
Added "info threads", "thread 1" and "apropos".

llvm-svn: 302323

7 years ago[libcxx] [test] Fix MSVC "warning C6326: Potential comparison of a constant with...
Stephan T. Lavavej [Fri, 5 May 2017 23:38:24 +0000 (23:38 +0000)]
[libcxx] [test] Fix MSVC "warning C6326: Potential comparison of a constant with another constant".

The expressions `1 == 1` and `true` have the same type, value category, and value.

Fixes D32924.

llvm-svn: 302322

7 years ago[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden...
Kostya Serebryany [Fri, 5 May 2017 23:28:47 +0000 (23:28 +0000)]
[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. compiler-rt part (test only).

llvm-svn: 302321

7 years ago[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden...
Kostya Serebryany [Fri, 5 May 2017 23:28:18 +0000 (23:28 +0000)]
[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. clang part.

llvm-svn: 302320

7 years ago[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden...
Kostya Serebryany [Fri, 5 May 2017 23:14:40 +0000 (23:14 +0000)]
[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. llvm part.

llvm-svn: 302319

7 years ago[libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance shouldn't...
Stephan T. Lavavej [Fri, 5 May 2017 23:01:38 +0000 (23:01 +0000)]
[libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance shouldn't be mandated".

In C++17, these iterators are allowed but not required
to inherit from the deprecated std::iterator base class.

Fixes D32727.

llvm-svn: 302318

7 years ago[clang-tidy] Use cxxStdInitializerListExpr in modernize-use-emplace
Jakub Kuderski [Fri, 5 May 2017 23:00:37 +0000 (23:00 +0000)]
[clang-tidy] Use cxxStdInitializerListExpr in modernize-use-emplace

Summary: Use the cxxStdInitializerListExp matcher from ASTMatchers.h instead of a local one.

Reviewers: aaron.ballman, alexfh, Prazek

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 302317

7 years ago[RegisterBankInfo] Uniquely allocate instruction mapping.
Quentin Colombet [Fri, 5 May 2017 22:48:22 +0000 (22:48 +0000)]
[RegisterBankInfo] Uniquely allocate instruction mapping.

This is a step toward having statically allocated instruciton mapping.
We are going to tablegen them eventually, so let us reflect that in
the API.

NFC.

llvm-svn: 302316

7 years ago[BitVector] Improve the description of the BitVector::clear to say it removes the...
Craig Topper [Fri, 5 May 2017 22:46:40 +0000 (22:46 +0000)]
[BitVector] Improve the description of the BitVector::clear to say it removes the bits rather than clearing since clearing could be interpreted as just zeroing. NFC

llvm-svn: 302315

7 years agoAdd DidStartExecuting/WillFinishExecuting methods to Expression.
Lang Hames [Fri, 5 May 2017 22:42:13 +0000 (22:42 +0000)]
Add DidStartExecuting/WillFinishExecuting methods to Expression.

These methods can be used by the derived expression types to perform expression
specific and/or language specific actions before and after the expression runs.
(ThreadPlanCallUserExpression is modified to call these methods on the
expression immediately before/after execution of the expression).

The immediate motivation is allowing Swift expressions to notify the swift
runtime that exclusivity enforcement should be suspended while the expression
runs (we want LLDB expressions to be able to access variables even when they're
considered exclusively owned by someone else in the original program).

Reviewed in https://reviews.llvm.org/D32889

llvm-svn: 302314

7 years agoAArch64: fix weird edge case in ABI.
Tim Northover [Fri, 5 May 2017 22:36:06 +0000 (22:36 +0000)]
AArch64: fix weird edge case in ABI.

It turns out there are some sort-of-but-not-quite empty structs that break all
the rules. For example:

struct SuperEmpty { int arr[0]; };
struct SortOfEmpty { struct SuperEmpty e; };

Both of these have sizeof == 0, even in C++ mode, for GCC compatibility. The
first one also doesn't occupy a register when passed by value in GNU C++ mode,
unlike everything else.

On Darwin, we want to ignore the lot (and especially don't want to try to use
an i0 as we were).

llvm-svn: 302313

7 years agoPermit keywords in module names in #pragma clang module *.
Richard Smith [Fri, 5 May 2017 22:34:07 +0000 (22:34 +0000)]
Permit keywords in module names in #pragma clang module *.

This is necessary to be able to build a libc++ module from preprocessed source
(due to the submodule std.new).

llvm-svn: 302312

7 years agoFix spelling error in command line option description. NFC
Craig Topper [Fri, 5 May 2017 22:31:11 +0000 (22:31 +0000)]
Fix spelling error in command line option description. NFC

llvm-svn: 302311

7 years ago[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Fri, 5 May 2017 22:30:37 +0000 (22:30 +0000)]
[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

llvm-svn: 302310

7 years agoAdd support for building modules from preprocessed source.
Richard Smith [Fri, 5 May 2017 22:18:51 +0000 (22:18 +0000)]
Add support for building modules from preprocessed source.

To support this, an optional marker "#pragma clang module contents" is
recognized in module map files, and the rest of the module map file from that
point onwards is treated as the source of the module. Preprocessing a module
map produces the input module followed by the marker and then the preprocessed
contents of the module.

Ignoring line markers, a preprocessed module might look like this:

  module A {
    header "a.h"
  }
  #pragma clang module contents
  #pragma clang module begin A
  // ... a.h ...
  #pragma clang module end

The preprocessed output generates line markers, which are not accepted by the
module map parser, so -x c++-module-map-cpp-output should be used to compile
such outputs.

A couple of major parts do not work yet:

1) The files that are listed in the module map must exist on disk, in order to
   build the on-disk header -> module lookup table in the PCM file. To fix
   this, we need the preprocessed output to track the file size and other stat
   information we might use to build the lookup table.

2) Declaration ownership semantics don't work properly yet, since mapping from
   a source location to a module relies on mapping from FileIDs to modules,
   which we can't do if module transitions can occur in the middle of a file.

llvm-svn: 302309

7 years agoOverride invalidate of ProfileSummaryInfo to return false.
Easwaran Raman [Fri, 5 May 2017 22:15:09 +0000 (22:15 +0000)]
Override invalidate of ProfileSummaryInfo to return false.

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

llvm-svn: 302308

7 years ago[Hexagon] Disable predicated calls by default
Krzysztof Parzyszek [Fri, 5 May 2017 22:13:57 +0000 (22:13 +0000)]
[Hexagon] Disable predicated calls by default

llvm-svn: 302307

7 years ago[Hexagon] Remove C6 and C7 as separate registers
Krzysztof Parzyszek [Fri, 5 May 2017 22:12:12 +0000 (22:12 +0000)]
[Hexagon] Remove C6 and C7 as separate registers

These are M0 and M1. Removing duplicated registers reduces the number
of explicit register aliasing.

llvm-svn: 302306

7 years ago[RDF] Remove covered parts of reached uses for phi and use in same block
Krzysztof Parzyszek [Fri, 5 May 2017 22:10:32 +0000 (22:10 +0000)]
[RDF] Remove covered parts of reached uses for phi and use in same block

llvm-svn: 302305

7 years agolld Fixups for TypeDatabase changes.
Zachary Turner [Fri, 5 May 2017 22:06:06 +0000 (22:06 +0000)]
lld Fixups for TypeDatabase changes.

llvm-svn: 302304

7 years agoARM: Compute MaxCallFrame size early
Matthias Braun [Fri, 5 May 2017 22:04:05 +0000 (22:04 +0000)]
ARM: Compute MaxCallFrame size early

This exposes a method in MachineFrameInfo that calculates
MaxCallFrameSize and calls it after instruction selection in the ARM
target.

This avoids
ARMBaseRegisterInfo::canRealignStack()/ARMFrameLowering::hasReservedCallFrame()
giving different answers in early/late phases of codegen.

The testcase shows a particular nasty example result of that where we
would fail to properly align an alloca.

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

llvm-svn: 302303

7 years ago[CodeView] Reserve TypeDatabase records up front.
Zachary Turner [Fri, 5 May 2017 22:02:37 +0000 (22:02 +0000)]
[CodeView] Reserve TypeDatabase records up front.

Most of the time we know exactly how many type records we
have in a list, and we want to use the visitor to deserialize
them into actual records in a database.  Previously we were
just using push_back() every time without reserving the space
up front in the vector.  This is obviously terrible from a
performance standpoint, and it's not uncommon to have PDB
files with half a million type records, where the performance
degredation was quite noticeable.

llvm-svn: 302302

7 years agoAdd missing target triple to test
Matthias Braun [Fri, 5 May 2017 21:50:26 +0000 (21:50 +0000)]
Add missing target triple to test

llvm-svn: 302301

7 years ago[scudo] Add Android support
Kostya Kortchinsky [Fri, 5 May 2017 21:38:22 +0000 (21:38 +0000)]
[scudo] Add Android support

Summary:
This change adds Android support to the allocator (but doesn't yet enable it in
the cmake config), and should be the last fragment of the rewritten change
D31947.

Android has more memory constraints than other platforms, so the idea of a
unique context per thread would not have worked. The alternative chosen is to
allocate a set of contexts based on the number of cores on the machine, and
share those contexts within the threads. Contexts can be dynamically reassigned
to threads to prevent contention, based on a scheme suggested by @dvyuokv in
the initial review.

Additionally, given that Android doesn't support ELF TLS (only emutls for now),
we use the TSan TLS slot to make things faster: Scudo is mutually exclusive
with other sanitizers so this shouldn't cause any problem.

An additional change made here, is replacing `thread_local` by `THREADLOCAL`
and using the initial-exec thread model in the non-Android version to prevent
extraneous weak definition and checks on the relevant variables.

Reviewers: kcc, dvyukov, alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, mgorny, llvm-commits

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

llvm-svn: 302300

7 years agoDelete LinkerScript::getSectionIndex.
Rafael Espindola [Fri, 5 May 2017 21:34:26 +0000 (21:34 +0000)]
Delete LinkerScript::getSectionIndex.

We can set SectionIndex tentatively as we process the linker script
instead of looking it repeatedly.

In general we should try to have as few name lookups as possible.

llvm-svn: 302299

7 years agoMark test using <sys/time.h> as UNSUPPORTED on Windows
Eric Fiselier [Fri, 5 May 2017 21:32:37 +0000 (21:32 +0000)]
Mark test using <sys/time.h> as UNSUPPORTED on Windows

llvm-svn: 302298

7 years agoFix condition_variable::wait_until and wait_for on Windows.
Eric Fiselier [Fri, 5 May 2017 21:31:22 +0000 (21:31 +0000)]
Fix condition_variable::wait_until and wait_for on Windows.

The ERROR_TIMEDOUT returned by the Windows API does not
have the same value as ETIMEDOUT. This caused condition_variable
to return timeouts as unknown errors.

llvm-svn: 302297

7 years agoMultilib: add dump methods
Jonathan Roelofs [Fri, 5 May 2017 21:30:13 +0000 (21:30 +0000)]
Multilib: add dump methods

llvm-svn: 302296

7 years agoFix build breakage on Linux.
Rui Ueyama [Fri, 5 May 2017 21:27:30 +0000 (21:27 +0000)]
Fix build breakage on Linux.

llvm-svn: 302295

7 years agoFix -Wreorder warning.
Zachary Turner [Fri, 5 May 2017 21:25:31 +0000 (21:25 +0000)]
Fix -Wreorder warning.

llvm-svn: 302294

7 years agoFix another incorrectly cased header include.
Zachary Turner [Fri, 5 May 2017 21:18:26 +0000 (21:18 +0000)]
Fix another incorrectly cased header include.

llvm-svn: 302293

7 years ago[StreamArray] Pipe the Offset through the constructor.
Zachary Turner [Fri, 5 May 2017 21:15:31 +0000 (21:15 +0000)]
[StreamArray] Pipe the Offset through the constructor.

When randomly accessing an element by offset, we weren't passing
the offset through so if you called .offset() it would return a
value of 0.

llvm-svn: 302292

7 years agoFix #include case sensitivity problem.
Zachary Turner [Fri, 5 May 2017 21:14:55 +0000 (21:14 +0000)]
Fix #include case sensitivity problem.

llvm-svn: 302291

7 years ago[AMDGPU] In the new waitcnt insertion pass, use getHeader
Kannan Narayanan [Fri, 5 May 2017 21:10:17 +0000 (21:10 +0000)]
[AMDGPU] In the new waitcnt insertion pass, use getHeader
         instead of getTopBlock to find the loop header.

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

llvm-svn: 302290

7 years agoMIParser/MIRPrinter: Compute block successors if not explicitely specified
Matthias Braun [Fri, 5 May 2017 21:09:30 +0000 (21:09 +0000)]
MIParser/MIRPrinter: Compute block successors if not explicitely specified

- MIParser: If the successor list is not specified successors will be
  added based on basic block operands in the block and possible
  fallthrough.

- MIRPrinter: Adds a new `simplify-mir` option, with that option set:
  Skip printing of block successor lists in cases where the
  parser is guaranteed to reconstruct it. This means we still print the
  list if some successor cannot be determined (happens for example for
  jump tables), if the successor order changes or branch probabilities
  being unequal.

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

llvm-svn: 302289

7 years agoSplit up Parallel and LLVM'ize naming conventions.
Zachary Turner [Fri, 5 May 2017 21:09:26 +0000 (21:09 +0000)]
Split up Parallel and LLVM'ize naming conventions.

This is one step in preparation of raising this up to
LLVM.  This hides all of the Executor stuff in a private
implementation file, leaving only the core algorithms and
the TaskGroup class exposed.  In doing so, fix up all the
variable names to conform to LLVM style.

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

llvm-svn: 302288

7 years agoAdd cxxStdInitializerListExpr AST matcher
Jakub Kuderski [Fri, 5 May 2017 21:01:12 +0000 (21:01 +0000)]
Add cxxStdInitializerListExpr AST matcher

Summary:
This adds a new ASTMatcher for CXXStdInitializerListExprs that matches C++ initializer list expressions.

The primary motivation is to use it to fix [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]] (review here [[ https://reviews.llvm.org/D32767 | D32767 ]]).

Reviewers: alexfh, Prazek, aaron.ballman

Reviewed By: alexfh, aaron.ballman

Subscribers: malcolm.parsons, cfe-commits, klimek

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

llvm-svn: 302287