platform/upstream/llvm.git
5 years agoRevert "Revert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp...
Lama Saba [Tue, 8 Jan 2019 13:30:36 +0000 (13:30 +0000)]
Revert "Revert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp files"""

This reverts commit rL350497
reported remaining issues seem to be unrelated to modules or this change.
more info: https://reviews.llvm.org/D56084

llvm-svn: 350621

5 years agoAArch64: avoid splitting vector truncating stores.
Tim Northover [Tue, 8 Jan 2019 13:30:27 +0000 (13:30 +0000)]
AArch64: avoid splitting vector truncating stores.

We have code to split vector splats (of zero and non-zero) for performance
reasons, but it ignores the fact that a store might be truncating.

Actually, truncating stores are formed for vNi8 and vNi16 types. Since the
truncation is from a legal type, the size of the store is always <= 64-bits and
so they don't actually benefit from being split up anyway, so this patch just
disables that transformation.

llvm-svn: 350620

5 years ago[X86] Add shift-by-immediate tests for non-immediate/out-of-range values
Simon Pilgrim [Tue, 8 Jan 2019 12:59:15 +0000 (12:59 +0000)]
[X86] Add shift-by-immediate tests for non-immediate/out-of-range values

As noted on PR40203, for gcc compatibility we need to support non-immediate values in the 'slli/srli/srai' shift by immediate vector intrinsics.

llvm-svn: 350619

5 years ago[GlobalISel] Fix unused variable warning in Release builds.
Benjamin Kramer [Tue, 8 Jan 2019 12:54:26 +0000 (12:54 +0000)]
[GlobalISel] Fix unused variable warning in Release builds.

llvm-svn: 350618

5 years agoProcessLaunchInfo: Remove Target reference
Pavel Labath [Tue, 8 Jan 2019 11:55:19 +0000 (11:55 +0000)]
ProcessLaunchInfo: Remove Target reference

Summary:
The target was being used in FinalizeFileActions to provide default
values for stdin/out/err. Also, most of the logic of this function was
very specific to how the lldb's Target class wants to launch processes,
so I, move it to Target::FinalizeFileActions, inverting the dependency.
The only piece of logic that was useful elsewhere (lldb-server) was the
part which sets up a pty and relevant file actions. I've kept this part
as ProcessLaunchInfo::SetUpPtyRedirection.

This makes ProcessLaunchInfo independent of any high-level lldb constructs.

Reviewers: zturner, jingham, teemperor

Subscribers: lldb-commits

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

llvm-svn: 350617

5 years ago[llvm-readobj] Don't print '@' at end of unversioned dynsym names
James Henderson [Tue, 8 Jan 2019 10:58:05 +0000 (10:58 +0000)]
[llvm-readobj] Don't print '@' at end of unversioned dynsym names

This fixes https://bugs.llvm.org/show_bug.cgi?id=40097. The problem was
caused by a regression in r188022.

See also r350614.

Reviewed by: rupprecht, mstorsjo, Higuoxing, jakehehrlich

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

llvm-svn: 350615

5 years ago[ELF] Remove checking for spurious '@' at the end of dynamic sym names
James Henderson [Tue, 8 Jan 2019 10:50:59 +0000 (10:50 +0000)]
[ELF] Remove checking for spurious '@' at the end of dynamic sym names

llvm-readobj currently has a bug (see PR40097) where it prints '@' at
the end of unversioned dynamic symbols. This bug will be fixed in a
separate later commit, but these tests need fixing first.

Reviewed by: ruiu, Higuoxing

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

llvm-svn: 350614

5 years ago[ARM] Add missing patterns for DSP muls
Sam Parker [Tue, 8 Jan 2019 10:12:36 +0000 (10:12 +0000)]
[ARM] Add missing patterns for DSP muls

Using a PatLeaf for sext_16_node allowed matching smulbb and smlabb
instructions once the operands had been sign extended. But we also
need to use sext_inreg operands along with sext_16_node to catch a
few more cases that enable use to remove the unnecessary sxth.

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

llvm-svn: 350613

5 years ago[ASTMatchers] Improve assert message for broken parent map.
Sam McCall [Tue, 8 Jan 2019 07:29:46 +0000 (07:29 +0000)]
[ASTMatchers] Improve assert message for broken parent map.

Summary:
This assert catches places where the AST (as seen by RecursiveASTVisitor)
becomes disconnected due to incomplete traversal.
Making it print the actual parent-less node is a lot more helpful - it's
possible to work out which part of the tree wasn't traversed.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 350612

5 years agoAMDGPU/GlobalISel: Introduce vcc reg bank
Matt Arsenault [Tue, 8 Jan 2019 06:30:53 +0000 (06:30 +0000)]
AMDGPU/GlobalISel: Introduce vcc reg bank

I'm not entirely sure this is the correct thing
to do with the global isel philosophy, but I think
this is necessary to handle how differently SGPRs
are used normally vs. from a condition.

For example, it makes sense to allow a copy
from a VGPR to an SGPR, but it makes no sense
to allow a copy from VGPRs to SGPRs used as
select mask.

This avoids regbankselecting strange code with
a truncate feeding directly into a condition field.
Now a copy is forced from sgpr(s1) to vcc, which is
more sensible to handle.

Some of these issues could probably avoided with making enough
operations resulting in i1 illegal. I think we can't avoid
this register bank for legality.

For example, an i1 and where one source is from a truncate, and
one source is a compare needs some kind of copy inserted to
make sure both are in condition registers.

llvm-svn: 350611

5 years ago[WebAssembly] Instruction renaming
Thomas Lively [Tue, 8 Jan 2019 06:25:55 +0000 (06:25 +0000)]
[WebAssembly] Instruction renaming

Summary: Associated with D56338.

Reviewers: aheejin, aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 350610

5 years ago[WebAssembly] Massive instruction renaming
Thomas Lively [Tue, 8 Jan 2019 06:25:55 +0000 (06:25 +0000)]
[WebAssembly] Massive instruction renaming

Summary:
An automated renaming of all the instructions listed at
https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329
as well as some similarly-named identifiers.

Reviewers: aheejin, dschuff, aardappel

Subscribers: sbc100, jgravelle-google, eraman, sunfish, jfb, llvm-commits

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

llvm-svn: 350609

5 years ago[LLVM-C] Allow For Creating a BasicBlock without a Parent Function
Robert Widmann [Tue, 8 Jan 2019 06:24:19 +0000 (06:24 +0000)]
[LLVM-C] Allow For Creating a BasicBlock without a Parent Function

Summary: Add a utility function for creating a basic block without a parent function.  A useful operation for compilers that need to synthesize and conditionally insert code without having to bother with appending and immediately unlinking a block.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 350608

5 years ago[LLVM-C] Allow Specifying Signedness in Int Cast
Robert Widmann [Tue, 8 Jan 2019 06:23:22 +0000 (06:23 +0000)]
[LLVM-C] Allow Specifying Signedness in Int Cast

Summary: Fix an old outstanding problem with the int cast builder binding always assuming the cast is signed by introducing a new LLVMBuildIntCast2 operation and deprecating the old prototype.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 350607

5 years ago[MC] [AArch64] Support resolving signed fixups for :abs_g0_s: etc.
Mandeep Singh Grang [Tue, 8 Jan 2019 04:48:00 +0000 (04:48 +0000)]
[MC] [AArch64] Support resolving signed fixups for :abs_g0_s: etc.

Summary: This patch is a follow-up to D55896.

Reviewers: efriedma, mstorsjo

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 350606

5 years ago[NFC] Remove empty line as a test commit.
Chris Kennelly [Tue, 8 Jan 2019 04:04:51 +0000 (04:04 +0000)]
[NFC] Remove empty line as a test commit.

llvm-svn: 350605

5 years agogn build: Stop passing -o to ar.
Peter Collingbourne [Tue, 8 Jan 2019 04:00:22 +0000 (04:00 +0000)]
gn build: Stop passing -o to ar.

The -o flag means something different to ar than what appears to be
intended here. Also, llvm-ar doesn't accept the flag in this position.

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

llvm-svn: 350604

5 years agoSet the buffer of an fstream to empty when the underlying file is closed. This 'fixes...
Marshall Clow [Tue, 8 Jan 2019 02:48:45 +0000 (02:48 +0000)]
Set the buffer of an fstream to empty when the underlying file is closed. This 'fixes' PR#38052 - std::fstream still good after closing and updating content.

llvm-svn: 350603

5 years agoFix Mac compilation.
Evgeniy Stepanov [Tue, 8 Jan 2019 02:02:27 +0000 (02:02 +0000)]
Fix Mac compilation.

Provide an implementation of MemoryMappingLayout::Error() for Mac.

llvm-svn: 350601

5 years agogn build: Merge r350580.
Peter Collingbourne [Tue, 8 Jan 2019 01:46:57 +0000 (01:46 +0000)]
gn build: Merge r350580.

llvm-svn: 350600

5 years ago[SymbolContext] Remove dead code
Jonas Devlieghere [Tue, 8 Jan 2019 01:35:00 +0000 (01:35 +0000)]
[SymbolContext] Remove dead code

Removes two methods from SymbolContextList that aren't referenced.

llvm-svn: 350599

5 years agoAMDGPU/GlobalISel: Legalize concat_vectors
Matt Arsenault [Tue, 8 Jan 2019 01:30:02 +0000 (01:30 +0000)]
AMDGPU/GlobalISel: Legalize concat_vectors

llvm-svn: 350598

5 years agoFix typos
Matt Arsenault [Tue, 8 Jan 2019 01:25:47 +0000 (01:25 +0000)]
Fix typos

llvm-svn: 350597

5 years ago[WebAssembly] Move CFG-changing passes before RegStackify
Heejin Ahn [Tue, 8 Jan 2019 01:25:12 +0000 (01:25 +0000)]
[WebAssembly] Move CFG-changing passes before RegStackify

Summary:
FixIrreducibleControlFlow and LateEHPrepare both possibly modify CFG and
create new registers. There seems to be no reason these passes go after
register-related optimization passes (PrepareForLiveIntervals,
OptimizeLiveIntervals, StoreResults, RegStackify, and RegColoring), and
this also possibly create new optimization opportunities. I think we
should put all current and future optimization passes before RegStackify
(and related passes) unless there's a reason not to.

Reviewers: kripken

Subscribers: dschuff, sbc100, sunfish, jgravelle-google, llvm-commits

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

llvm-svn: 350596

5 years agoRegBankSelect: Fix copy insertion point for terminators
Matt Arsenault [Tue, 8 Jan 2019 01:22:47 +0000 (01:22 +0000)]
RegBankSelect: Fix copy insertion point for terminators

If a copy was needed to handle the condition of brcond, it was being
inserted before the defining instruction. Add tests for iterator edge
cases.

I find the existing code here suspect for the case where it's looking
for terminators that modify the register. It's going to insert a copy
in the middle of the terminators, which isn't allowed (it might be
necessary to have a COPY_terminator if anybody actually needs this).

Also legalize brcond for AMDGPU.

llvm-svn: 350595

5 years ago[WebAssembly] Use 'I' multiclass template for br_table (NFC)
Heejin Ahn [Tue, 8 Jan 2019 01:15:15 +0000 (01:15 +0000)]
[WebAssembly] Use 'I' multiclass template for br_table (NFC)

Summary:
We don't need to explicitly use `NI` anymore because we now don't use
`let` statements within the definitions.

Reviewers: aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 350594

5 years agoAMDGPU/GlobalISel: Disallow VGPR->SCC copies
Matt Arsenault [Tue, 8 Jan 2019 01:13:20 +0000 (01:13 +0000)]
AMDGPU/GlobalISel: Disallow VGPR->SCC copies

This fixes using scalar adds when only the carry in is a VGPR
using greedy regbankselect.

llvm-svn: 350593

5 years agoAMDGPU/GlobalISel: RegBankSelect for carry-in
Matt Arsenault [Tue, 8 Jan 2019 01:09:09 +0000 (01:09 +0000)]
AMDGPU/GlobalISel: RegBankSelect for carry-in

I'm not sure we should be allowing the truncate
to s1 for the inputs. It may be necessary to
create a new VCC reg bank.

llvm-svn: 350592

5 years ago[dsymutil] Fix assertion triggered by empty address range.
Jonas Devlieghere [Tue, 8 Jan 2019 01:08:09 +0000 (01:08 +0000)]
[dsymutil] Fix assertion triggered by empty address range.

An assertion was hit when running dsymutil on a gcc generated binary
that contained an empty address range. Address ranges are stored in an
interval map of half open intervals. Since the interval is empty and
therefore meaningless, we simply don't add it to the map.

llvm-svn: 350591

5 years ago[asan] Support running without /proc
Evgeniy Stepanov [Tue, 8 Jan 2019 01:07:34 +0000 (01:07 +0000)]
[asan] Support running without /proc

Summary:
This patch lets ASan run when /proc is not accessible (ex. not mounted
yet). It includes a special test-only flag that emulates this condition
in an unpriviledged process.

This only matters on Linux, where /proc is necessary to enumerate
virtual memory mappings.

Reviewers: vitalybuka, pcc, krytarowski

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 350590

5 years agoAMDGPU/GlobalISel: RegBankSelect for add/sub with carry out
Matt Arsenault [Tue, 8 Jan 2019 01:03:58 +0000 (01:03 +0000)]
AMDGPU/GlobalISel: RegBankSelect for add/sub with carry out

llvm-svn: 350589

5 years agoAMDGPU/GlobalISel: InstrMapping for G_UNMERGE_VALUES
Matt Arsenault [Tue, 8 Jan 2019 00:46:19 +0000 (00:46 +0000)]
AMDGPU/GlobalISel: InstrMapping for G_UNMERGE_VALUES

llvm-svn: 350588

5 years agofix comment typo - NFC
Chen Zheng [Tue, 8 Jan 2019 00:40:01 +0000 (00:40 +0000)]
fix comment typo - NFC

llvm-svn: 350587

5 years ago[RegisterCoalescer] dst register's live interval needs to be updated when
Wei Mi [Tue, 8 Jan 2019 00:26:11 +0000 (00:26 +0000)]
[RegisterCoalescer] dst register's live interval needs to be updated when
merging a src register in ToBeUpdated set.

This is to fix PR40061 related with https://reviews.llvm.org/rL339035.

In https://reviews.llvm.org/rL339035, live interval of source pseudo register
in rematerialized copy may be saved in ToBeUpdated set and its update may be
postponed.

In PR40061, %t2 = %t1 is rematerialized and %t1 is added into toBeUpdated set
to postpone its live interval update. After the rematerialization, the live
interval of %t1 is larger than necessary. Then %t1 is merged into %t3 and %t1
gets removed. After the merge, %t3 contains live interval larger than necessary.
Because %t3 is not in toBeUpdated set, its live interval is not updated after
register coalescing and it will break some assumption in regalloc.

The patch requires the live interval of destination register in a merge to be
updated if the source register is in ToBeUpdated.

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

llvm-svn: 350586

5 years agoSplit -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor
Erik Pilkington [Tue, 8 Jan 2019 00:21:05 +0000 (00:21 +0000)]
Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor

-Wdelete-non-virtual-dtor previously controlled two diagnostics: 1)
calling a non-virtual dtor from an abstract class, and 2) calling a
non-virtual dtor from a polymorphic class. 1) is a lot more severe
than 2), since 1) is a guaranteed crash, but 2) is just "code smell".
Previously, projects compiled with -Wall -Wno-delete-non-virtual-dtor,
which is somewhat reasonable, silently crashed on 1).

rdar://40380564

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

llvm-svn: 350585

5 years agoReleaseNotes: Update with my clang-query contributions this cycle
Stephen Kelly [Tue, 8 Jan 2019 00:09:34 +0000 (00:09 +0000)]
ReleaseNotes: Update with my clang-query contributions this cycle

llvm-svn: 350584

5 years ago[libcxx] Optimize vectors construction of trivial types from an iterator range with...
Volodymyr Sapsai [Tue, 8 Jan 2019 00:03:16 +0000 (00:03 +0000)]
[libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.

We already have a specialization that will use memcpy for construction
of trivial types from an iterator range like

    std::vector<int>(int *, int *);

But if we have const-ness mismatch like

    std::vector<int>(const int *, const int *);

we would use a slow path that copies each element individually. This change
enables the optimal specialization for const-ness mismatch. Fixes PR37574.

Contributions to the patch are made by Arthur O'Dwyer, Louis Dionne.

rdar://problem/40485845

Reviewers: mclow.lists, EricWF, ldionne, scanon

Reviewed By: ldionne

Subscribers: christof, ldionne, howard.hinnant, cfe-commits

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

llvm-svn: 350583

5 years ago[dsymutil] Upstream unobfuscation logic.
Jonas Devlieghere [Mon, 7 Jan 2019 23:27:25 +0000 (23:27 +0000)]
[dsymutil] Upstream unobfuscation logic.

The unobufscation support for BCSymbolMaps was the last piece of code
that hasn't been upstreamed yet. This patch contains a reworked version
of the existing code and relevant tests.

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

llvm-svn: 350580

5 years ago[PGO] Use SourceFileName rather module name in PGOFuncName
Rong Xu [Mon, 7 Jan 2019 23:25:56 +0000 (23:25 +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: 350579

5 years ago[Verifier] Reject invalid type for DILocalVariable.
Davide Italiano [Mon, 7 Jan 2019 23:09:09 +0000 (23:09 +0000)]
[Verifier] Reject invalid type for DILocalVariable.

Reviewers: aprantl

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 350578

5 years agoSimplify code.
Adrian Prantl [Mon, 7 Jan 2019 23:08:16 +0000 (23:08 +0000)]
Simplify code.

llvm-svn: 350577

5 years agoClarify comment and variable names. (NFC)
Adrian Prantl [Mon, 7 Jan 2019 23:02:28 +0000 (23:02 +0000)]
Clarify comment and variable names. (NFC)

llvm-svn: 350576

5 years agoRename DWARFDIE::GetDWOContext() -> GetDeclContext() (NFC)
Adrian Prantl [Mon, 7 Jan 2019 22:47:17 +0000 (22:47 +0000)]
Rename DWARFDIE::GetDWOContext() -> GetDeclContext() (NFC)

Despite the name, this function has nothing to do with the DWO format.

llvm-svn: 350575

5 years agoNFC: Replace asserts with if() in SourceLocation accessors
Stephen Kelly [Mon, 7 Jan 2019 21:57:30 +0000 (21:57 +0000)]
NFC: Replace asserts with if() in SourceLocation accessors

Summary:
Nowhere else in the AST classes assert on these kinds of accessors.

This way, we can call the accessors and check the validity of the result
instead of externally duplicating the conditions.  This generality will
make it possible to introspect instances for source locations:

 http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/iiaWhw

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 350573

5 years agoAdd a __has_feature check for namespaces on #pragma clang attribute.
Erik Pilkington [Mon, 7 Jan 2019 21:54:00 +0000 (21:54 +0000)]
Add a __has_feature check for namespaces on #pragma clang attribute.

Support for this was added in r349845.

llvm-svn: 350572

5 years ago[OPENMP]Add call to __kmpc_push_target_tripcount() function.
Alexey Bataev [Mon, 7 Jan 2019 21:30:43 +0000 (21:30 +0000)]
[OPENMP]Add call to __kmpc_push_target_tripcount() function.

Each we create the target regions with the teams distribute inner
region, we can better estimate number of the teams required to execute
the target region. Function __kmpc_push_target_tripcount() is used for
purpose, which accepts device_id and the number of the iterations,
performed by the associated loop.

llvm-svn: 350571

5 years ago[lldb] Fix -Wstring-plus-int warning in POSIX-DYLD/AuxVector.cpp
Jorge Gorbe Moya [Mon, 7 Jan 2019 21:04:12 +0000 (21:04 +0000)]
[lldb] Fix -Wstring-plus-int warning in POSIX-DYLD/AuxVector.cpp

llvm-svn: 350570

5 years ago[ValueTracking] Adjust comment in test
Michael Ferguson [Mon, 7 Jan 2019 21:02:22 +0000 (21:02 +0000)]
[ValueTracking] Adjust comment in test

Adjusts a comment in this test to verify commit access.

llvm-svn: 350569

5 years agoRecommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."
Craig Topper [Mon, 7 Jan 2019 21:00:41 +0000 (21:00 +0000)]
Recommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."

The MSVC limit hit in AutoUpgrade.cpp has been worked around for now.

llvm-svn: 350568

5 years agoRecommit r350554 "[X86] Remove AVX512VBMI2 concat and shift intrinsics. Replace with...
Craig Topper [Mon, 7 Jan 2019 21:00:32 +0000 (21:00 +0000)]
Recommit r350554 "[X86] Remove AVX512VBMI2 concat and shift intrinsics. Replace with target independent funnel shift intrinsics."

The MSVC limit we hit on AutoUpgrade.cpp has been worked around for now.

llvm-svn: 350567

5 years ago[ObjectYAML] [COFF] Support multiple symbols with the same name
Martin Storsjo [Mon, 7 Jan 2019 20:55:33 +0000 (20:55 +0000)]
[ObjectYAML] [COFF] Support multiple symbols with the same name

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

llvm-svn: 350566

5 years agocmake: Install libraries to DATADIR from GNUInstallDirs
Jan Vesely [Mon, 7 Jan 2019 20:20:37 +0000 (20:20 +0000)]
cmake: Install libraries to DATADIR from GNUInstallDirs

This moves default installation location to /usr/share to match libclc.pc.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Tom Stellard

llvm-svn: 350565

5 years ago[X86][AutoUpgrade] Make some tweaks to reduce the number of nested if/else in the...
Craig Topper [Mon, 7 Jan 2019 20:13:45 +0000 (20:13 +0000)]
[X86][AutoUpgrade] Make some tweaks to reduce the number of nested if/else in the intrinsic upgrade code to avoid an MSVC compiler limit.

MSVC has a nesting limit of around 110-130. An if/else if/else if counts against this next level. The autoupgrade code consists a long chain of these checking matches against strings.

This commit moves some code to a helper function to move out a large if/else chain that was inside of one of the blocks into a separate function. There are more of these we could move or we could change some to lookup tables.

I've also merged together a few similar blocks in the outer chain. This should buy us some margin for a little bit.

llvm-svn: 350564

5 years agoRevert r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."
Craig Topper [Mon, 7 Jan 2019 19:39:25 +0000 (19:39 +0000)]
Revert r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."

Had to revert the LLVM patch this depends on to fix a MSVC compiler limit in AutoUpgrade.cpp

llvm-svn: 350563

5 years agoRevert r350554 "[X86] Remove AVX512VBMI2 concat and shift intrinsics. Replace with...
Craig Topper [Mon, 7 Jan 2019 19:39:05 +0000 (19:39 +0000)]
Revert r350554 "[X86] Remove AVX512VBMI2 concat and shift intrinsics. Replace with target independent funnel shift intrinsics."

The AutoUpgrade.cpp if/else cascade hit an MSVC limit again.

llvm-svn: 350562

5 years ago[MemorySSA] Add SkipSelfWalker.
Alina Sbirlea [Mon, 7 Jan 2019 19:38:47 +0000 (19:38 +0000)]
[MemorySSA] Add SkipSelfWalker.

Summary: Add implementation of SkipSelfWalker.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 350561

5 years ago[TargetLowering][AMDGPU] Remove the SimplifyDemandedBits function that takes a User...
Craig Topper [Mon, 7 Jan 2019 19:30:43 +0000 (19:30 +0000)]
[TargetLowering][AMDGPU] Remove the SimplifyDemandedBits function that takes a User and OpIdx. Stop using it in AMDGPU target for simplifyI24.

As we saw in D56057 when we tried to use this function on X86, it's unsafe. It allows the operand node to have multiple users, but doesn't prevent recursing past the first node when it does have multiple users. This can cause other simplifications earlier in the graph without regard to what bits are needed by the other users of the first node. Ideally all we should do to the first node if it has multiple uses is bypass it when its not needed by the user we started from. Doing any other transformation that SimplifyDemandedBits can do like turning ZEXT/SEXT into AEXT would result in an increase in instructions.

Fortunately, we already have a function that can do just that, GetDemandedBits. It will only make transformations that involve bypassing a node.

This patch changes AMDGPU's simplifyI24, to use a combination of GetDemandedBits to handle the multiple use simplifications. And then uses the regular SimplifyDemandedBits on each operand to handle simplifications allowed when the operand only has a single use. Unfortunately, GetDemandedBits simplifies constants more aggressively than SimplifyDemandedBits. This caused the -7 constant in the changed test to be simplified to remove the upper bits. I had to modify computeKnownBits to account for this by ignoring the upper 8 bits of the input.

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

llvm-svn: 350560

5 years agoSplit two sub-tests into separate top-level methods.
Adrian Prantl [Mon, 7 Jan 2019 19:24:04 +0000 (19:24 +0000)]
Split two sub-tests into separate top-level methods.

llvm-svn: 350559

5 years ago[MemorySSA] Refactor CachingWalker.
Alina Sbirlea [Mon, 7 Jan 2019 19:22:37 +0000 (19:22 +0000)]
[MemorySSA] Refactor CachingWalker.

Summary:
Refactor caching walker to make creating a walker that skips the
starting access strightforward.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits, jfb

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

llvm-svn: 350558

5 years agoRefactor test, no changes expected.
Adrian Prantl [Mon, 7 Jan 2019 19:19:34 +0000 (19:19 +0000)]
Refactor test, no changes expected.

llvm-svn: 350557

5 years ago[TSan] Support Objective-C @synchronized with tagged pointers
Julian Lettner [Mon, 7 Jan 2019 19:19:23 +0000 (19:19 +0000)]
[TSan] Support Objective-C @synchronized with tagged pointers

Summary:
Objective-C employs tagged pointers, that is, small objects/values may be encoded directly in the pointer bits. The resulting pointer is not backed by an allocation/does not point to a valid memory. TSan infrastructure requires a valid address for `Acquire/Release` and `Mutex{Lock/Unlock}`.
This patch establishes such a mapping via a "dummy allocation" for each encountered tagged pointer value.

Reviewers: dcoughlin, kubamracek, dvyukov, delcypher

Reviewed By: dvyukov

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 350556

5 years ago[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins.
Craig Topper [Mon, 7 Jan 2019 19:10:22 +0000 (19:10 +0000)]
[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins.

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

llvm-svn: 350555

5 years ago[X86] Remove AVX512VBMI2 concat and shift intrinsics. Replace with target independent...
Craig Topper [Mon, 7 Jan 2019 19:10:12 +0000 (19:10 +0000)]
[X86] Remove AVX512VBMI2 concat and shift intrinsics. Replace with target independent funnel shift intrinsics.

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

llvm-svn: 350554

5 years ago[ARM] ComputeKnownBits to handle extract vectors
Diogo N. Sampaio [Mon, 7 Jan 2019 19:01:47 +0000 (19:01 +0000)]
[ARM] ComputeKnownBits to handle extract vectors

This patch adds the sign/zero extension done by
vgetlane to ARM computeKnownBitsForTargetNode.

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

llvm-svn: 350553

5 years ago[MemorySSA] Extend the clobber walker with the option to skip the starting access.
Alina Sbirlea [Mon, 7 Jan 2019 18:40:27 +0000 (18:40 +0000)]
[MemorySSA] Extend the clobber walker with the option to skip the starting access.

Summary:
The option enables loop transformations to hoist accesses that do not
have clobbers in the loop. If the clobber queries skips the starting
access, the result may be outside the loop instead of the header Phi.

Adding the walker that uses this option in a separate patch.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 350551

5 years agoMark more tests as flaky
Eric Fiselier [Mon, 7 Jan 2019 18:21:18 +0000 (18:21 +0000)]
Mark more tests as flaky

llvm-svn: 350550

5 years agoRevert "[DemandedBits] Use SetVector for Worklist"
Nikita Popov [Mon, 7 Jan 2019 18:15:11 +0000 (18:15 +0000)]
Revert "[DemandedBits] Use SetVector for Worklist"

This reverts commit r350547.

Seeing assertion failures on clang tests.

llvm-svn: 350549

5 years ago[X86] Add OR(AND(X,C),AND(Y,~C)) bit select tests
Simon Pilgrim [Mon, 7 Jan 2019 18:07:56 +0000 (18:07 +0000)]
[X86] Add OR(AND(X,C),AND(Y,~C)) bit select tests

Based off work for D55935

llvm-svn: 350548

5 years ago[DemandedBits] Use SetVector for Worklist
Nikita Popov [Mon, 7 Jan 2019 18:03:36 +0000 (18:03 +0000)]
[DemandedBits] Use SetVector for Worklist

DemandedBits currently uses a simple vector for the worklist, which
means that instructions may be inserted multiple times into it.
Especially in combination with the deep lattice, this may cause
instructions too be recomputed very often. To avoid this, switch
to a SetVector.

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

llvm-svn: 350547

5 years agoUse the minidump exception record if present
Leonard Mosescu [Mon, 7 Jan 2019 17:55:42 +0000 (17:55 +0000)]
Use the minidump exception record if present

If the minidump contains a saved exception record use it automatically.

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

llvm-svn: 350546

5 years ago[elfabi] Add option to manually specify file read format
Armando Montanez [Mon, 7 Jan 2019 17:33:10 +0000 (17:33 +0000)]
[elfabi] Add option to manually specify file read format

Although llvm-elfabi will attempt to read input files without needing the format to be manually specified, doing so has the potential to introduce extraneous errors that can hinder debugging (since multiple readers may fail in attempts to read the file). This change allows the input file format to be manually specified to force elfabi to use a single reader. This makes it easier to test and debug errors specific to a given reader.

llvm-svn: 350545

5 years ago[pstl] Avoid shadowing explicit lambda capture with lambda parameter
Louis Dionne [Mon, 7 Jan 2019 17:31:17 +0000 (17:31 +0000)]
[pstl] Avoid shadowing explicit lambda capture with lambda parameter

Summary:
Recent Clangs give an error for this. Note that the size of this diff is
caused by running clang-format on the result of removing the captures.
I guess we'll see how well that works for us.

Reviewers: jfb, rodgert

Subscribers: jkorous, dexonsmith, libcxx-commits, mclow.lists

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

llvm-svn: 350544

5 years agoFine-tune and document the barrier in TestQueues.
Adrian Prantl [Mon, 7 Jan 2019 17:18:39 +0000 (17:18 +0000)]
Fine-tune and document the barrier in TestQueues.

llvm-svn: 350543

5 years ago[clangd] Fix Windows build after r350531
Ilya Biryukov [Mon, 7 Jan 2019 17:03:15 +0000 (17:03 +0000)]
[clangd] Fix Windows build after r350531

llvm-svn: 350542

5 years ago[llvm-objcopy] Handle -O <format> flag.
Jordan Rupprecht [Mon, 7 Jan 2019 16:59:12 +0000 (16:59 +0000)]
[llvm-objcopy] Handle -O <format> flag.

Summary:
The -O flag is currently being mostly ignored; it's only checked whether or not the output format is "binary". This adds support for a few formats (e.g. elf64-x86-64), so that when specified, the output can change between 32/64 bit and sizes/alignments are updated accordingly.

This fixes PR39135

Reviewers: jakehehrlich, jhenderson, alexshap, espindola

Reviewed By: jhenderson

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 350541

5 years ago[clangd] Include <cstdio> instead of <stdio.h>. NFC
Ilya Biryukov [Mon, 7 Jan 2019 16:55:59 +0000 (16:55 +0000)]
[clangd] Include <cstdio> instead of <stdio.h>. NFC

This fixes the only clang-tidy check currently enabled by clangd.

llvm-svn: 350540

5 years ago[NFC] Fix formatting of README.md for better rendering
Louis Dionne [Mon, 7 Jan 2019 16:54:02 +0000 (16:54 +0000)]
[NFC] Fix formatting of README.md for better rendering

Reviewed as https://reviews.llvm.org/D56051.

llvm-svn: 350539

5 years ago[CMake] Fix standalone builds: make dependency to LLVM's `count` conditional
Stefan Granitz [Mon, 7 Jan 2019 16:43:04 +0000 (16:43 +0000)]
[CMake] Fix standalone builds: make dependency to LLVM's `count` conditional

Summary:
In standalone builds of LLDB we currently have no target `count` that tests can depend on. This may be fixed in the future by exporting the target from LLVM similar to targets llvm-config, dsymutil and others.

In-tree build with this patch:
```
    $ ninja -t query tools/lldb/lit/check-lldb-lit
    tools/lldb/lit/check-lldb-lit:
    input: phony
        tools/lldb/lit/CMakeFiles/check-lldb-lit
        bin/FileCheck
        bin/clang
        bin/count
        bin/darwin-debug
        bin/debugserver
        bin/dsymutil
        bin/llc
        bin/lldb
        bin/lldb-mi
        bin/lldb-server
        bin/lldb-test
        bin/llvm-config
        bin/llvm-mc
        bin/llvm-objcopy
        bin/not
        bin/yaml2obj
        lib/liblldb.dylib
        projects/libcxx/lib/cxx
        tools/lldb/unittests/LLDBUnitTests
    outputs:
        tools/lldb/test/check-lldb
        check-lldb-lit
```

Standalone build with this patch:
```
    $ ninja -t query lit/check-lldb-lit
    lit/check-lldb-lit:
    input: phony
        lit/CMakeFiles/check-lldb-lit
        bin/darwin-debug
        bin/debugserver
        bin/lldb
        bin/lldb-mi
        bin/lldb-server
        bin/lldb-test
        lib/liblldb.dylib
        unittests/LLDBUnitTests
    outputs:
        test/check-lldb
        check-lldb-lit
```

Reviewers: davide, aprantl, JDevlieghere, alexshap

Reviewed By: davide

Subscribers: mgorny, lldb-commits, #lldb

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

llvm-svn: 350538

5 years agoSimplify testcase by using lldbutil.run_to_source_breakpoint()
Adrian Prantl [Mon, 7 Jan 2019 16:27:52 +0000 (16:27 +0000)]
Simplify testcase by using lldbutil.run_to_source_breakpoint()

llvm-svn: 350537

5 years ago[lit] Respect PYTHONPATH
David Greene [Mon, 7 Jan 2019 16:24:37 +0000 (16:24 +0000)]
[lit] Respect PYTHONPATH

If a user has PYTHONPATH set in the environment, append new entries to
it rather than blindly setting PYTHONPATH to a fixed string. This
allows tests to, for example, find psutil if it is in
PYTHONPATH. Without this change, lit will detect psutil but then
various tests will fail because PYTHONPATH has been overwritten and
psutil cannot be found.

llvm-svn: 350536

5 years agoAdd the feature test macros that were defined in p1353r0 to the headers of the approp...
Marshall Clow [Mon, 7 Jan 2019 16:17:52 +0000 (16:17 +0000)]
Add the feature test macros that were defined in p1353r0 to the headers of the appropriate tests. No actual tests yet, so NFC.

llvm-svn: 350535

5 years ago[llvm-demangle-fuzzer] Also fuzz microsoftDemangle().
Matt Morehouse [Mon, 7 Jan 2019 16:14:00 +0000 (16:14 +0000)]
[llvm-demangle-fuzzer] Also fuzz microsoftDemangle().

Summary:
Use first byte of input to determine whether to call itaniumDemangle()
or microsoftDemangle().

Addresses https://bugs.llvm.org/show_bug.cgi?id=39582.

Reviewers: kcc, thakis

Reviewed By: kcc, thakis

Subscribers: mgorny, thakis, erik.pilkington, llvm-commits

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

llvm-svn: 350534

5 years ago[x86] add more tests for LowerToHorizontalOp(); NFC
Sanjay Patel [Mon, 7 Jan 2019 16:10:14 +0000 (16:10 +0000)]
[x86] add more tests for LowerToHorizontalOp(); NFC

These tests show missed optimizations and a miscompile
similar to PR40243 - https://bugs.llvm.org/show_bug.cgi?id=40243

llvm-svn: 350533

5 years agoAMDGPU: test for uniformity of branch instruction, not its condition
Rhys Perry [Mon, 7 Jan 2019 15:52:28 +0000 (15:52 +0000)]
AMDGPU: test for uniformity of branch instruction, not its condition

Summary:
If a divergent branch instruction is marked as divergent by propagation
rule 2 in DivergencePropagator::exploreSyncDependency() and its condition
is uniform, that branch would incorrectly be assumed to be uniform.

Reviewers: arsenm, tstellar

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 350532

5 years ago[clangd] Remove 'using namespace llvm' from .cpp files. NFC
Ilya Biryukov [Mon, 7 Jan 2019 15:45:19 +0000 (15:45 +0000)]
[clangd] Remove 'using namespace llvm' from .cpp files. NFC

The new guideline is to qualify with 'llvm::' explicitly both in
'.h' and '.cpp' files. This simplifies moving the code between
header and source files and is easier to keep consistent.

llvm-svn: 350531

5 years ago[OPENMP][NVPTX]Reduce number of barriers in reductions.
Alexey Bataev [Mon, 7 Jan 2019 15:45:09 +0000 (15:45 +0000)]
[OPENMP][NVPTX]Reduce number of barriers in reductions.

After the fix for the syncthreads we don't need to generate extra
barriers for the parallel reductions.

llvm-svn: 350530

5 years ago[Sema] Fix unused variable warning in Release builds
Benjamin Kramer [Mon, 7 Jan 2019 15:22:08 +0000 (15:22 +0000)]
[Sema] Fix unused variable warning in Release builds

llvm-svn: 350529

5 years ago[analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore
Rafael Stahl [Mon, 7 Jan 2019 15:07:01 +0000 (15:07 +0000)]
[analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore

Summary: The LocationE parameter of evalStore is documented as "The location expression that is stored to". When storing from an increment / decrement operator this was not satisfied. In user code this causes an inconsistency between the SVal and Stmt parameters of checkLocation.

Reviewers: NoQ, dcoughlin, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

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

llvm-svn: 350528

5 years ago[AST] Store some data of CXXNewExpr as trailing objects
Bruno Ricci [Mon, 7 Jan 2019 15:04:45 +0000 (15:04 +0000)]
[AST] Store some data of CXXNewExpr as trailing objects

Store the optional array size expression, optional initialization expression
and optional placement new arguments in a trailing array. Additionally store
the range for the parenthesized type-id in a trailing object if needed since
in the vast majority of cases the type is not parenthesized (not a single new
expression in the translation unit of SemaDecl.cpp has a parenthesized type-id).

This saves 2 pointers per CXXNewExpr in all cases, and 2 pointers + 8 bytes
per CXXNewExpr in the common case where the type is not parenthesized.

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

Reviewed By: rjmccall

llvm-svn: 350527

5 years ago[clang-tidy] Use the public hasInit matcher, rather than defining our own, NFC
Hyrum Wright [Mon, 7 Jan 2019 14:36:47 +0000 (14:36 +0000)]
[clang-tidy] Use the public hasInit matcher, rather than defining our own, NFC

llvm-svn: 350526

5 years ago[AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExpr
Bruno Ricci [Mon, 7 Jan 2019 14:27:04 +0000 (14:27 +0000)]
[AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExpr

Use the newly available space in the bit-fields of Stmt.
This saves 1 pointer per DependentScopeDeclRefExpr/CXXUnresolvedConstructExpr.

Additionally rename "TypeSourceInfo *Type;" to "TypeSourceInfo *TSI;"
as was done in D56022 (r350003) (but this is an internal detail anyway),
and clang-format both classes. NFC.

llvm-svn: 350525

5 years ago[OPENMP][NVPTX]Fix dynamic scheduling.
Alexey Bataev [Mon, 7 Jan 2019 14:25:25 +0000 (14:25 +0000)]
[OPENMP][NVPTX]Fix dynamic scheduling.

Summary:
Previous implementation may cause the runtime crash when the number of
teams is > 1024. Patch fixes this problem + reduces number of the atomic
operations by 32 times.

Reviewers: grokos, gtbercea, kkwli0

Subscribers: guansong, jfb, openmp-commits, caomhin

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

llvm-svn: 350524

5 years ago[clang] Add AST matcher for initializer list members
Hyrum Wright [Mon, 7 Jan 2019 14:14:36 +0000 (14:14 +0000)]
[clang] Add AST matcher for initializer list members

Summary:
Much like hasArg for various call expressions, this allows LibTooling users to
match against a member of an initializer list.

This is currently being used as part of the abseil-duration-scale clang-tidy
check.

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

llvm-svn: 350523

5 years ago[llvm-nm] Add --portability as alias for --format=posix
James Henderson [Mon, 7 Jan 2019 14:12:51 +0000 (14:12 +0000)]
[llvm-nm] Add --portability as alias for --format=posix

GNU nm supports this alias, so supporting it in llvm-nm makes it easier
to transition between the two.

Fixes https://bugs.llvm.org/show_bug.cgi?id=40002

Reviewed by: mstorsjo, rupprecht

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

llvm-svn: 350522

5 years ago[CTU] Make loadExternalAST return with non nullptr on success
Gabor Marton [Mon, 7 Jan 2019 14:05:19 +0000 (14:05 +0000)]
[CTU] Make loadExternalAST return with non nullptr on success

Summary:
In loadExternalAST we return with either an error or with a valid
ASTUnit pointer which should not be a nullptr.
This prevents in the call site any superfluous check for being a nullptr.

Reviewers: xazax.hun, a_sidorin, Szelethus, balazske

Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits

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

llvm-svn: 350521

5 years ago[CodeView] More appropriate name and type for a Microsoft precompiled headers paramet...
Alexandre Ganea [Mon, 7 Jan 2019 13:53:16 +0000 (13:53 +0000)]
[CodeView] More appropriate name and type for a Microsoft precompiled headers parameter. NFC

llvm-svn: 350520

5 years ago[AST][NFC] Pack OpaqueValueExpr
Bruno Ricci [Mon, 7 Jan 2019 13:39:26 +0000 (13:39 +0000)]
[AST][NFC] Pack OpaqueValueExpr

Use the newly available space in the bit-fields of Stmt.
This saves 1 pointer per OpaqueValueExpr. NFC.

llvm-svn: 350519

5 years agoAMDGPU: Remove v16i8 from register classes
Matt Arsenault [Mon, 7 Jan 2019 13:31:55 +0000 (13:31 +0000)]
AMDGPU: Remove v16i8 from register classes

llvm-svn: 350518

5 years agoAMDGPU: Remove VS/SV mappings from select
Matt Arsenault [Mon, 7 Jan 2019 13:21:36 +0000 (13:21 +0000)]
AMDGPU: Remove VS/SV mappings from select

These would violate the constant bus restriction

llvm-svn: 350517

5 years agoclang-format: [JS] support goog.requireType.
Martin Probst [Mon, 7 Jan 2019 13:12:50 +0000 (13:12 +0000)]
clang-format: [JS] support goog.requireType.

Summary:
It's a new primitive for importing symbols, and should be treated like
the (previously handled) `goog.require` and `goog.forwardDeclare`.

Reviewers: krasimir

Subscribers: cfe-commits

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

llvm-svn: 350516