platform/upstream/llvm.git
5 years ago[X86] Update VBMI2 vshld/vshrd tests to use an immediate that doesn't require a modulo.
Craig Topper [Mon, 7 Jan 2019 05:58:53 +0000 (05:58 +0000)]
[X86] Update VBMI2 vshld/vshrd tests to use an immediate that doesn't require a modulo.

Planning to replace these with funnel shift intrinsics which would mask out the extra bits. This will help minimize test diffs.

llvm-svn: 350504

5 years ago[CallSite removal] Migrate all Alias Analysis APIs to use the newly
Chandler Carruth [Mon, 7 Jan 2019 05:42:51 +0000 (05:42 +0000)]
[CallSite removal] Migrate all Alias Analysis APIs to use the newly
minted `CallBase` class instead of the `CallSite` wrapper.

This moves the largest interwoven collection of APIs that traffic in
`CallSite`s. While a handful of these could have been migrated with
a minorly more shallow migration by converting from a `CallSite` to
a `CallBase`, it hardly seemed worth it. Most of the APIs needed to
migrate together because of the complex interplay of AA APIs and the
fact that converting from a `CallBase` to a `CallSite` isn't free in its
current implementation.

Out of tree users of these APIs can fairly reliably migrate with some
combination of `.getInstruction()` on the `CallSite` instance and
casting the resulting pointer. The most generic form will look like `CS`
-> `cast_or_null<CallBase>(CS.getInstruction())` but in most cases there
is a more elegant migration. Hopefully, this migrates enough APIs for
users to fully move from `CallSite` to the base class. All of the
in-tree users were easily migrated in that fashion.

Thanks for the review from Saleem!

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

llvm-svn: 350503

5 years ago[CallSite removal] Add `CallBase` support to the `InstVisitor` in such
Chandler Carruth [Mon, 7 Jan 2019 05:15:49 +0000 (05:15 +0000)]
[CallSite removal] Add `CallBase` support to the `InstVisitor` in such
a way that it still supports `CallSite` but users can be ported to rely
on `CallBase` instead.

This will unblock the ports across the analysis and transforms libraries
(and out-of-tree users) and once done we can clean this up by removing
the `CallSite` layer.

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

llvm-svn: 350502

5 years ago[SemaCXX] Fix ICE for unexpanded parameter pack
Brian Gesiak [Mon, 7 Jan 2019 03:25:59 +0000 (03:25 +0000)]
[SemaCXX] Fix ICE for unexpanded parameter pack

Summary:
The documentation for RecursiveASTVisitor::TraverseDecl states that the
Decl being traversed may be null. In fact, this is the case when a
CXXCatchStmt with no exception decl is traversed. Because the visitor
for diagnosing unexpanded parameter packs does not check for null, it
ends up crashing when it attempts to call the Decl::isParameterPack
method on a null Decl pointer.

Add a null check to prevent an ICE, and a test case that would crash
otherwise. Also, because the test requires C++ exceptions and C++14,
change the test parameters for the entire test file. (Alternatively, I
thought about adding a new test file, but went with this approach for my
own convenience.)

Co-authored-by: Andreas Molzer <andreas.molzer@gmx.de>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 350501

5 years ago[gn build] Add build files for llvm/lib/Target/ARM + tests
Nico Weber [Mon, 7 Jan 2019 01:26:12 +0000 (01:26 +0000)]
[gn build] Add build files for llvm/lib/Target/ARM + tests

The ARM target itself is similar to the X86 target in https://reviews.llvm.org/rL348903
The llvm-exegesis unittests ARM bits are similar to the X86 bits in https://reviews.llvm.org/rL350413
Both are similar to the corresponding AArch64 bits in https://reviews.llvm.org/rL350499 too

After this, everything in my local GN branch is upstreamed to LLVM.

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

llvm-svn: 350500

5 years ago[gn build] Add build files for llvm/lib/Target/AArch64 + tests
Nico Weber [Mon, 7 Jan 2019 01:23:11 +0000 (01:23 +0000)]
[gn build] Add build files for llvm/lib/Target/AArch64 + tests

The AArch64 target itself is similar to the X86 target in https://reviews.llvm.org/rL348903
The llvm-exegesis AArch64 bits are similar to the X86 bits in http://reviews.llvm.org/rL350184
The llvm-exegesis unittests AArch64 bits are similar to the X86 bits in https://reviews.llvm.org/rL350413

llvm/unittests/Target/AArch64 doesn't have an equivalent since the X86 Target
only has lit tests, no unittests.

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

llvm-svn: 350499

5 years ago[X86] Add support for matching vector funnel shift to AVX512VBMI2 instructions.
Craig Topper [Sun, 6 Jan 2019 18:10:18 +0000 (18:10 +0000)]
[X86] Add support for matching vector funnel shift to AVX512VBMI2 instructions.

Summary: AVX512VBMI2 supports a funnel shift by immediate and a funnel shift by a variable vector.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 350498

5 years agoRevert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp files""
Lama Saba [Sun, 6 Jan 2019 16:39:14 +0000 (16:39 +0000)]
Revert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp files""

This reverts commit rL350493
issues related to modules  still appear in http://green.lab.llvm.org/green/job/lldb-cmake

llvm-svn: 350497

5 years ago[x86] explicitly set cost of integer add/sub
Sanjay Patel [Sun, 6 Jan 2019 16:21:42 +0000 (16:21 +0000)]
[x86] explicitly set cost of integer add/sub

There are no test changes here in the existing cost model
regression tests because integer add/sub have a default
legal cost of 1 already. This would break, however, if
we custom lower those ops because the default cost model
assumes that custom-lowered ops are more expensive.

This is similar to the change in rL350403. See discussion
in D56011 for more details. When we enhance that patch to
handle integer ops, we need this cost model change to avoid
unintended diffs here from the custom lowering.

llvm-svn: 350496

5 years agoFix bug in test found by the diagnostic added in r350340.
Nico Weber [Sun, 6 Jan 2019 15:57:18 +0000 (15:57 +0000)]
Fix bug in test found by the diagnostic added in r350340.

I meant to commit this change in 350341 but failed to do so (since it's
in test/CodeGenCXX, not in test/Frontend).

llvm-svn: 350495

5 years ago[gn build] Merge r350341
Nico Weber [Sun, 6 Jan 2019 15:49:10 +0000 (15:49 +0000)]
[gn build] Merge r350341

Adds a build file for llvm-elfabi and makes check-llvm depend on it.

llvm-svn: 350494

5 years agoResubmit rL345008 "Split MachinePipeliner code into header and cpp files"
Lama Saba [Sun, 6 Jan 2019 15:45:40 +0000 (15:45 +0000)]
Resubmit rL345008 "Split MachinePipeliner code into header and cpp files"

Resubmitted in rL345290 and reverted in rL350345 due to failures in
http://green.lab.llvm.org/green/job/lldb-cmake/
Resubmitting after a workaround to lldb-cmake failure was
committed in rL350346, more info in https://reviews.llvm.org/D56084

llvm-svn: 350493

5 years ago[gn build] Add build files for LLVM unittests with a custom main() function
Nico Weber [Sun, 6 Jan 2019 15:09:22 +0000 (15:09 +0000)]
[gn build] Add build files for LLVM unittests with a custom main() function

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

llvm-svn: 350492

5 years ago[CMake] Use hidden visibility for static libc++ in Fuchsia
Petr Hosek [Sun, 6 Jan 2019 08:23:56 +0000 (08:23 +0000)]
[CMake] Use hidden visibility for static libc++ in Fuchsia

This is enables the use of libc++ in contexts such as device drivers.

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

llvm-svn: 350491

5 years ago[LegalizeVectorOps] Add FSHL/FSHR to the list of vector operations that should be...
Craig Topper [Sun, 6 Jan 2019 07:06:35 +0000 (07:06 +0000)]
[LegalizeVectorOps] Add FSHL/FSHR to the list of vector operations that should be handled.

The FSHL/FSHR nodes are handled in the expand function, but they need to also be listed in the code that queries for the operation action too.

llvm-svn: 350490

5 years ago[libcxx] Support building hermetic static library
Petr Hosek [Sun, 6 Jan 2019 06:14:31 +0000 (06:14 +0000)]
[libcxx] Support building hermetic static library

This is useful when static libc++ library is being linked into
shared libraries that may be used in combination with libraries.
We want to avoid we exporting libc++ symbols in those cases where
this option is useful. This is provided as a CMake option and can
be enabled by libc++ vendors as needed.

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

llvm-svn: 350489

5 years ago[compiler-rt][Fuchsia] Replace _zx_vmar_allocate_old call
Petr Hosek [Sun, 6 Jan 2019 05:19:05 +0000 (05:19 +0000)]
[compiler-rt][Fuchsia] Replace _zx_vmar_allocate_old call

This is the deprecated legacy interface, replace it with the current
_zx_vmar_allocate one.

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

llvm-svn: 350488

5 years agoHave MSVC Visualizer for DeducedTemplateSpecializationType show both the original...
Mike Spertus [Sun, 6 Jan 2019 04:58:48 +0000 (04:58 +0000)]
Have MSVC Visualizer for DeducedTemplateSpecializationType show both the original template and deduced specialization

Now appears in the Autos window something like

- MyType DeducedTemplateSpecializationType  {struct Y<int>}
|- Template template<typename T> struct Y;
|- Deduced As struct Y<int>
|- isDeduced true bool
|- TypeClass DeducedTemplateSpecialization (36)
|- Flags No TypeBits set beyond TypeClass
|- Canonical RecordType  {struct Y<int>}

Also changed QualType visualization to auto-expand the BaseType

llvm-svn: 350487

5 years ago[CMake][Fuchsia] Enable build ID, relaxations for first stage
Petr Hosek [Sun, 6 Jan 2019 04:14:51 +0000 (04:14 +0000)]
[CMake][Fuchsia] Enable build ID, relaxations for first stage

We want these to be used for the second stage compiler as well.

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

llvm-svn: 350486

5 years agoFix PR39749 - Headers containing just #error harm __has_include.
Eric Fiselier [Sun, 6 Jan 2019 00:37:31 +0000 (00:37 +0000)]
Fix PR39749 - Headers containing just #error harm __has_include.

This patch changes <experimental/foo> to use #warning instead of
is harmful to common feature detection idioms.

We should also consider only emitting the warning when __DEPRECATED is
defined, like we do in the <ext/foo> headers. Users may want to specify
"-Werror=-W#warnings" while still ignoring the libc++ warnings.

llvm-svn: 350485

5 years agoRevert "[CMake][Fuchsia] Enable experimental new pass manager by default"
Petr Hosek [Sat, 5 Jan 2019 23:45:31 +0000 (23:45 +0000)]
Revert "[CMake][Fuchsia] Enable experimental new pass manager by default"

This reverts commit r350461 as it causes many of the Clang tests to fail.

llvm-svn: 350484

5 years ago[X86][AsmParser] Don't allow X86::DX in CheckBaseRegAndIndexRegAndScale.
Craig Topper [Sat, 5 Jan 2019 23:30:28 +0000 (23:30 +0000)]
[X86][AsmParser] Don't allow X86::DX in CheckBaseRegAndIndexRegAndScale.

This was here because out and in instructions allow '(%dx)' even though its not a memory reference. To handle this we build a special operand for the DX register reference before we get to the call to CheckBaseRegAndIndexRegAndScale. So we no longer need this special case.

llvm-svn: 350483

5 years agoFix MSVC Visualization for TemplateTypeParmType and TemplateTypeParmDecl
Mike Spertus [Sat, 5 Jan 2019 23:15:30 +0000 (23:15 +0000)]
Fix MSVC Visualization for TemplateTypeParmType and TemplateTypeParmDecl

llvm-svn: 350482

5 years ago[X86] Use two pmovmskbs in combineBitcastvxi1 for (i64 (bitcast (v64i1 (truncate...
Craig Topper [Sat, 5 Jan 2019 22:42:58 +0000 (22:42 +0000)]
[X86] Use two pmovmskbs in combineBitcastvxi1 for (i64 (bitcast (v64i1 (truncate (v64i8)))) on KNL.

llvm-svn: 350481

5 years ago[X86] Allow combinevxi1Bitcast to use pmovmskb on avx512 targets if the input is...
Craig Topper [Sat, 5 Jan 2019 21:40:07 +0000 (21:40 +0000)]
[X86] Allow combinevxi1Bitcast to use pmovmskb on avx512 targets if the input is a truncate from v16i8/v32i8.

This is especially helpful on targets without avx512bw since we don't have a good way to convert from v16i8/v32i8 to v16i1/v32i1 for the truncate anyway. If we're just going to convert it to a GPR we might as well use pmovmskb to accomplish both.

llvm-svn: 350480

5 years agoFix symbols.enable-external-lookup description wording
Jan Kratochvil [Sat, 5 Jan 2019 21:39:03 +0000 (21:39 +0000)]
Fix symbols.enable-external-lookup description wording

D55859 changed "external tools or libraries" to "external sources" according to
Pavel Labath.  Now it is changed sort of back to "external tools and
repositories" according to Adrian Prantl.
https://reviews.llvm.org/D55859#1345881

llvm-svn: 350479

5 years agoFix flaky symlink access time test.
Eric Fiselier [Sat, 5 Jan 2019 21:18:10 +0000 (21:18 +0000)]
Fix flaky symlink access time test.

last_write_time(sym, new_time) changes the modification time of the file
referenced by the symlink. But reading through the symlink may change the
symlinks's access time.

This meant the previous test that checked that the symlinks access
time was unchanged was incorrect and made the test flaky.

This patch removes this test (there really is no non-flaky way
to test that the new access time coorisponds to the time at which
the symlink was last dereferenced). This should unflake the test.

llvm-svn: 350478

5 years agoRevert "D56064: More tolerance for flaky tests in libc++ on NetBSD"
Kamil Rytarowski [Sat, 5 Jan 2019 20:11:54 +0000 (20:11 +0000)]
Revert "D56064: More tolerance for flaky tests in libc++ on NetBSD"

Requested by EricWF.

llvm-svn: 350477

5 years agoCodeGen: fix autolink emission on ELF
Saleem Abdulrasool [Sat, 5 Jan 2019 19:27:12 +0000 (19:27 +0000)]
CodeGen: fix autolink emission on ELF

The autolinking extension for ELF uses a slightly different format for
encoding the autolink information compared to COFF and MachO.  Account
for this in the CGM to ensure that we do not assert when emitting
assembly or an object file.

llvm-svn: 350476

5 years agoAdded single use check to ShrinkDemandedConstant
Stanislav Mekhanoshin [Sat, 5 Jan 2019 19:20:00 +0000 (19:20 +0000)]
Added single use check to ShrinkDemandedConstant

Fixes cvt_f32_ubyte combine. performCvtF32UByteNCombine() could shrink
source node to demanded bits only even if there are other uses.

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

llvm-svn: 350475

5 years ago[X86] Regenerate test to merge 32-bit and 64-bit check lines. NFC
Craig Topper [Sat, 5 Jan 2019 19:19:37 +0000 (19:19 +0000)]
[X86] Regenerate test to merge 32-bit and 64-bit check lines. NFC

llvm-svn: 350474

5 years ago[X86] Allow LowerTRUNCATE to use PACKUS/PACKSS for v16i16->v16i8 truncate when -mpref...
Craig Topper [Sat, 5 Jan 2019 18:48:11 +0000 (18:48 +0000)]
[X86] Allow LowerTRUNCATE to use PACKUS/PACKSS for v16i16->v16i8 truncate when -mprefer-vector-width-256 is in effect and BWI is not available.

llvm-svn: 350473

5 years agoCodeGen: switch iteration to range based for loop (NFC)
Saleem Abdulrasool [Sat, 5 Jan 2019 18:39:32 +0000 (18:39 +0000)]
CodeGen: switch iteration to range based for loop (NFC)

Change a loop to range based instead while working on cleaning up some
modules autolinking issues on Linux.  NFC.

llvm-svn: 350472

5 years ago[InstCombine] Improve cttz/ctlz + icmp tests; NFC
Nikita Popov [Sat, 5 Jan 2019 17:36:05 +0000 (17:36 +0000)]
[InstCombine] Improve cttz/ctlz + icmp tests; NFC

Change part of the tests to use vectors (I'm using scalar for ugt
and vector for ult), add multiuse variations, rename %lz to %tz
for the cttz tests.

llvm-svn: 350471

5 years agoImprove MSVC type visualizations
Mike Spertus [Sat, 5 Jan 2019 17:01:34 +0000 (17:01 +0000)]
Improve MSVC type visualizations

Display TypeBits in a single line.
Fix bit rot in template visualizations
Rudimentary support for deduced types

llvm-svn: 350470

5 years agoEnhance MSVC visualization of PointerUnions
Mike Spertus [Sat, 5 Jan 2019 16:59:27 +0000 (16:59 +0000)]
Enhance MSVC visualization of PointerUnions

Add a "deref" view that displays the pointed to objects since
other visualizers often need to display data reference by internal
PointerUnions

llvm-svn: 350469

5 years ago[InstCombine] Add cttz/ctlz + icmp ugt/ult tests; NFC
Nikita Popov [Sat, 5 Jan 2019 15:51:59 +0000 (15:51 +0000)]
[InstCombine] Add cttz/ctlz + icmp ugt/ult tests; NFC

llvm-svn: 350468

5 years ago[python] Make the collections import future-proof
Serge Guelton [Sat, 5 Jan 2019 12:07:36 +0000 (12:07 +0000)]
[python] Make the collections import future-proof

On Python 3.7 the old code raises a warning:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
     class ArgumentsIterator(collections.Sequence):

On Python 3.8 it wouldn't work anymore.

Commited on behalf of Jakub Stasiak.

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

llvm-svn: 350467

5 years ago[Documentation] fix order of checks in checks/list.rst
Jonas Toth [Sat, 5 Jan 2019 11:40:05 +0000 (11:40 +0000)]
[Documentation] fix order of checks in checks/list.rst

llvm-svn: 350466

5 years ago[docs] Add a known limitation to the comment about lld supporting GCC/MinGW object...
Martin Storsjo [Sat, 5 Jan 2019 10:44:03 +0000 (10:44 +0000)]
[docs] Add a known limitation to the comment about lld supporting GCC/MinGW object files. NFC.

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

llvm-svn: 350465

5 years ago[MinGW] Expand comment for MinGW driver. NFC.
Martin Storsjo [Sat, 5 Jan 2019 10:43:59 +0000 (10:43 +0000)]
[MinGW] Expand comment for MinGW driver. NFC.

Originally authored by Rui Ueyama.

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

llvm-svn: 350464

5 years ago[InstCombine] Relax cttz/ctlz with select on zero
Nikita Popov [Sat, 5 Jan 2019 09:48:16 +0000 (09:48 +0000)]
[InstCombine] Relax cttz/ctlz with select on zero

The cttz/ctlz intrinsics have a parameter specifying whether the
result is undefined for zero. cttz(x, false) can be relaxed to
cttz(x, true) if x is known non-zero, and in fact such an optimization
is already performed. However, this currently doesn't work if x is
non-zero as a result of a select rather than an explicit branch.
This patch adds handling for this case, thus allowing
x != 0 ? cttz(x, false) : y to simplify to x != 0 ? cttz(x, true) : y.

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

llvm-svn: 350463

5 years ago[InstCombine] Add vector tests for select + ctlz/cttz; NFC
Nikita Popov [Sat, 5 Jan 2019 09:48:05 +0000 (09:48 +0000)]
[InstCombine] Add vector tests for select + ctlz/cttz; NFC

llvm-svn: 350462

5 years ago[CMake][Fuchsia] Enable experimental new pass manager by default
Petr Hosek [Sat, 5 Jan 2019 07:57:53 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable experimental new pass manager by default

This change enableds experimental new pass manager.

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

llvm-svn: 350461

5 years ago[CMake][Fuchsia] Enable x86 relaxation by default
Petr Hosek [Sat, 5 Jan 2019 07:57:46 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable x86 relaxation by default

This enables x86 relaxation by default. This depends on a linker new
enough to support the new reloc types but since we default to lld we
don't worry about host system linkers that might be too old to support
the new reloc types.

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

llvm-svn: 350460

5 years ago[CMake][Fuchsia] Enable --build-id linker flag by default
Petr Hosek [Sat, 5 Jan 2019 07:57:38 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable --build-id linker flag by default

This enables passing --build-id to linker by default.

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

llvm-svn: 350459

5 years ago[gn build] Merge r350423
Nico Weber [Sat, 5 Jan 2019 05:01:20 +0000 (05:01 +0000)]
[gn build] Merge r350423

llvm-svn: 350458

5 years ago[gn build] Add build files for unittests under llvm/unittests/ExecutionEngine
Nico Weber [Sat, 5 Jan 2019 04:05:25 +0000 (04:05 +0000)]
[gn build] Add build files for unittests under llvm/unittests/ExecutionEngine

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

llvm-svn: 350457

5 years ago[Inliner] Optimize shouldBeDeferred
Easwaran Raman [Sat, 5 Jan 2019 02:26:29 +0000 (02:26 +0000)]
[Inliner] Optimize shouldBeDeferred

This has some minor optimizations to shouldBeDeferred. This is not
strictly NFC because the early exit inside the loop assumes
TotalSecondaryCost is monotonically non-decreasing, which is not true if
the threshold used by CostAnalyzer is negative. AFAICT the thresholds do
not go below 0 for the default values of the various options we use.

llvm-svn: 350456

5 years ago[X86] Require second operand of X86vshiftuniform to be an integer. NFC
Craig Topper [Sat, 5 Jan 2019 01:40:29 +0000 (01:40 +0000)]
[X86] Require second operand of X86vshiftuniform to be an integer. NFC

We don't need to require the first operand to be an integer because we already said it was the same type as the result which we also constrained to an integer.

llvm-svn: 350455

5 years ago[gn build] Add build files for unittests that load shared libraries
Nico Weber [Sat, 5 Jan 2019 01:39:18 +0000 (01:39 +0000)]
[gn build] Add build files for unittests that load shared libraries

This is slightly ugly for three reasons:

- The shlib needs to go next to the binary to be found on all platforms, so the
  build files refer to target_out_dir
- The explicit -fPIC flag needed on the shared lib side, and the -rdynamic flag
  needed on the host side, on Linux
- Plugins that refer to LLVM code and assume that the host will resolve them
  don't work on Windows -- PluginsTests won't test anything on Windows (but
  DynamicLibraryTests will, since the dll here doesn't call LLVM code)

If we get lots more of these plugin / plugin host targets it might make sense
to add a template for them. But for now, these are the last ones we need.

(We're at 6 plugin hosts, 2 of them tests, and at 6 shared libraries, 2 of them
tests as well. clang is a plugin host by default in the CMake build but not
(yet?) in the GN build.)

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

llvm-svn: 350454

5 years agoLet new test from r350340 still pass even after r350451.
Nico Weber [Sat, 5 Jan 2019 01:19:14 +0000 (01:19 +0000)]
Let new test from r350340 still pass even after r350451.

llvm-svn: 350453

5 years ago[LLD][COFF] PDB: Parallel sort publics
Alexandre Ganea [Sat, 5 Jan 2019 01:16:24 +0000 (01:16 +0000)]
[LLD][COFF] PDB: Parallel sort publics

Saves up to 1.3 sec on large PDBs.
Figures below are for the "Globals Stream Layout" pass:

                            Before This patch
Large EXE (PDB is ~2 GB) 3330 ms 2022 ms
Large EXE (PDB is ~2 GB) 2680 ms 1608 ms
Large DLL (PDB is ~1 GB) 1455 ms 938 ms
Large DLL (PDB is ~800 MB) 1215 ms 800 ms
Small DLL (PDB is ~200 MB) 224 ms 146 ms

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

llvm-svn: 350452

5 years agoMove -add-plugin validation after -load was executed.
Nico Weber [Sat, 5 Jan 2019 01:10:20 +0000 (01:10 +0000)]
Move -add-plugin validation after -load was executed.

Moves the code added in r350340 around a bit, to hopefully make the existing
plugin tests pass when clang is built with examples enabled.

llvm-svn: 350451

5 years ago[LLD][COFF] Fix namespace compilation issue with a upcoming patch. NFC
Alexandre Ganea [Sat, 5 Jan 2019 01:08:10 +0000 (01:08 +0000)]
[LLD][COFF] Fix namespace compilation issue with a upcoming patch. NFC

llvm-svn: 350450

5 years agoRevert "Revert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)""
Evgeniy Stepanov [Sat, 5 Jan 2019 00:45:14 +0000 (00:45 +0000)]
Revert "Revert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)""

This reapplies commit r348984.

llvm-svn: 350449

5 years agoRevert "Revert "[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER...
Evgeniy Stepanov [Sat, 5 Jan 2019 00:44:58 +0000 (00:44 +0000)]
Revert "Revert "[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)""

This reapplies commit r348983.

llvm-svn: 350448

5 years ago[gn build] Add build file for DebugInfoPDBTests
Nico Weber [Sat, 5 Jan 2019 00:14:37 +0000 (00:14 +0000)]
[gn build] Add build file for DebugInfoPDBTests

I'm pretty unhappy this patch: DebugInfoPDBTests uses an API that requires some
magic txt file to be next to the unit test executable that stores the absolute
path to the LLVM source root.

The choices here are:

1. Don't use the unittest() template for DebugInfoPDBTests and set output_dir
   for unit tests in two places (the gni file for every test but this one, and the
   BUILD.gn file for this specific test).

2. Add another unittest_foo() template variation for this one test.

I went with the former, and added a comment to the template to look out for
this.

(The CMake build has the same issue.)

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

llvm-svn: 350447

5 years ago[Driver] Some more cleanup. NFC
Jonas Devlieghere [Sat, 5 Jan 2019 00:01:04 +0000 (00:01 +0000)]
[Driver] Some more cleanup. NFC

llvm-svn: 350446

5 years agoBring back the pthread_create interceptor, but only on non-aarch64.
Peter Collingbourne [Fri, 4 Jan 2019 23:24:02 +0000 (23:24 +0000)]
Bring back the pthread_create interceptor, but only on non-aarch64.

We still need the interceptor on non-aarch64 to untag the pthread_t
and pthread_attr_t pointers and disable tagging on allocations done
internally by glibc.

llvm-svn: 350445

5 years agoDisable system-allocator-fallback.cc test on Android O and earlier.
Peter Collingbourne [Fri, 4 Jan 2019 23:10:47 +0000 (23:10 +0000)]
Disable system-allocator-fallback.cc test on Android O and earlier.

The dynamic loader on Android O appears to have a bug where it crashes
when dlopening DF_1_GLOBAL libraries.

llvm-svn: 350444

5 years ago[sanitizer] Reduce stack depot size on Android.
Evgeniy Stepanov [Fri, 4 Jan 2019 22:55:04 +0000 (22:55 +0000)]
[sanitizer] Reduce stack depot size on Android.

Summary:
The default setting kTabSizeLog=20 results in an 8Mb global hash table,
almost all of it in private pages. That is not a sane setting in a
mobile, system-wide use case: with ~150 concurrent processes stack
depot will account for more than 1Gb of RAM.

Reviewers: kcc, pcc

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 350443

5 years ago[PGO] Use SourceFileName rather module name in PGOFuncName
Rong Xu [Fri, 4 Jan 2019 22:54:03 +0000 (22:54 +0000)]
[PGO] Use SourceFileName rather module name in PGOFuncName

In LTO or Thin-lto mode (though linker plugin), the module
names are of temp file names which are different for
different compilations. Using SourceFileName avoids the issue.
This should not change any functionality for current PGO as
all the current callers of getPGOFuncName() is before LTO.

llvm-svn: 350442

5 years ago[OpenMP] Refactor const restriction for linear
Joel E. Denny [Fri, 4 Jan 2019 22:12:13 +0000 (22:12 +0000)]
[OpenMP] Refactor const restriction for linear

As discussed in D56113, this patch refactors the implementation of the
const restriction for linear to reuse a function introduced by D56113.
A side effect is that, if a variable has mutable members, this
diagnostic is now skipped, and the diagnostic for the variable not
being an integer or pointer is reported instead.

Reviewed By: ABataev

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

llvm-svn: 350441

5 years ago[OpenMP] Refactor const restriction for reductions
Joel E. Denny [Fri, 4 Jan 2019 22:11:56 +0000 (22:11 +0000)]
[OpenMP] Refactor const restriction for reductions

As discussed in D56113, this patch refactors the implementation of the
const restriction for reductions to reuse a function introduced by
D56113.  A side effect is that diagnostics sometimes now say
"variable" instead of "list item" when a list item is a variable.

Reviewed By: ABataev

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

llvm-svn: 350440

5 years ago[OpenMP] Replace predetermined shared for const variable
Joel E. Denny [Fri, 4 Jan 2019 22:11:31 +0000 (22:11 +0000)]
[OpenMP] Replace predetermined shared for const variable

The following appears in OpenMP 3.1 sec. 2.9.1.1 as a predetermined
data-sharing attribute:

> Variables with const-qualified type having no mutable member are
> shared.

It does not appear in OpenmP 4.0, 4.5, or 5.0.  This patch removes the
implementation of that attribute when the requested OpenMP version is
greater than 3.1.

One effect of that removal is that `default(none)` affects const
variables without mutable members.

Also, without this patch, if a const variable without mutable members
was explicitly lastprivate or private, it was an error because it was
predetermined shared.  Now, clang instead complains that it's const
without mutable fields, which is a more intelligible diagnostic.  That
should be fine for all of the above versions because they all have
something like the following, which is quoted from OpenMP 5.0
sec. 2.19.3:

> A variable that is privatized must not have a const-qualified type
> unless it is of class type with a mutable member. This restriction does
> not apply to the firstprivate clause.

reduction and linear clauses already have separate checks for const
variables.  Future patches will merge the implementations.

Reviewed By: ABataev

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

llvm-svn: 350439

5 years ago[LLD][COFF] Fix file/line retrieval when a undefined symbol is to be printed
Alexandre Ganea [Fri, 4 Jan 2019 21:49:22 +0000 (21:49 +0000)]
[LLD][COFF] Fix file/line retrieval when a undefined symbol is to be printed

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

llvm-svn: 350438

5 years ago[X86] Fix warning; NFC
Nikita Popov [Fri, 4 Jan 2019 21:41:35 +0000 (21:41 +0000)]
[X86] Fix warning; NFC

llvm-svn: 350437

5 years agoUpdate the pr_datasz of .note.gnu.property section.
Vyacheslav Zakharin [Fri, 4 Jan 2019 21:25:01 +0000 (21:25 +0000)]
Update the pr_datasz of .note.gnu.property section.
Patch by Xiang Zhang.

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

llvm-svn: 350436

5 years ago[BDCE] Remove dead uses of arguments
Nikita Popov [Fri, 4 Jan 2019 21:21:43 +0000 (21:21 +0000)]
[BDCE] Remove dead uses of arguments

In addition to finding dead uses of instructions, also find dead uses
of function arguments, and replace them with zero as well.

I'm changing the way the known bits are computed here to remove the
coupling between the transfer function and the algorithm. It previously
relied on the first op being visited first and computing known bits --
unless the first op is not an instruction, in which case they're computed
on the second op. I could have adjusted this to check for "instruction
or argument", but I think it's better to avoid the repeated calculation
with an explicit flag.

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

llvm-svn: 350435

5 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Fri, 4 Jan 2019 21:02:25 +0000 (21:02 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Improve the modeling of ASIMD loads and stores.

llvm-svn: 350434

5 years agoFix default-function-attr.c so that it works on Windows.
Peter Collingbourne [Fri, 4 Jan 2019 20:51:54 +0000 (20:51 +0000)]
Fix default-function-attr.c so that it works on Windows.

llvm-svn: 350433

5 years ago[X86] Add INSERT_SUBVECTOR to ComputeNumSignBits
Craig Topper [Fri, 4 Jan 2019 20:50:59 +0000 (20:50 +0000)]
[X86] Add INSERT_SUBVECTOR to ComputeNumSignBits

This adds support for calculating sign bits of insert_subvector. I based it on the computeKnownBits.

My motivating case is propagating sign bits information across basic blocks on AVX targets where concatenating using insert_subvector is common.

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

llvm-svn: 350432

5 years ago[OPENMP][NVPTX]General formatting/code improvement, NFC.
Alexey Bataev [Fri, 4 Jan 2019 20:16:54 +0000 (20:16 +0000)]
[OPENMP][NVPTX]General formatting/code improvement, NFC.

Summary: Formatting.

Reviewers: gtbercea, grokos, kkwli0

Subscribers: guansong, openmp-commits, caomhin

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

llvm-svn: 350431

5 years ago[x86] add tests for potential horizontal vector ops; NFC
Sanjay Patel [Fri, 4 Jan 2019 20:14:53 +0000 (20:14 +0000)]
[x86] add tests for potential horizontal vector ops; NFC

These are modified versions of the FP tests from rL349923.

llvm-svn: 350430

5 years agohwasan: Implement lazy thread initialization for the interceptor ABI.
Peter Collingbourne [Fri, 4 Jan 2019 19:27:04 +0000 (19:27 +0000)]
hwasan: Implement lazy thread initialization for the interceptor ABI.

The problem is similar to D55986 but for threads: a process with the
interceptor hwasan library loaded might have some threads started by
instrumented libraries and some by uninstrumented libraries, and we
need to be able to run instrumented code on the latter.

The solution is to perform per-thread initialization lazily. If a
function needs to access shadow memory or add itself to the per-thread
ring buffer its prologue checks to see whether the value in the
sanitizer TLS slot is null, and if so it calls __hwasan_thread_enter
and reloads from the TLS slot. The runtime does the same thing if it
needs to access this data structure.

This change means that the code generator needs to know whether we
are targeting the interceptor runtime, since we don't want to pay
the cost of lazy initialization when targeting a platform with native
hwasan support. A flag -fsanitize-hwaddress-abi={interceptor,platform}
has been introduced for selecting the runtime ABI to target. The
default ABI is set to interceptor since it's assumed that it will
be more common that users will be compiling application code than
platform code.

Because we can no longer assume that the TLS slot is initialized,
the pthread_create interceptor is no longer necessary, so it has
been removed.

Ideally, lazy initialization should only cost one instruction in the
hot path, but at present the call may cause us to spill arguments
to the stack, which means more instructions in the hot path (or
theoretically in the cold path if the spills are moved with shrink
wrapping). With an appropriately chosen calling convention for
the per-thread initialization function (TODO) the hot path should
always need just one instruction and the cold path should need two
instructions with no spilling required.

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

llvm-svn: 350429

5 years ago[Scalar] Simplify comparison operators and add coverage.
Davide Italiano [Fri, 4 Jan 2019 19:23:52 +0000 (19:23 +0000)]
[Scalar] Simplify comparison operators and add coverage.

llvm-svn: 350428

5 years agohwasan: Use system allocator to realloc and free untagged pointers in interceptor...
Peter Collingbourne [Fri, 4 Jan 2019 19:21:51 +0000 (19:21 +0000)]
hwasan: Use system allocator to realloc and free untagged pointers in interceptor mode.

The Android dynamic loader has a non-standard feature that allows
libraries such as the hwasan runtime to interpose symbols even after
the symbol already has a value. The new value of the symbol is used to
relocate libraries loaded after the interposing library, but existing
libraries keep the old value. This behaviour is activated by the
DF_1_GLOBAL flag in DT_FLAGS_1, which is set by passing -z global to
the linker, which is what we already do to link the hwasan runtime.

What this means in practice is that if we have .so files that depend
on interceptor-mode hwasan without the main executable depending on
it, some of the libraries in the process will be using the hwasan
allocator and some will be using the system allocator, and these
allocators need to interact somehow. For example, if an instrumented
library calls a function such as strdup that allocates memory on
behalf of the caller, the instrumented library can reasonably expect
to be able to call free to deallocate the memory.

We can handle that relatively easily with hwasan by using tag 0 to
represent allocations from the system allocator. If hwasan's realloc
or free functions are passed a pointer with tag 0, the system allocator
is called.

One limitation is that this scheme doesn't work in reverse: if an
instrumented library allocates memory, it must free the memory itself
and cannot pass ownership to a system library. In a future change,
we may want to expose an API for calling the system allocator so
that instrumented libraries can safely transfer ownership of memory
to system libraries.

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

llvm-svn: 350427

5 years ago[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types
Aaron Enye Shi [Fri, 4 Jan 2019 19:09:20 +0000 (19:09 +0000)]
[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types

The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.

Reviewers: yaxunl

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

llvm-svn: 350426

5 years ago[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types
Aaron Enye Shi [Fri, 4 Jan 2019 19:05:41 +0000 (19:05 +0000)]
[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types

The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.

llvm-svn: 350425

5 years ago[ThinLTO] Clang changes to utilize new pass to handle chains of aliases
Teresa Johnson [Fri, 4 Jan 2019 19:05:01 +0000 (19:05 +0000)]
[ThinLTO] Clang changes to utilize new pass to handle chains of aliases

Summary:
As with NameAnonGlobals, invoke the new CanonicalizeAliases via clang
when using the new PM.

Depends on D54507.

Reviewers: pcc, davidxl

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, cfe-commits

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

llvm-svn: 350424

5 years ago[ThinLTO] Handle chains of aliases
Teresa Johnson [Fri, 4 Jan 2019 19:04:54 +0000 (19:04 +0000)]
[ThinLTO] Handle chains of aliases

At -O0, globalopt is not run during the compile step, and we can have a
chain of an alias having an immediate aliasee of another alias. The
summaries are constructed assuming aliases in a canonical form
(flattened chains), and as a result only the base object but no
intermediate aliases were preserved.

Fix by adding a pass that canonicalize aliases, which ensures each
alias is a direct alias of the base object.

Reviewers: pcc, davidxl

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits

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

llvm-svn: 350423

5 years ago[ObjCARC] Add an new attribute, objc_externally_retained
Erik Pilkington [Fri, 4 Jan 2019 18:33:06 +0000 (18:33 +0000)]
[ObjCARC] Add an new attribute, objc_externally_retained

This attribute, called "objc_externally_retained", exposes clang's
notion of pseudo-__strong variables in ARC. Pseudo-strong variables
"borrow" their initializer, meaning that they don't retain/release
it, instead assuming that someone else is keeping their value alive.

If a function is annotated with this attribute, implicitly strong
parameters of that function aren't implicitly retained/released in
the function body, and are implicitly const. This is useful to expose
for performance reasons, most functions don't need the extra safety
of the retain/release, so programmers can opt out as needed.

This attribute can also apply to declarations of local variables,
with similar effect.

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

llvm-svn: 350422

5 years ago[x86] lower extracted fadd/fsub to horizontal vector math; 2nd try
Sanjay Patel [Fri, 4 Jan 2019 17:48:13 +0000 (17:48 +0000)]
[x86] lower extracted fadd/fsub to horizontal vector math; 2nd try

The 1st try for this was at rL350369, but it caused IR-level diffs because
our cost models differentiate custom vs. legal/promote lowering. So that was
reverted at rL350373. The cost models were fixed independently at rL350403,
so this is effectively the same patch as last time.

Original commit message:
This would show up if we fix horizontal reductions to narrow as they go along,
but it's an improvement for size and/or Jaguar (fast-hops) independent of that.

We need to do this late to not interfere with other pattern matching of larger
horizontal sequences.

We can extend this to integer ops in a follow-up patch.

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

llvm-svn: 350421

5 years ago[CodeExtractor] Do not extract unsafe lifetime markers
Vedant Kumar [Fri, 4 Jan 2019 17:43:22 +0000 (17:43 +0000)]
[CodeExtractor] Do not extract unsafe lifetime markers

Lifetime markers which reference inputs to the extraction region are not
safe to extract. Example ('rhs' will be extracted):

```
               entry:
              +------------+
              | x = alloca |
              | y = alloca |
              +------------+
             /              \
   lhs:                      rhs:
  +-------------------+     +-------------------+
  | lifetime_start(x) |     | lifetime_start(x) |
  | use(x)            |     | lifetime_start(y) |
  | lifetime_end(x)   |     | use(x, y)         |
  | lifetime_start(y) |     | lifetime_end(y)   |
  | use(y)            |     | lifetime_end(x)   |
  | lifetime_end(y)   |     +-------------------+
  +-------------------+
```

Prior to extraction, the stack coloring pass sees that the slots for 'x'
and 'y' are in-use at the same time. After extraction, the coloring pass
infers that 'x' and 'y' are *not* in-use concurrently, because markers
from 'rhs' are no longer available to help decide otherwise.

This leads to a miscompile, because the stack slots actually are in-use
concurrently in the extracted function.

Fix this by moving lifetime start/end markers for memory regions defined
in the calling function around the call to the extracted function.

Fixes llvm.org/PR39671 (rdar://45939472).

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

llvm-svn: 350420

5 years ago[InstCombine] reduce raw IR narrowing rotate patterns to funnel shift
Sanjay Patel [Fri, 4 Jan 2019 17:38:12 +0000 (17:38 +0000)]
[InstCombine] reduce raw IR narrowing rotate patterns to funnel shift

Similar to rL350199 - there are no known analysis/codegen holes for
funnel shift intrinsics now, so we can canonicalize the 6+ regular
instructions to funnel shift to improve vectorization, inlining,
unrolling, etc.

llvm-svn: 350419

5 years ago[gn build] Merge r350351
Nico Weber [Fri, 4 Jan 2019 17:32:28 +0000 (17:32 +0000)]
[gn build] Merge r350351

llvm-svn: 350418

5 years ago[gn build] Commit change that should have been in r350410.
Nico Weber [Fri, 4 Jan 2019 17:26:05 +0000 (17:26 +0000)]
[gn build] Commit change that should have been in r350410.

llvm-svn: 350416

5 years ago[OPENMP][NVPTX]Use new functions from the runtime library.
Alexey Bataev [Fri, 4 Jan 2019 17:25:09 +0000 (17:25 +0000)]
[OPENMP][NVPTX]Use new functions from the runtime library.

Updated codegen to use the new functions from the runtime library.

llvm-svn: 350415

5 years agoAdd two new pragmas for controlling software pipelining optimizations.
Aaron Ballman [Fri, 4 Jan 2019 17:20:00 +0000 (17:20 +0000)]
Add two new pragmas for controlling software pipelining optimizations.

This patch adds #pragma clang loop pipeline and #pragma clang loop pipeline_initiation_interval for debugging or reducing compile time purposes. It is possible to disable SWP for concrete loops to save compilation time or to find bugs by not doing SWP to certain loops. It is possible to set value of initiation interval to concrete number to save compilation time by not doing extra pipeliner passes or to check created schedule for specific initiation interval.

Patch by Alexey Lapshin.

llvm-svn: 350414

5 years ago[gn build] Add even more build files for LLVM unittests
Nico Weber [Fri, 4 Jan 2019 17:16:21 +0000 (17:16 +0000)]
[gn build] Add even more build files for LLVM unittests

Another random assortment of easy build files.

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

llvm-svn: 350413

5 years ago[gn build] Add more build files for LLVM unittests
Nico Weber [Fri, 4 Jan 2019 17:15:38 +0000 (17:15 +0000)]
[gn build] Add more build files for LLVM unittests

A fairly random assortment of build files that are easy.

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

llvm-svn: 350412

5 years ago[gn build] Start adding build files for LLVM unittests
Nico Weber [Fri, 4 Jan 2019 17:14:55 +0000 (17:14 +0000)]
[gn build] Start adding build files for LLVM unittests

Adds build files for //llvm/unittest/[A-D].

Also teach sync_source_lists_from_cmake.py to not complain about missing
BUILD.gn files for CMakeLists.txt files that just call add_subdirectory()
without calling add_.+_unittest, like e.g.
llvm/unittests/Target/CMakeLists.txt.

(Omits CodeGen/GlobalISel and DebugInfo/PDB because their build files are somewhat interesting, and this patch is already on the larger side.)

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

llvm-svn: 350411

5 years ago[gn build] Add check-llvm target and make it work
Nico Weber [Fri, 4 Jan 2019 17:13:33 +0000 (17:13 +0000)]
[gn build] Add check-llvm target and make it work

With this, check-llvm runs and passes all of clang's lit tests. It doesn't run
any of its unit tests yet.

This is the only change in the GN build patch series that needs a change to a
file outside of llvm/utils/gn: llvm/test/tools/llvm-config/booleans.test checks
the result of llvm-config --build-system for some reason, so I'm updating the
test to accept "gn" as valid output in addition to "cmake". (The alternative
would be to let the gn build self-identify as cmake, which seems worse.)

Like with check-clang and check-lld, running just ninja -C out/gn will build
all prerequisites needed to run tests, but it won't run the tests (so that the
build becomes clean after one build). Running ninja -C out/gn check-llvm will
build prerequisites if needed and run the tests. The check-llvm target never
becomes clean and runs tests every time.

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

llvm-svn: 350410

5 years ago[gn build] Add build file for libLTO.dylib
Nico Weber [Fri, 4 Jan 2019 17:12:25 +0000 (17:12 +0000)]
[gn build] Add build file for libLTO.dylib

Not used by anything yet, but will be needed to make check-llvm run ld64's libLTO plugin tests.

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

llvm-svn: 350409

5 years ago[LICM] Adjust how moving the re-hoist point works
John Brawn [Fri, 4 Jan 2019 17:12:09 +0000 (17:12 +0000)]
[LICM] Adjust how moving the re-hoist point works

In some cases the order that we hoist instructions in means that when rehoisting
(which uses the same order as hoisting) we can rehoist to a block A, then a
block B, then block A again. This currently causes an assertion failure as it
expects that when changing the hoist point it only ever moves to a block that
dominates the hoist point being moved from.

Fix this by moving the re-hoist point when it doesn't dominate the dominator of
hoisted instruction, or in other words when it wouldn't dominate the uses of
the instruction being rehoisted.

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

llvm-svn: 350408

5 years ago[gn build] Add build files for llvm/lib/{LineEditor,Testing/Support,TextAPI}
Nico Weber [Fri, 4 Jan 2019 17:11:46 +0000 (17:11 +0000)]
[gn build] Add build files for llvm/lib/{LineEditor,Testing/Support,TextAPI}

Nothing pulls them in yet, but they will be needed for check-llvm.

LineEditor depends on libedit, so create a gn/build/lib for it, following the
usual pattern.

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

llvm-svn: 350407

5 years agoUndo r350355 "[X86] Remove terrible DX Register parsing hack in parse operand. NFCI."
Nirav Dave [Fri, 4 Jan 2019 17:11:15 +0000 (17:11 +0000)]
Undo r350355 "[X86] Remove terrible DX Register parsing hack in parse operand. NFCI."

Add missing test case and update comments.

llvm-svn: 350406

5 years ago[OPENMP][NVPTX]Improve performance + reduce number of used registers.
Alexey Bataev [Fri, 4 Jan 2019 17:09:12 +0000 (17:09 +0000)]
[OPENMP][NVPTX]Improve performance + reduce number of used registers.

Summary:
Reduced number of the used register + improved performance propagating
the information about current execution/data sharing mode directly from
the compiler, where it is possible.
In some cases, it requires new/reworked interfaces of the runtime
external functions. Old functions are marked as deprecated.

Reviewers: grokos, gtbercea, kkwli0

Subscribers: guansong, jfb, openmp-commits, caomhin

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

llvm-svn: 350405

5 years agoRefactor the way we handle diagnosing unused expression results.
Aaron Ballman [Fri, 4 Jan 2019 16:58:14 +0000 (16:58 +0000)]
Refactor the way we handle diagnosing unused expression results.

Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement.

This patch fixes PR39837.

llvm-svn: 350404