OSDN Git Service

android-x86/external-llvm.git
7 years agoDelete Default and JITDefault code models
Rafael Espindola [Thu, 3 Aug 2017 02:16:21 +0000 (02:16 +0000)]
Delete Default and JITDefault code models

IMHO it is an antipattern to have a enum value that is Default.

At any given piece of code it is not clear if we have to handle
Default or if has already been mapped to a concrete value. In this
case in particular, only the target can do the mapping and it is nice
to make sure it is always done.

This deletes the two default enum values of CodeModel and uses an
explicit Optional<CodeModel> when it is possible that it is
unspecified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309911 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Tidy up banked registers encoding
Javed Absar [Thu, 3 Aug 2017 01:24:12 +0000 (01:24 +0000)]
[ARM] Tidy up banked registers encoding

Moves encoding (SYSm) information of banked registers to ARMSystemRegister.td,
where it rightly belongs and forms a single point of reference in the code.

Reviewed by: @fhahn, @rovka, @olista01
Differential Revision: https://reviews.llvm.org/D36219

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309910 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix the bug when SampleProfileWriter writes out number of callsites.
Dehao Chen [Thu, 3 Aug 2017 00:09:18 +0000 (00:09 +0000)]
Fix the bug when SampleProfileWriter writes out number of callsites.

Summary: As we support multiple callsites for the same location, we need to traverse all locations to get the number of callsites.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309907 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove two functions to a nicer spot. NFC.
Vedant Kumar [Wed, 2 Aug 2017 23:35:27 +0000 (23:35 +0000)]
Move two functions to a nicer spot. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309906 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRely on autobrief, remove \briefs from a header. NFC.
Vedant Kumar [Wed, 2 Aug 2017 23:35:26 +0000 (23:35 +0000)]
Rely on autobrief, remove \briefs from a header. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309905 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Coverage] Add an API to retrive all instantiations of a function (NFC)
Vedant Kumar [Wed, 2 Aug 2017 23:35:25 +0000 (23:35 +0000)]
[Coverage] Add an API to retrive all instantiations of a function (NFC)

The CoverageMapping::getInstantiations() API retrieved all function
records corresponding to functions with more than one instantiation (e.g
template functions with multiple specializations). However, there was no
simple way to determine *which* function a given record was an
instantiation of. This was an oversight, since it's useful to aggregate
coverage information over all instantiations of a function.

llvm-cov works around this by building a mapping of source locations to
instantiation sets, but this duplicates logic that libCoverage already
has (see FunctionInstantiationSetCollector).

This change adds a new API, CoverageMapping::getInstantiationGroups(),
which returns a list of InstantiationGroups. A group contains records
for each instantiation of some particular function, and also provides
utilities to get the total execution count within the group, the source
location of the common definition, etc.

This lets removes some hacky logic in llvm-cov by reusing
FunctionInstantiationSetCollector and makes the CoverageMapping API
friendlier for other clients.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309904 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-cov] Respect the value of the -show-instantiations option
Vedant Kumar [Wed, 2 Aug 2017 23:35:24 +0000 (23:35 +0000)]
[llvm-cov] Respect the value of the -show-instantiations option

Make `-show-instantiations=false` actually skip displaying instantiation
sub-views, instead of simply ignoring the option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309903 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[libFuzzer tests] Use substring comparison in libFuzzer tests"
George Karpenkov [Wed, 2 Aug 2017 23:09:57 +0000 (23:09 +0000)]
Revert "[libFuzzer tests] Use substring comparison in libFuzzer tests"

This reverts commit 3592d8049660dcdd07f7c2e797f2de9790f93111.

Breaks the bots, reverting for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309899 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/GlobalISel: Mark 32-bit G_FMUL as legal
Tom Stellard [Wed, 2 Aug 2017 22:56:30 +0000 (22:56 +0000)]
AMDGPU/GlobalISel: Mark 32-bit G_FMUL as legal

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, llvm-commits, t-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309898 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[pdb/lld] Write a valid FPM.
Zachary Turner [Wed, 2 Aug 2017 22:31:39 +0000 (22:31 +0000)]
[pdb/lld] Write a valid FPM.

The PDB reserves certain blocks for the FPM that describe which
blocks in the file are allocated and which are free.  We weren't
filling that out at all, and in some cases we were even stomping
it with incorrect data.  This patch writes a correct FPM.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309896 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MSF] Move MSF unit tests to their own unittest target.
Zachary Turner [Wed, 2 Aug 2017 22:26:09 +0000 (22:26 +0000)]
[MSF] Move MSF unit tests to their own unittest target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309895 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[pdbutil] Add a command to dump the FPM.
Zachary Turner [Wed, 2 Aug 2017 22:25:52 +0000 (22:25 +0000)]
[pdbutil] Add a command to dump the FPM.

Recently problems have been discovered in the way we write the FPM
(free page map).  In order to fix this, we first need to establish
a baseline about what a correct FPM looks like using an MSVC
generated PDB, so that we can then make our own generated PDBs
match.  And in order to do this, the dumper needs a mode where it
can dump an FPM so that we can write tests for it.

This patch adds a command to dump the FPM, as well as a test against
a known-good PDB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309894 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/R600: Initialize more passes
Tom Stellard [Wed, 2 Aug 2017 22:19:45 +0000 (22:19 +0000)]
AMDGPU/R600: Initialize more passes

Reviewers: arsenm

Reviewed By: arsenm

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309893 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoXray docs with description of Flight Data Recorder binary format.
Keith Wyss [Wed, 2 Aug 2017 21:47:27 +0000 (21:47 +0000)]
Xray docs with description of Flight Data Recorder binary format.

Summary:
Adding a new restructuredText file to document the trace format produced with
an FDR mode handler and read by llvm-xray toolset.

Fixed two problems in the documentation from differential review. One bad table
and a missing link in the toc.

Original commit was e97c5836a77db803fe53319c53f3bf8e8b26d2b7.

Reviewers: dberris, pelikan

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309891 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLV: Don't insert runtime ptr checks on divergent targets
Matt Arsenault [Wed, 2 Aug 2017 21:43:08 +0000 (21:43 +0000)]
LV: Don't insert runtime ptr checks on divergent targets

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309890 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer tests] Use substring comparison in libFuzzer tests
George Karpenkov [Wed, 2 Aug 2017 21:38:50 +0000 (21:38 +0000)]
[libFuzzer tests] Use substring comparison in libFuzzer tests

LIT launches executables with absolute, and not relative, path.
strncmp would try to do exact comparison and fail.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309889 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Remove unnecessary temporary APInt. NFCI
Craig Topper [Wed, 2 Aug 2017 21:05:40 +0000 (21:05 +0000)]
[InstCombine] Remove unnecessary temporary APInt. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309887 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PM] Split LoopUnrollPass and make partial unroller a function pass
Teresa Johnson [Wed, 2 Aug 2017 20:35:29 +0000 (20:35 +0000)]
[PM] Split LoopUnrollPass and make partial unroller a function pass

Summary:
This is largely NFC*, in preparation for utilizing ProfileSummaryInfo
and BranchFrequencyInfo analyses. In this patch I am only doing the
splitting for the New PM, but I can do the same for the legacy PM as
a follow-on if this looks good.

*Not NFC since for partial unrolling we lose the updates done to the
loop traversal (adding new sibling and child loops) - according to
Chandler this is not very useful for partial unrolling, but it also
means that the debugging flag -unroll-revisit-child-loops no longer
works for partial unrolling.

Reviewers: chandlerc

Subscribers: mehdi_amini, mzolotukhin, eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309886 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't pass the code model to MC
Rafael Espindola [Wed, 2 Aug 2017 20:32:26 +0000 (20:32 +0000)]
Don't pass the code model to MC

I was surprised to see the code model being passed to MC. After all,
it assembles code, it doesn't create it.

The one place it is used is in the expansion of .cfi directives to
handle .eh_frame being more that 2gb away from the code.

As far as I can tell, gnu assembler doesn't even have an option to
enable this. Compiling a c file with gcc -mcmodel=large produces a
regular looking .eh_frame. This is probably because in practice linker
parse and recreate .eh_frames.

In llvm this is used because the JIT can place the code and .eh_frame
very far apart. Ideally we would fix the jit and delete this
option. This is hard.

Apart from confusion another problem with the current interface is
that most callers pass CodeModel::Default, which is bad since MC has
no way to map it to the target default if it actually needed to.

This patch then replaces the argument with a boolean with a default
value. The vast majority of users don't ever need to look at it. In
fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more
testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309884 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext...
Craig Topper [Wed, 2 Aug 2017 20:30:27 +0000 (20:30 +0000)]
[InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).

As far as I can tell this should be handled by foldCastedBitwiseLogic which is called later in visitXor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309882 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Support sext in foldLogicCastConstant
Craig Topper [Wed, 2 Aug 2017 20:25:56 +0000 (20:25 +0000)]
[InstCombine] Support sext in foldLogicCastConstant

This adds support for sext in foldLogicCastConstant. This is a prerequisite for D36214.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309880 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Test & handle (differently) non-zero DW_AT_ranges_base
David Blaikie [Wed, 2 Aug 2017 20:16:22 +0000 (20:16 +0000)]
DebugInfo: Test & handle (differently) non-zero DW_AT_ranges_base

Followup to r309570, fixing it slightly differently (ranges_base and
addr_base should never be read from a DWO file - so there shouldn't be
any issue with 'overriding' the values - conditionalize the code and
assert that the values aren't being overriden).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309879 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Power9] Exploit vector absolute difference instructions on Power 9
Stefan Pintilie [Wed, 2 Aug 2017 20:07:21 +0000 (20:07 +0000)]
[Power9] Exploit vector absolute difference instructions on Power 9

Power 9 has instructions to do absolute difference (VABSDUB, VABSDUH, VABSDUW)
for byte, halfword and word. We should take advantage of these.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309876 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[NewGVN] Now that load coercion is enable, we pass this test.
Davide Italiano [Wed, 2 Aug 2017 19:47:37 +0000 (19:47 +0000)]
[NewGVN] Now that load coercion is enable, we pass this test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309872 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Add Exynos M2 feature test (NFC)
Evandro Menezes [Wed, 2 Aug 2017 18:55:34 +0000 (18:55 +0000)]
[AArch64] Add Exynos M2 feature test (NFC)

Test fusion of AES operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309855 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Dominators] Teach LoopDeletion to use the new incremental API
Jakub Kuderski [Wed, 2 Aug 2017 18:17:52 +0000 (18:17 +0000)]
[Dominators] Teach LoopDeletion to use the new incremental API

Summary:
This patch makes LoopDeletion use the incremental DominatorTree API.

We modify LoopDeletion to perform the deletion in 5 steps:
1. Create a new dummy edge from the preheader to the exit, by adding a conditional branch.
2. Inform the DomTree about the new edge.
3. Remove the conditional branch and replace it with an unconditional edge to the exit. This removes the edge to the loop header, making it unreachable.
4. Inform the DomTree about the deleted edge.
5. Remove the unreachable block from the function.

Creating the dummy conditional branch is necessary to perform incremental DomTree update.
We should consider using the batch updater when it's ready.

Reviewers: dberlin, davide, grosser, sanjoy

Reviewed By: dberlin, grosser

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309850 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[StackColoring] Update AliasAnalysis information in stack coloring pass (part 2)
Hiroshi Inoue [Wed, 2 Aug 2017 18:16:32 +0000 (18:16 +0000)]
[StackColoring] Update AliasAnalysis information in stack coloring pass (part 2)

This patch is update after the first patch (https://reviews.llvm.org/rL309651) based on the post-commit comments.

Stack coloring pass need to maintain AliasAnalysis information when merging stack slots of different types.
Actually, there is a FIXME comment in StackColoring.cpp

// FIXME: In order to enable the use of TBAA when using AA in CodeGen,
// we'll also need to update the TBAA nodes in MMOs with values
// derived from the merged allocas.

But, TBAA has been already enabled in CodeGen without fixing this pass.
The incorrect TBAA metadata results in recent failures in bootstrap test on ppc64le (PR33928) by allowing unsafe instruction scheduling.
Although we observed the problem on ppc64le, this is a platform neutral issue.

This patch makes the stack coloring pass maintains AliasAnalysis information when merging multiple stack slots.

This patch fixes PR33928.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309849 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Xray docs with description of Flight Data Recorder binary format."
Keith Wyss [Wed, 2 Aug 2017 17:36:52 +0000 (17:36 +0000)]
Revert "Xray docs with description of Flight Data Recorder binary format."

This reverts commit 3462b8ad41a840fd54dbbd0d3f2a514c5ad6f656.

The docs-llvm-html target failed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309842 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AsmParser][GAS-compatibility] Ignore an empty 'p2align' directive
Coby Tayree [Wed, 2 Aug 2017 17:36:10 +0000 (17:36 +0000)]
[AsmParser][GAS-compatibility] Ignore an empty 'p2align' directive

GAS ignores the aforementioned issue
this patch aligns LLVM + throws in an appropriate warning

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309841 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Add missing test case for (xor (sext (cmp)), -1) -> (sext (!cmp)).
Craig Topper [Wed, 2 Aug 2017 17:33:02 +0000 (17:33 +0000)]
[InstCombine] Add missing test case for (xor (sext (cmp)), -1) -> (sext (!cmp)).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309839 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoXray docs with description of Flight Data Recorder binary format.
Keith Wyss [Wed, 2 Aug 2017 17:27:20 +0000 (17:27 +0000)]
Xray docs with description of Flight Data Recorder binary format.

Summary:
Adding a new restructuredText file to document the trace format produced with
an FDR mode handler and read by llvm-xray toolset.

Reviewers: dberris, pelikan

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309836 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAssert that the offset of a DBG_VALUE is always 0. (NFC)
Adrian Prantl [Wed, 2 Aug 2017 17:19:13 +0000 (17:19 +0000)]
Assert that the offset of a DBG_VALUE is always 0. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309834 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs"
Reid Kleckner [Wed, 2 Aug 2017 17:16:25 +0000 (17:16 +0000)]
Revert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs"

This reverts r309602, check-lit still leaves Output directories in the
source directory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309833 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Restore using MRI to find highest used regs
Matt Arsenault [Wed, 2 Aug 2017 17:15:01 +0000 (17:15 +0000)]
AMDGPU: Restore using MRI to find highest used regs

If there are no calls, this is a faster path than
searching the entire program for calls.

This was supposed to be left in r309781.
Fixes unused variable warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309832 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove the unused Offset field from MachineLocation (NFC)
Adrian Prantl [Wed, 2 Aug 2017 17:07:38 +0000 (17:07 +0000)]
Remove the unused Offset field from MachineLocation (NFC)

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309831 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAG] Improve candidate pruning in store merge failure case. NFCI
Nirav Dave [Wed, 2 Aug 2017 16:35:58 +0000 (16:35 +0000)]
[DAG] Improve candidate pruning in store merge failure case. NFCI

During store merge we construct a sorted list of consecutive store
candidates and consider subsequences for merging into a single
store. For each subsequence we check if the stored value type is legal
the merged store would have valid and fast and if the constructed
value to be stored is valid. The only properties that affect this
check between subsequences is the size of the subsequence, the
alignment of the first store, the alignment of the stored load value
(when merging stores-of-loads), and whether the merged value is a
constant zero.

If we do not find a viable mergeable subsequence starting from the
first store of length N, we know that a subsequence starting at a
later store of length N will also fail unless the new store's
alignment, the new load's alignment (if we're merging store-of-loads),
or we've dropped stores of nonzero value and could construct a merged
stores of zero (for merging constants).

As a result if we fail to find a valid subsequence starting from the
first store we can safely skip considering subsequences that start
with subsequent stores unless one of the above properties is
true. This significantly (2x) improves compile time in some
pathological cases.

Reviewers: RKSimon, efriedma, zvi, spatel, waltl

Subscribers: grandinj, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309830 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Improve the test of conditional branch fusion
Evandro Menezes [Wed, 2 Aug 2017 15:34:06 +0000 (15:34 +0000)]
[AArch64] Improve the test of conditional branch fusion

Separate the checking of the fused pairings with B.cc and CBcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309825 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unused includes of MachineLocation.h (NFC)
Adrian Prantl [Wed, 2 Aug 2017 15:32:18 +0000 (15:32 +0000)]
Remove unused includes of MachineLocation.h (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309824 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unreachable code. (NFC)
Adrian Prantl [Wed, 2 Aug 2017 15:22:17 +0000 (15:22 +0000)]
Remove unreachable code. (NFC)

MachineLocation::getOffset() always returns 0.

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309823 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Simplify AES*Tied pseudo expansion (NFC).
Florian Hahn [Wed, 2 Aug 2017 15:17:19 +0000 (15:17 +0000)]
[AArch64] Simplify AES*Tied pseudo expansion (NFC).

Summary:
Suggested by @t.p.northover in https://bugs.llvm.org/show_bug.cgi?id=34015.

Reviewers: javed.absar, t.p.northover, rengolin

Reviewed By: t.p.northover

Subscribers: aemerson, kristof.beyls, llvm-commits, t.p.northover

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309821 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InlineCost] Remove redundant call. NFC.
Chad Rosier [Wed, 2 Aug 2017 14:50:27 +0000 (14:50 +0000)]
[InlineCost] Remove redundant call. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309819 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAssert that the offset in MachineLocation::set() is always 0. (NFC)
Adrian Prantl [Wed, 2 Aug 2017 14:45:50 +0000 (14:45 +0000)]
Assert that the offset in MachineLocation::set() is always 0. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309818 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InlineCost] Simplify more 'and' and 'or' operations.
Chad Rosier [Wed, 2 Aug 2017 14:40:42 +0000 (14:40 +0000)]
[InlineCost] Simplify more 'and' and 'or' operations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309817 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLPVectorizer] Generalize interface of functions, NFC.
Alexey Bataev [Wed, 2 Aug 2017 14:38:07 +0000 (14:38 +0000)]
[SLPVectorizer] Generalize interface of functions, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309816 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLPVectorizer] Test update, NFC.
Alexey Bataev [Wed, 2 Aug 2017 14:22:53 +0000 (14:22 +0000)]
[SLPVectorizer] Test update, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309814 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Fix for PR31880: shuffle and vectorize repeated scalar ops on extracted elements
Alexey Bataev [Wed, 2 Aug 2017 13:25:26 +0000 (13:25 +0000)]
[SLP] Fix for PR31880: shuffle and vectorize repeated scalar ops on extracted elements

Summary:
Currently most of the time vectors of extractelement instructions are
treated as scalars that must be gathered into vectors. But in some
cases, like when we have extractelement instructions from single vector
with different constant indeces or from 2 vectors of the same size, we
can treat this operations as shuffle of a single vector or blending of 2
vectors.
```
define <2 x i8> @g(<2 x i8> %x, <2 x i8> %y) {
  %x0 = extractelement <2 x i8> %x, i32 0
  %y1 = extractelement <2 x i8> %y, i32 1
  %x0x0 = mul i8 %x0, %x0
  %y1y1 = mul i8 %y1, %y1
  %ins1 = insertelement <2 x i8> undef, i8 %x0x0, i32 0
  %ins2 = insertelement <2 x i8> %ins1, i8 %y1y1, i32 1
  ret <2 x i8> %ins2
}
```
can be converted to something like
```
define <2 x i8> @g(<2 x i8> %x, <2 x i8> %y) {
  %1 = shufflevector <2 x i8> %x, <2 x i8> %y, <2 x i32> <i32 0, i32 3>
  %2 = mul <2 x i8> %1, %1
  ret <2 x i8> %2
}
```
Currently this type of conversion is considered as high cost
transformation.

Reviewers: mzolotukhin, delena, mkuper, hfinkel, RKSimon

Subscribers: ashahid, RKSimon, spatel, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309812 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MIR] Print target-specific constant pools
Diana Picus [Wed, 2 Aug 2017 11:09:30 +0000 (11:09 +0000)]
[MIR] Print target-specific constant pools

This should enable us to test the generation of target-specific constant
pools, e.g. for ARM:

constants:
 - id:              0
   value:           'g(GOT_PREL)-(LPC0+8-.)'
   alignment:       4
   isTargetSpecific: true

I intend to use this to test PIC support in GlobalISel for ARM.

This is difficult to test outside of that context, since the existing
MIR tests usually rely on parser support as well, and that seems a bit
trickier to add. We could try to add a unit test, but the setup for that
seems rather convoluted and overkill.

We do test however that the parser reports a nice error when
encountering a target-specific constant pool.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309806 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[globalisel][tablegen] Do not merge memoperands from instructions that weren't in...
Daniel Sanders [Wed, 2 Aug 2017 11:03:36 +0000 (11:03 +0000)]
[globalisel][tablegen] Do not merge memoperands from instructions that weren't in the match.

Summary:
Fix a bug discovered in an out-of-tree target where memoperands from
pseudo-instructions that weren't part of the match were being merged into the
result instructions as part of GIR_MergeMemOperands.

This bug was caused by a change to the handling of State.MIs between rules when
the state machine tables were fused into a single table. Previously, each rule
would reset State.MIs using State.MIs.resize(1) but this is no longer done, as a
result stale data is occasionally left in some elements of State.MIs. Most
opcodes aren't affected by this but GIR_MergeMemOperands merges all memoperands
from the intructions recorded in State.MIs into the result instruction.

Suppose for example, we processed but rejected the following pattern:
  (signextend (load x))
at this point, State.MIs contains the signextend and the load. Now suppose we
process and accept this pattern:
  (add x, y)
at this point, State.MIs contains the add as well as the (now irrelevant) load.
When GIR_MergeMemOperands is processed, the memoperands from that irrelevant
load will be merged into the result instruction even though it was not part of
the match.

Bringing back the State.MIs.resize(1) would fix the problem but it would limit
our ability to optimize the table in the future. Instead, this patch fixes the
problem by explicitly stating which instructions should be merged into the result.

There's no direct test case in this commit because a test case would be very brittle.
However, at the time of writing this should fix the failures in
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/ as well as a
failure in test/CodeGen/ARM/GlobalISel/arm-isel.ll when expensive checks are enabled.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: fhahn, kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309804 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Add test cases for 'or' and 'xor' to match the vector 'and' of 'sext...
Craig Topper [Wed, 2 Aug 2017 06:35:15 +0000 (06:35 +0000)]
[InstCombine] Add test cases for 'or' and 'xor' to match the vector 'and' of 'sext' of 'cmp' test.

When the 'and' test was originally added it was intended to make sure we didn't change it to a sext of and of cmp. But since then the test was changed to expect it to be turned into 'select cmp1, sext cmp2, 0'. Then another optimization was added to turn the select into 'sext (and cmp1, cmp2)' which is exactly the transformation that was being blocked when the test case started.

Looks like 'or' gets optimized in a similar way, but not 'xor'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309793 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[NewGVN] Fold single-use variables. NFCI.
Davide Italiano [Wed, 2 Aug 2017 04:05:49 +0000 (04:05 +0000)]
[NewGVN] Fold single-use variables. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309790 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[NewGVN] Remove a (now stale) comment. NFCI.
Davide Italiano [Wed, 2 Aug 2017 03:51:40 +0000 (03:51 +0000)]
[NewGVN] Remove a (now stale) comment. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309789 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix the bug that parseAAPipeline is not invoked in runNewPMPasses in release compiler.
Dehao Chen [Wed, 2 Aug 2017 03:03:19 +0000 (03:03 +0000)]
Fix the bug that parseAAPipeline is not invoked in runNewPMPasses in release compiler.

Summary: The logic is guarded by "assert".

Reviewers: davidxl, davide, chandlerc

Reviewed By: davide, chandlerc

Subscribers: sanjoy, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309787 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SimplifyCFG] Fix typo in comment. NFC
Craig Topper [Wed, 2 Aug 2017 02:34:16 +0000 (02:34 +0000)]
[SimplifyCFG] Fix typo in comment. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309785 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PM] Fix a bug where through CGSCC iteration we can get
Chandler Carruth [Wed, 2 Aug 2017 02:09:22 +0000 (02:09 +0000)]
[PM] Fix a bug where through CGSCC iteration we can get
infinite-inlining across multiple runs of the inliner by keeping a tiny
history of internal-to-SCC inlining decisions.

This is still a bit gross, but I don't yet have any fundamentally better
ideas and numerous people are blocked on this to use new PM and ThinLTO
together.

The core of the idea is to detect when we are about to do an inline that
has a chance of re-splitting an SCC which we have split before with
a similar inlining step. That is a critical component in the inlining
forming a cycle and so far detects all of the various cyclic patterns
I can come up with as well as the original real-world test case (which
comes from a ThinLTO build of libunwind).

I've added some tests that I think really demonstrate what is going on
here. They are essentially state machines that march the inliner through
various steps of a cycle and check that we stop when the cycle is closed
and that we actually did do inlining to form that cycle.

A lot of thanks go to Eric Christopher and Sanjoy Das for the help
understanding this issue and improving the test cases.

The biggest "yuck" here is the layering issue -- the CGSCC pass manager
is providing somewhat magical state to the inliner for it to use to make
itself converge. This isn't great, but I don't honestly have a lot of
better ideas yet and at least seems nicely isolated.

I have tested this patch, and it doesn't block *any* inlining on the
entire LLVM test suite and SPEC, so it seems sufficiently narrowly
targeted to the issue at hand.

We have come up with hypothetical issues that this patch doesn't cover,
but so far none of them are practical and we don't have a viable
solution yet that covers the hypothetical stuff, so proceeding here in
the interim. Definitely an area that we will be back and revisiting in
the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309784 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Fix clobbering CSR VGPRs when spilling SGPR to it
Matt Arsenault [Wed, 2 Aug 2017 01:52:45 +0000 (01:52 +0000)]
AMDGPU: Fix clobbering CSR VGPRs when spilling SGPR to it

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309783 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Fix emitting encoded calls
Matt Arsenault [Wed, 2 Aug 2017 01:42:04 +0000 (01:42 +0000)]
AMDGPU: Fix emitting encoded calls

This was failing on out of bounds access to the extra operands
on the s_swappc_b64 beyond those in the instruction definition.

This was working, but somehow regressed within the past few weeks,
although I don't see any obvious commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309782 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Analyze callee resource usage in AsmPrinter
Matt Arsenault [Wed, 2 Aug 2017 01:31:28 +0000 (01:31 +0000)]
AMDGPU: Analyze callee resource usage in AsmPrinter

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309781 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate the new PM pipeline to make ICP aware if it is SamplePGO build.
Dehao Chen [Wed, 2 Aug 2017 01:28:31 +0000 (01:28 +0000)]
Update the new PM pipeline to make ICP aware if it is SamplePGO build.

Summary: In ThinLTO backend compile, OPTOptions are not set so that the ICP in ThinLTO backend does not know if it is a SamplePGO build, in which profile count needs to be annotated directly on call instructions. This patch cleaned up the PGOOptions handling logic and passes down PGOOptions to ThinLTO backend.

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309780 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Fix asan error after last commit
Stanislav Mekhanoshin [Wed, 2 Aug 2017 01:18:57 +0000 (01:18 +0000)]
[AMDGPU] Fix asan error after last commit

Previous change "Turn s_and_saveexec_b64 into s_and_b64 if
result is unused" introduced asan use-after-poison error.
Instruction was analyzed after eraseFromParent() calls.

Move analysys higher than erase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309779 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAG] Refactor store merge subexpressions. NFC.
Nirav Dave [Wed, 2 Aug 2017 01:08:38 +0000 (01:08 +0000)]
[DAG] Refactor store merge subexpressions. NFC.

Distribute various expressions across ifs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309777 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Don't place arguments in emergency stack slot
Matt Arsenault [Wed, 2 Aug 2017 00:59:51 +0000 (00:59 +0000)]
AMDGPU: Don't place arguments in emergency stack slot

When finding the fixed offsets for function arguments,
this needs to skip over the 4 bytes reserved for the
emergency stack slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309776 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDAG: Undo and->or combine with FrameIndexes
Matt Arsenault [Wed, 2 Aug 2017 00:43:42 +0000 (00:43 +0000)]
DAG: Undo and->or combine with FrameIndexes

This pattern shows up when lowering byval copies on AMDGPU.

The byval object access is split into 4-byte chunks, adding a
constant offset to the FixedStack base. When some of the offsets
turn into ors, this prevents combining the constant offsets.

This makes it not apparent that the object is there when matching
addressing modes, so it ends up using a scratch wave offset
relative access and the lengthy frame index expansion for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309775 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoX86: Do not use llc -march in tests.
Matthias Braun [Wed, 2 Aug 2017 00:28:10 +0000 (00:28 +0000)]
X86: Do not use llc -march in tests.

`llc -march` is problematic because it only switches the target
architecture, but leaves the operating system unchanged. This
occasionally leads to indeterministic tests because the OS from
LLVM_DEFAULT_TARGET_TRIPLE is used.

However we can simply always use `llc -mtriple` instead. This changes
all the tests to do this to avoid people using -march when they copy and
paste parts of tests.

See also the discussion in https://reviews.llvm.org/D35287

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309774 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate LiveDebugValues to generate DIExpressions for spill offsets
Adrian Prantl [Wed, 2 Aug 2017 00:16:56 +0000 (00:16 +0000)]
Update LiveDebugValues to generate DIExpressions for spill offsets
instead of using the deprecated offset field of DBG_VALUE.

This has no observable effect on the generated DWARF, but the
assembler comments will look different.

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309773 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm...
Petr Hosek [Wed, 2 Aug 2017 00:03:33 +0000 (00:03 +0000)]
Revert "Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy""

This is failing to compile on 32-bit ARM bots.

This reverts commit r309768.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309771 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate MIR testcase to reflect change in r309751.
Adrian Prantl [Tue, 1 Aug 2017 23:47:23 +0000 (23:47 +0000)]
Update MIR testcase to reflect change in r309751.

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309769 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
Petr Hosek [Tue, 1 Aug 2017 23:46:33 +0000 (23:46 +0000)]
Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"

This change adds the "-O binary" flag which directs llvm-objcopy to
output the object file to the same format as GNU objcopy does when given
the flag "-O binary". This was done by splitting the Object class into
two subclasses ObjectELF and ObjectBianry which each output a different
format but relay on the same code to read in the Object in Object.

Patch by Jake Ehrlich

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309768 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Turn s_and_saveexec_b64 into s_and_b64 if result is unused
Stanislav Mekhanoshin [Tue, 1 Aug 2017 23:44:35 +0000 (23:44 +0000)]
[AMDGPU] Turn s_and_saveexec_b64 into s_and_b64 if result is unused

With SI_END_CF elimination for some nested control flow we can now
eliminate saved exec register completely by turning a saveexec version
of instruction into just a logical instruction.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309766 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unused accessor (NFC)
Adrian Prantl [Tue, 1 Aug 2017 23:16:36 +0000 (23:16 +0000)]
Remove unused accessor (NFC)

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309763 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Collapse adjacent SI_END_CF
Stanislav Mekhanoshin [Tue, 1 Aug 2017 23:14:32 +0000 (23:14 +0000)]
[AMDGPU] Collapse adjacent SI_END_CF

Add a pass to remove redundant S_OR_B64 instructions enabling lanes in
the exec. If two SI_END_CF (lowered as S_OR_B64) come together without any
vector instructions between them we can only keep outer SI_END_CF, given
that CFG is structured and exec bits of the outer end statement are always
not less than exec bit of the inner one.

This needs to be done before the RA to eliminate saved exec bits registers
but after register coalescer to have no vector registers copies in between
of different end cf statements.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309762 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAssert that the offset of a MachineLocation is always 0.
Adrian Prantl [Tue, 1 Aug 2017 22:57:05 +0000 (22:57 +0000)]
Assert that the offset of a MachineLocation is always 0.
This is to convince me that it may safely be removed in a follow-up commit.

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309761 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV/IndVars] Always compute loop exiting values if the backedge count is 0
Sanjoy Das [Tue, 1 Aug 2017 22:37:58 +0000 (22:37 +0000)]
[SCEV/IndVars] Always compute loop exiting values if the backedge count is 0

If SCEV can prove that the backedge taken count for a loop is zero, it does not
need to "understand" a recursive PHI to compute its exiting value.

This should fix PR33885.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309758 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse helper function instead of manually constructing DBG_VALUEs (NFC)
Adrian Prantl [Tue, 1 Aug 2017 22:37:35 +0000 (22:37 +0000)]
Use helper function instead of manually constructing DBG_VALUEs (NFC)

rdar://problem/33580047

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309757 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoARM: Do not use llc -march in tests.
Matthias Braun [Tue, 1 Aug 2017 22:20:49 +0000 (22:20 +0000)]
ARM: Do not use llc -march in tests.

`llc -march` is problematic because it only switches the target
architecture, but leaves the operating system unchanged. This
occasionally leads to indeterministic tests because the OS from
LLVM_DEFAULT_TARGET_TRIPLE is used.

However we can simply always use `llc -mtriple` instead. This changes
all the tests to do this to avoid people using -march when they copy and
paste parts of tests.

See also the discussion in https://reviews.llvm.org/D35287

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309755 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPowerPC: Do not use llc -march in tests.
Matthias Braun [Tue, 1 Aug 2017 22:20:41 +0000 (22:20 +0000)]
PowerPC: Do not use llc -march in tests.

`llc -march` is problematic because it only switches the target
architecture, but leaves the operating system unchanged. This
occasionally leads to indeterministic tests because the OS from
LLVM_DEFAULT_TARGET_TRIPLE is used.

However we can simply always use `llc -mtriple` instead. This changes
all the tests to do this to avoid people using -march when they copy and
paste parts of tests.

This patch:
- Removes -march if the .ll file already has a matching `target triple`
  directive or -mtriple argument.
- In all other cases changes -march=ppc32/-march=ppc64 to
  -mtriple=ppc32--/-mtriple=ppc64--

See also the discussion in https://reviews.llvm.org/D35287

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309754 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove PrologEpilogInserter's usage of DBG_VALUE's offset field
Adrian Prantl [Tue, 1 Aug 2017 21:45:24 +0000 (21:45 +0000)]
Remove PrologEpilogInserter's usage of DBG_VALUE's offset field

In the last half-dozen commits to LLVM I removed code that became dead
after removing the offset parameter from llvm.dbg.value gradually
proceeding from IR towards the backend. Before I can move on to
DwarfDebug and friends there is one last side-called offset I need to
remove:  This patch modifies PrologEpilogInserter's use of the
DBG_VALUE's offset argument to use a DIExpression instead. Because the
PrologEpilogInserter runs at the Machine level I had to play a little
trick with a named llvm.dbg.mir node to get the DIExpressions to print
in MIR dumps (which print the llvm::Module followed by the
MachineFunction dump).

I also had to add rudimentary DwarfExpression support to CodeView and
as a side-effect also fixed a bug (CodeViewDebug::collectVariableInfo
was supposed to give up on variables with complex DIExpressions, but
would fail to do so for fragments, which are also modeled as
DIExpressions).

With this last holdover removed we will have only one canonical way of
representing offsets to debug locations which will simplify the code
in DwarfDebug (and future versions of CodeViewDebug once it starts
handling more complex expressions) and make it easier to reason about.

This patch is NFC-ish: All test case changes are for assembler
comments and the binary output does not change.

rdar://problem/33580047
Differential Revision: https://reviews.llvm.org/D36125

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309751 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Fix a typo in isExtFreeImpl()
Haicheng Wu [Tue, 1 Aug 2017 21:26:45 +0000 (21:26 +0000)]
[AArch64] Fix a typo in isExtFreeImpl()

next => not

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309748 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-cov] Allow specifying distinct architectures for each loaded binary
Vedant Kumar [Tue, 1 Aug 2017 21:23:26 +0000 (21:23 +0000)]
[llvm-cov] Allow specifying distinct architectures for each loaded binary

The coverage tool needs to know which slice to look at when it's handed
a universal binary. Some projects need to look at aggregate coverage
reports for a variety of slices in different binaries: this patch adds
support for these kinds of projects to llvm-cov.

rdar://problem/33579007

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309747 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 1 Aug 2017 21:20:10 +0000 (21:20 +0000)]
[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309746 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Rewrite stack frame handling for win64 vararg functions
Martin Storsjo [Tue, 1 Aug 2017 21:13:54 +0000 (21:13 +0000)]
[AArch64] Rewrite stack frame handling for win64 vararg functions

The previous attempt, which made do with a single offset in
computeCalleeSaveRegisterPairs, wasn't quite enough. The previous
attempt only worked as long as CombineSPBump == true (since the
offset would be adjusted later in fixupCalleeSaveRestoreStackOffset).

Instead include the size for the fixed stack area used for win64
varargs in calculations in emitPrologue/emitEpilogue. The stack
consists of mainly three parts;
- AFI->getLocalStackSize()
- AFI->getCalleeSavedStackSize()
- FixedObject

Most of the places in the code which previously used the CSStackSize
now use PrologueSaveSize instead, which is the sum of the latter
two, while some cases which need exactly the middle one use
AFI->getCalleeSavedStackSize() explicitly instead of a local variable.

In addition to moving the offsetting into emitPrologue/emitEpilogue
(which fixes functions with CombineSPBump == false), also set the
frame pointer to point to the right location, where the frame pointer
and link register actually are stored. In addition to the prologue/epilogue,
this also requires changes to resolveFrameIndexReference.

Add tests for a function that keeps a frame pointer and another one
that uses a VLA.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309744 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Fix handling of div_scale with undef inputs
Matt Arsenault [Tue, 1 Aug 2017 20:49:41 +0000 (20:49 +0000)]
AMDGPU: Fix handling of div_scale with undef inputs

The src0 register must match src1 or src2, but if these
were undefined they could end up using different implicit_defed
virtual registers. Force these to use one undef vreg or pick the
defined other register.

Also fixes producing invalid nodes without the right number of
inputs when src2 is undef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309743 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAG] Factor out common expressions. NFC.
Nirav Dave [Tue, 1 Aug 2017 20:30:52 +0000 (20:30 +0000)]
[DAG] Factor out common expressions. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309740 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Value Tracking] Default argument to true and rename accordingly. NFC.
Chad Rosier [Tue, 1 Aug 2017 20:18:54 +0000 (20:18 +0000)]
[Value Tracking] Default argument to true and rename accordingly. NFC.

IMHO this is a bit more readable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309739 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Add test for r308774
Matt Arsenault [Tue, 1 Aug 2017 19:54:58 +0000 (19:54 +0000)]
AMDGPU: Add test for r308774

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309733 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Initial implementation of calls
Matt Arsenault [Tue, 1 Aug 2017 19:54:18 +0000 (19:54 +0000)]
AMDGPU: Initial implementation of calls

Includes a hack to fix the type selected for
the GlobalAddress of the function, which will be
fixed by changing the default datalayout to use
generic pointers for 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309732 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Don't turn dbg.declare into DBG_VALUE for static allocas
Reid Kleckner [Tue, 1 Aug 2017 19:45:09 +0000 (19:45 +0000)]
[DebugInfo] Don't turn dbg.declare into DBG_VALUE for static allocas

Summary:
We already have information about static alloca stack locations in our
side table. Emitting instructions for them is inefficient, and it only
happens when the address of the alloca has been materialized within the
current block, which isn't often.

Reviewers: aprantl, probinson, dblaikie

Subscribers: jfb, dschuff, sbc100, jgravelle-google, hiraditya, llvm-commits, aheejin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309729 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Value Tracking] Refactor and/or logic into helper. NFC.
Chad Rosier [Tue, 1 Aug 2017 19:22:36 +0000 (19:22 +0000)]
[Value Tracking] Refactor and/or logic into helper. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309726 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Put a function used only inside assert() under NDEBUG.
Davide Italiano [Tue, 1 Aug 2017 19:07:20 +0000 (19:07 +0000)]
[AMDGPU] Put a function used only inside assert() under NDEBUG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309723 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lanai] Add getIntImmCost in LanaiTargetTransformInfo.
Jacques Pienaar [Tue, 1 Aug 2017 18:40:08 +0000 (18:40 +0000)]
[lanai] Add getIntImmCost in LanaiTargetTransformInfo.

Add simple int immediate cost function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309721 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPull out VectorNumElements value. NFC.
Nirav Dave [Tue, 1 Aug 2017 18:19:56 +0000 (18:19 +0000)]
Pull out VectorNumElements value. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309719 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE3] Add scheduler tests for MONITOR/MWAIT
Simon Pilgrim [Tue, 1 Aug 2017 18:16:44 +0000 (18:16 +0000)]
[X86][SSE3] Add scheduler tests for MONITOR/MWAIT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309718 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector."
Nirav Dave [Tue, 1 Aug 2017 18:09:25 +0000 (18:09 +0000)]
Revert "[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector."

This reverts commit r309680 which appears to be raising an assertion
in the test-suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309717 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] temporarty remove pc-tables and disable test/fuzzer-printcovpcs.test...
Kostya Serebryany [Tue, 1 Aug 2017 18:02:19 +0000 (18:02 +0000)]
[libFuzzer] temporarty remove pc-tables and disable test/fuzzer-printcovpcs.test until this can be fixed on Windows

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309716 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Added missing vector logic intrinsic schedules
Simon Pilgrim [Tue, 1 Aug 2017 17:51:20 +0000 (17:51 +0000)]
[X86][SSE] Added missing vector logic intrinsic schedules

Improves atom scheduler test coverage (to make it easier to upgrade them for PR32431).

Merged SSE_VEC_BIT_ITINS_P + SSE_BIT_ITINS_P as we were interchanging between them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309715 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CGP] use narrower types in memcmp expansion when possible
Sanjay Patel [Tue, 1 Aug 2017 17:24:54 +0000 (17:24 +0000)]
[CGP] use narrower types in memcmp expansion when possible

This only affects very small memcmp on x86 for now, but it
will become more important if we allow vector-sized load and
compares.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309711 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAG] Convert extload check to equivalent type check. NFC.
Nirav Dave [Tue, 1 Aug 2017 17:19:41 +0000 (17:19 +0000)]
[DAG] Convert extload check to equivalent type check. NFC.

Replace check with check that consuming store has the same type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309708 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Use BEXTR/BEXTRI for 64-bit 'and' with a large mask
Craig Topper [Tue, 1 Aug 2017 17:18:14 +0000 (17:18 +0000)]
[X86] Use BEXTR/BEXTRI for 64-bit 'and' with a large mask

Summary: The 64-bit 'and' with immediate instruction only supports a 32-bit immediate. So for larger constants we have to load the constant into a register first. If the immediate happens to be a mask we can use the BEXTRI instruction to perform the masking. We already do something similar using the BZHI instruction from the BMI2 instruction set.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309706 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Added missing PACKSS/PACKUS intrinsic schedules
Simon Pilgrim [Tue, 1 Aug 2017 16:47:48 +0000 (16:47 +0000)]
[X86][SSE] Added missing PACKSS/PACKUS intrinsic schedules

Improves atom scheduler test coverage (to make it easier to upgrade them for PR32431).

Checked on Agner that these actually match the UNPACK schedules, but better to include a separate class

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309701 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Split bmi.ll into a bmi test and a bmi2 test.
Craig Topper [Tue, 1 Aug 2017 16:45:11 +0000 (16:45 +0000)]
[X86] Split bmi.ll into a bmi test and a bmi2 test.

This moves all the bmi2 specific intrinsics to a separate test file and adds a bmi1 only command line to the existing bmi test.

This will allow us to see the missed opportunity to use bextr to handle 64-bit 'and' with a large mask. This will be improved in an upcoming patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309700 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSSE3] Added missing PHADDS/PHSUBS/PSIGN intrinsic schedules
Simon Pilgrim [Tue, 1 Aug 2017 16:18:25 +0000 (16:18 +0000)]
[X86][SSSE3] Added missing PHADDS/PHSUBS/PSIGN intrinsic schedules

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309699 91177308-0d34-0410-b5e6-96231b3b80d8