OSDN Git Service

android-x86/external-llvm.git
6 years ago[GlobalISel] Constrain the dest reg of IMPLICT_DEF.
Amara Emerson [Fri, 2 Feb 2018 01:44:43 +0000 (01:44 +0000)]
[GlobalISel] Constrain the dest reg of IMPLICT_DEF.

This fixes a crash where the user is a COPY, which deliberately does not
constrain its source operands, resulting in a vreg without a reg class escaping
selection.

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

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

6 years agoRemove non-modular header containing static utility functions
David Blaikie [Fri, 2 Feb 2018 00:33:50 +0000 (00:33 +0000)]
Remove non-modular header containing static utility functions

The one place that uses these functions isn't particularly
long/complicated, so it's easier to just have these inline at that
location than trying to split it out into a true header. (in part also
because of the use of the DEBUG macros, which make this not really a
standalone header even if the static functions were made inline instead)

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

6 years agoAdd missing includes
David Blaikie [Fri, 2 Feb 2018 00:11:09 +0000 (00:11 +0000)]
Add missing includes

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

6 years agoSplitKit: Fix liveness recomputation in some remat cases.
Matthias Braun [Fri, 2 Feb 2018 00:08:19 +0000 (00:08 +0000)]
SplitKit: Fix liveness recomputation in some remat cases.

Example situation:
```
BB0:
  %0 = ...
  use %0
  ; ...
  condjump BB1
  jmp BB2

BB1:
  %0 = ...   ; rematerialized def from above (from earlier split step)
  jmp BB2

BB2:
  ; ...
  use %0
```

%0 will have a live interval with 3 value numbers (for the BB0, BB1 and
BB2 parts). Now SplitKit tries and succeeds in rematerializing the value
number in BB2 (This only works because it is a secondary split so
SplitKit is can trace this back to a single original def).

We need to recompute all live ranges affected by a value number that we
rematerialize. The case that we missed before is that when the value
that is rematerialized is at a join (Phi VNI) then we also have to
recompute liveness for the predecessor VNIs.

rdar://35699130

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

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

6 years agoFix broken builds due to mismatched min/max types
Vlad Tsyrklevich [Fri, 2 Feb 2018 00:07:14 +0000 (00:07 +0000)]
Fix broken builds due to mismatched min/max types

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

6 years ago[cfi-verify] Add blame context printing, and improved print format.
Vlad Tsyrklevich [Thu, 1 Feb 2018 23:45:18 +0000 (23:45 +0000)]
[cfi-verify] Add blame context printing, and improved print format.

Summary:
This update now allows users to specify `--blame-context` and `--blame-context-all` to print source file blame information for the source of the blame.

Also updates the inline printing to correctly identify the top of the inlining stack for blame information.

Patch by Mitch Phillips!

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits, kcc, pcc

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

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

6 years ago[X86] Separate the call to LowerVectorAllZeroTest from EmitTest. NFCI
Craig Topper [Thu, 1 Feb 2018 23:21:20 +0000 (23:21 +0000)]
[X86] Separate the call to LowerVectorAllZeroTest from EmitTest. NFCI

Every instruction that has the word TEST in its name seems to have been buried into EmitTest. But that code is largely concerned with trying to reuse the flags from instructions that update flags in a pretty normal way.

PTEST/TESTP/KTEST do not update flags in a normal way. They only update Z and C and the C flag update is non-standard. Rather than try to bend EmitTest's already complex logic to accomodate this, just move the call up to LowerSETCC and replicate the few pre-checks that are needed.

While there add a FIXME for using the C flag for checking for all 1s which we definitely couldn't do from EmitTEST.

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

6 years ago[GlobalISel][Legalizer] Relax a legalization loop detecting assert.
Amara Emerson [Thu, 1 Feb 2018 23:10:57 +0000 (23:10 +0000)]
[GlobalISel][Legalizer] Relax a legalization loop detecting assert.

Legalizing vectors may keep the element type the same but change the number of
elements, the assert didn't take this into account.

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

6 years agoFix check-prefixes typo and line endings.
Simon Pilgrim [Thu, 1 Feb 2018 22:32:41 +0000 (22:32 +0000)]
Fix check-prefixes typo and line endings.

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

6 years ago[X86][SSE] Add SSE41 to variable permute tests
Simon Pilgrim [Thu, 1 Feb 2018 22:05:44 +0000 (22:05 +0000)]
[X86][SSE] Add SSE41 to variable permute tests

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

6 years ago[X86][XOP] Add XOP to variable permute tests
Simon Pilgrim [Thu, 1 Feb 2018 21:57:37 +0000 (21:57 +0000)]
[X86][XOP] Add XOP to variable permute tests

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

6 years ago[InstCombine] allow multi-use values in canEvaluate* if all uses are in 1 inst
Sanjay Patel [Thu, 1 Feb 2018 21:55:53 +0000 (21:55 +0000)]
[InstCombine] allow multi-use values in canEvaluate* if all uses are in 1 inst

This is the enhancement suggested in D42536 to fix a shortcoming in
regular InstCombine's canEvaluate* functionality.
When we have multiple uses of a value, but they're all in one instruction, we can
allow that expression to be narrowed or widened for the same cost as a single-use
value.

AFAICT, this can only matter for multiply: sub/and/or/xor/select would be simplified
away if the operands are the same value; add becomes shl; shifts with a variable shift
amount aren't handled.

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

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

6 years ago[PowerPC] Tell VSX swap removal that scalar conversions are lane-sensitive
Nemanja Ivanovic [Thu, 1 Feb 2018 21:09:04 +0000 (21:09 +0000)]
[PowerPC] Tell VSX swap removal that scalar conversions are lane-sensitive

This is a rather non-controversial change. We were missing these instructions
from the list of instructions that are lane-sensitive. These two put the result
into lane 0 (BE) or 3 (LE) regardless of the input. This patch fixes PR36068.

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

6 years agoCoding Standards: Document library layering requirements & header isolation.
David Blaikie [Thu, 1 Feb 2018 21:03:35 +0000 (21:03 +0000)]
Coding Standards: Document library layering requirements & header isolation.

(I suppose these two pieces could be separated - but seemed related
enough)

As discussed on llvm-dev, this documents the general expectation of how
library layering should be handled. There are a few existing cases where
these constraints are not met, but as with most style guide things -
this is forward looking and provides guidance when cleaning up existing
code, it doesn't immediately require that all previous code be cleaned
up to match. (see: naming conventions, etc)

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

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

6 years ago[DAGCombiner] When folding (insert_subvector undef, (bitcast (extract_subvector N1...
Craig Topper [Thu, 1 Feb 2018 20:48:50 +0000 (20:48 +0000)]
[DAGCombiner] When folding (insert_subvector undef, (bitcast (extract_subvector N1, Idx)), Idx) -> (bitcast N1) make sure that N1 has the same total size as the original output

We were only checking the element count, but not the total width. This could cause illegal bitcasts to be created if for example the output was 512-bits, but N1 is 256 bits, and the extraction size was 128-bits.

Fixes PR36199

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

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

6 years ago[GlobalISel] Fix assert failure when legalizing non-power-2 loads.
Amara Emerson [Thu, 1 Feb 2018 20:47:03 +0000 (20:47 +0000)]
[GlobalISel] Fix assert failure when legalizing non-power-2 loads.

Until we support extending loads properly we're going to fall back for these.
We already handle stores in the same way, so this is just being consistent.

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

6 years ago[CodeView] Class record member counts should include base classes and ...
Brock Wyma [Thu, 1 Feb 2018 20:37:38 +0000 (20:37 +0000)]
[CodeView] Class record member counts should include base classes and ...

Increment the field list member count for base classes and virtual base
classes.

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

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

6 years ago[ADT] Replace sys::MemoryFence with standard atomics.
Benjamin Kramer [Thu, 1 Feb 2018 20:28:33 +0000 (20:28 +0000)]
[ADT] Replace sys::MemoryFence with standard atomics.

This is a bit faster in theory, in practice it's cold code that's only
active in !NDEBUG, so it probably doesn't make a difference. This is one
of the last users of our homegrown Atomic.h.

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

6 years ago[AArch64] remove bogus comment; NFC
Sanjay Patel [Thu, 1 Feb 2018 19:59:33 +0000 (19:59 +0000)]
[AArch64] remove bogus comment; NFC

I added this comment with D42323, but as discussed in D42806, the architecture
does the right thing for denorms. We don't even need the select on 0.0 here?

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

6 years agoRemove CallGraphTraits and use equivalent methods in GraphTraits
Easwaran Raman [Thu, 1 Feb 2018 19:40:35 +0000 (19:40 +0000)]
Remove CallGraphTraits and use equivalent methods in GraphTraits

Summary:
D42698 adds child_edge_{begin|end} and children_edges to GraphTraits
which are used here. The reason for this change is to make it easy to
use count propagation on ModulesummaryIndex. As it stands,
CallGraphTraits is in Analysis while ModuleSummaryIndex is in IR.

Reviewers: davidxl, dberlin

Subscribers: llvm-commits

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

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

6 years ago[MachineCopyPropagation] Extend pass to do COPY source forwarding
Geoff Berry [Thu, 1 Feb 2018 18:54:01 +0000 (18:54 +0000)]
[MachineCopyPropagation] Extend pass to do COPY source forwarding

Summary:
This change extends MachineCopyPropagation to do COPY source forwarding
and adds an additional run of the pass to the default pass pipeline just
after register allocation.

This version of this patch uses the newly added
MachineOperand::isRenamable bit to avoid forwarding registers is such a
way as to violate constraints that aren't captured in the
Machine IR (e.g. ABI or ISA constraints).

This change is a continuation of the work started in D30751.

Reviewers: qcolombet, javed.absar, MatzeB, jonpa, tstellar

Subscribers: tpr, mgorny, mcrosier, nhaehnle, nemanjai, jyknight, hfinkel, arsenm, inouehrs, eraman, sdardis, guyblank, fedor.sergeev, aheejin, dschuff, jfb, myatsina, llvm-commits

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

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

6 years ago[GraphTraits] Add support for iterating over children edges.
Easwaran Raman [Thu, 1 Feb 2018 18:53:23 +0000 (18:53 +0000)]
[GraphTraits] Add support for iterating over children edges.

Summary:
This change is mostly adding comments to GraphTraits describing
interfaces to iterate over children edges of a node. These will
have to be implemented by specializations of GraphTraits. The
non-comment change is the addition of children_edges template
function that returns an iterator range.

The motivation for this is to use it in synthetic count propagation
algorithm and remove the CallGraphTraits class that provide similar
interfaces.

Reviewers: dberlin, davidxl

Subscribers: llvm-commits

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

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

6 years agoAMDGPU/SI: Adjust the encoding family for D16 buffer instructions when the target...
Changpeng Fang [Thu, 1 Feb 2018 18:41:33 +0000 (18:41 +0000)]
AMDGPU/SI: Adjust the encoding family for D16 buffer instructions when the target has UnpackedD16VMem feature.

Reviewers:
  Matt and Brian

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

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

6 years ago[X86][SSE] LowerBUILD_VECTORAsVariablePermute - add support for scaling index vectors
Simon Pilgrim [Thu, 1 Feb 2018 18:10:30 +0000 (18:10 +0000)]
[X86][SSE] LowerBUILD_VECTORAsVariablePermute - add support for scaling index vectors

This allows us to use PSHUFB for v8i16/v4i32 and VPERMD/PERMPS for v4i64/v4f64 variable shuffles.

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

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

6 years ago[AArch64] add tests with sqrt estimate and ieee denorms; NFC
Sanjay Patel [Thu, 1 Feb 2018 17:57:45 +0000 (17:57 +0000)]
[AArch64] add tests with sqrt estimate and ieee denorms; NFC

As noted in D42323, we're not checking for denorms as we should.

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

6 years ago[AArch64] auto-generate complete checks; NFC
Sanjay Patel [Thu, 1 Feb 2018 17:44:50 +0000 (17:44 +0000)]
[AArch64] auto-generate complete checks; NFC

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

6 years ago[X86] Remove custom lowering vXi1 extending loads and truncating stores.
Craig Topper [Thu, 1 Feb 2018 17:08:41 +0000 (17:08 +0000)]
[X86] Remove custom lowering vXi1 extending loads and truncating stores.

Summary: Now that v2i1/v4i1 are legal without VLX. And v32i1 is legalized by splitting rather than widening. And isVectorLoadExtDesirable returns false for vXi1. It appears this handling is dead because the operations simply don't exist.

Reviewers: RKSimon, zvi, guyblank, delena, spatel

Reviewed By: delena

Subscribers: llvm-commits, rengolin

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

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

6 years ago[X86] Turn X86ISD::AND nodes that have no flag users back into ISD::AND just before...
Craig Topper [Thu, 1 Feb 2018 17:08:39 +0000 (17:08 +0000)]
[X86] Turn X86ISD::AND nodes that have no flag users back into ISD::AND just before isel to enable test instruction matching

Summary:
EmitTest sometimes creates X86ISD::AND specifically to hide the AND from DAG combine. But this prevents isel patterns that look for (cmp (and X, Y), 0) from being able to see it. So we end up with an AND and a TEST. The TEST gets removed by compare instruction optimization during the peephole pass.

This patch attempts to fix this by converting X86ISD::AND with no flag users back into ISD::AND during the DAG preprocessing just before isel.

In order to do this correctly I had to make the X86ISD::AND node created by EmitTest in this case really have a flag output. Which arguably it should have had anyway so that the number of operands would be consistent for the opcode in all cases. Then I had to modify the ReplaceAllUsesWith to understand that we might be looking at an instruction with 2 outputs. Though in this case there are no uses to replace since we just created the node, but that's what the code did before so I just made it keep working.

Reviewers: spatel, RKSimon, niravd, deadalnix

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years ago[DAGCombiner] filter out denorm inputs when calculating sqrt estimate (PR34994)
Sanjay Patel [Thu, 1 Feb 2018 16:57:18 +0000 (16:57 +0000)]
[DAGCombiner] filter out denorm inputs when calculating sqrt estimate (PR34994)

As shown in the example in PR34994:
https://bugs.llvm.org/show_bug.cgi?id=34994
...we can return a very wrong answer (inf instead of 0.0) for square root when
using a reciprocal square root estimate instruction.

Here, I've conditionalized the filtering out of denorms based on the function
having "denormal-fp-math"="ieee" in its attributes. The other options for this
attribute are 'preserve-sign' and 'positive-zero'.

So we don't generate this extra code by default with just '-ffast-math' (because
then there's no denormal attribute string at all), but it works if you specify
'-ffast-math -fdenormal-fp-math=ieee' from clang.

As noted in the review, there may be other problems in clang that affect the
results depending on platform (Linux x86 at least), but this should allow
creating the desired codegen.

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

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

6 years ago[SelectionDAG] Fix UpdateChains handling of TokenFactors
Nirav Dave [Thu, 1 Feb 2018 16:11:59 +0000 (16:11 +0000)]
[SelectionDAG] Fix UpdateChains handling of TokenFactors

Summary:
In Instruction Selection UpdateChains replaces all matched Nodes'
chain references including interior token factors and deletes them.
This may allow nodes which depend on these interior nodes but are not
part of the set of matched nodes to be left with a dangling dependence.
Avoid this by doing the replacement for matched non-TokenFactor nodes.

Fixes PR36164.

Reviewers: jonpa, RKSimon, bogner

Subscribers: llvm-commits, hiraditya

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

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

6 years ago[X86][SSE] Add PR26491 horizontal add test
Simon Pilgrim [Thu, 1 Feb 2018 15:30:02 +0000 (15:30 +0000)]
[X86][SSE] Add PR26491 horizontal add test

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

6 years ago[X86][AVX512DQ] Add DQ var permute 256 tests as requested on D42487
Simon Pilgrim [Thu, 1 Feb 2018 14:44:50 +0000 (14:44 +0000)]
[X86][AVX512DQ] Add DQ var permute 256 tests as requested on D42487

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

6 years ago[ARM] FullFP16 LowerReturn Fix
Sjoerd Meijer [Thu, 1 Feb 2018 13:48:40 +0000 (13:48 +0000)]
[ARM] FullFP16 LowerReturn Fix

Commit r323512 introduced an optimisation in LowerReturn for half-precision
return values. A missing check caused a crash when the return value is "undef"
(i.e. a node that has no operands).

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

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

6 years agoRevert commit rL323951
David Green [Thu, 1 Feb 2018 13:05:25 +0000 (13:05 +0000)]
Revert commit rL323951

Looks like it's causing timeouts out on at least ppc64le
buildbots.

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

6 years ago[mips] Include EVA instructions in Std2MicroMips mapping tables
Aleksandar Beserminji [Thu, 1 Feb 2018 12:53:26 +0000 (12:53 +0000)]
[mips] Include EVA instructions in Std2MicroMips mapping tables

This patch includes EVA instructions in the Std2MicroMips mapping
tables, which is required for direct object emission.

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

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

6 years ago[AArch64][NFC] Make all ProcResource definitions include their SchedModel.
Clement Courbet [Thu, 1 Feb 2018 12:12:01 +0000 (12:12 +0000)]
[AArch64][NFC] Make all ProcResource definitions include their SchedModel.

This makes targets ExynosM1,ExynosM3,ThunderX2T99 consistent with all
other targets.

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

6 years ago[ARM] Add support for unpredictable MVN instructions.
Yvan Roux [Thu, 1 Feb 2018 12:06:57 +0000 (12:06 +0000)]
[ARM] Add support for unpredictable MVN instructions.

This fixes bugzilla 33011
https://bugs.llvm.org/show_bug.cgi?id=33011

Defines bits {19-16} as zero or unpredictable as specified by the ARM ARM in
sections A8.8.116 and A8.8.117.

It fixes also the usage of PC register as destination register for MVN
register-shifted register version as specified in A8.8.117.

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

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

6 years ago[InstCombine] Allow common type conversions to i8/i16/i32
David Green [Thu, 1 Feb 2018 11:06:18 +0000 (11:06 +0000)]
[InstCombine] Allow common type conversions to i8/i16/i32

This, in instcombine, allows conversions to i8/i16/i32 (very
common cases) even if the resulting type is not legal according
to the data layout. This can often open up extra combine
opportunities.

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

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

6 years ago[NFC] 'DWARFv5' -> 'DWARF v5'
Jonas Devlieghere [Thu, 1 Feb 2018 10:19:56 +0000 (10:19 +0000)]
[NFC] 'DWARFv5' -> 'DWARF v5'

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

6 years agoTest commit: Fix a comment.
Yvan Roux [Thu, 1 Feb 2018 08:39:58 +0000 (08:39 +0000)]
Test commit: Fix a comment.

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

6 years ago[LSR] Don't force bases of foldable formulae to the final type.
Mikael Holmen [Thu, 1 Feb 2018 06:38:34 +0000 (06:38 +0000)]
[LSR] Don't force bases of foldable formulae to the final type.

Summary:
Before emitting code for scaled registers, we prevent
SCEVExpander from hoisting any scaled addressing mode
by emitting all the bases first. However, these bases
are being forced to the final type, resulting in some
odd code.

For example, if the type of the base is an integer and
the final type is a pointer, we will emit an inttoptr
for the base, a ptrtoint for the scale, and then a
'reverse' GEP where the GEP pointer is actually the base
integer and the index is the pointer. It's more intuitive
to use the pointer as a pointer and the integer as index.

Patch by: Bevin Hansson

Reviewers: atrick, qcolombet, sanjoy

Reviewed By: qcolombet

Subscribers: llvm-commits

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

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

6 years ago[XRay][compiler-rt+llvm] Update XRay register stashing semantics
Dean Michael Berris [Thu, 1 Feb 2018 02:21:54 +0000 (02:21 +0000)]
[XRay][compiler-rt+llvm] Update XRay register stashing semantics

Summary:
This change expands the amount of registers stashed by the entry and
`__xray_CustomEvent` trampolines.

We've found that since the `__xray_CustomEvent` trampoline calls can show up in
situations where the scratch registers are being used, and since we don't
typically want to affect the code-gen around the disabled
`__xray_customevent(...)` intrinsic calls, that we need to save and restore the
state of even the scratch registers in the handling of these custom events.

Reviewers: pcc, pelikan, dblaikie, eizan, kpw, echristo, chandlerc

Reviewed By: echristo

Subscribers: chandlerc, echristo, hiraditya, davide, dblaikie, llvm-commits

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

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

6 years ago[MC] Fix assembler infinite loop on EH table using LEB padding.
Rafael Espindola [Thu, 1 Feb 2018 00:25:19 +0000 (00:25 +0000)]
[MC] Fix assembler infinite loop on EH table using LEB padding.

Fix the infinite loop reported in PR35809. It can occur with GCC-style
EH table assembly, where the compiler relies on the assembler to
calculate the offsets in the EH table.

Also see https://sourceware.org/bugzilla/show_bug.cgi?id=4029 for the
equivalent issue in the GNU assembler.

Patch by Ryan Prichard!

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

6 years ago[GlobalOpt] Improve common case efficiency of static global initializer evaluation
Amara Emerson [Wed, 31 Jan 2018 23:56:07 +0000 (23:56 +0000)]
[GlobalOpt] Improve common case efficiency of static global initializer evaluation

For very, very large global initializers which can be statically evaluated, the
code would create vectors of temporary Constants, modifying them in place,
before committing the resulting Constant aggregate to the global's initializer
value. This had effectively O(n^2) complexity in the size of the global
initializer and would cause memory and non-termination issues compiling some
workloads.

This change performs the static initializer evaluation and creation in batches,
once for each global in the evaluated IR memory. The existing code is maintained
as a last resort when the initializers are more complex than simple values in a
large aggregate. This should theoretically by NFC, no test as the example case
is massive. The existing test cases pass with this, as well as the llvm test
suite.

To give an example, consider the following C++ code adapted from the clang
regression tests:
struct S {
 int n = 10;
 int m = 2 * n;
 S(int a) : n(a) {}
};

template<typename T>
struct U {
 T *r = &q;
 T q = 42;
 U *p = this;
};

U<S> e;

The global static constructor for 'e' will need to initialize 'r' and 'p' of
the outer struct, while also initializing the inner 'q' structs 'n' and 'm'
members. This batch algorithm will simply use general CommitValueTo() method
to handle the complex nested S struct initialization of 'q', before
processing the outermost members in a single batch. Using CommitValueTo() to
handle member in the outer struct is inefficient when the struct/array is
very large as we end up creating and destroy constant arrays for each
initialization.
For the above case, we expect the following IR to be generated:

%struct.U = type { %struct.S*, %struct.S, %struct.U* }
%struct.S = type { i32, i32 }
@e = global %struct.U { %struct.S* gep inbounds (%struct.U, %struct.U* @e,
                                                 i64 0, i32 1),
                        %struct.S { i32 42, i32 84 }, %struct.U* @e }
The %struct.S { i32 42, i32 84 } inner initializer is treated as a complex
constant expression, while the other two elements of @e are "simple".

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

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

6 years agoDAG: Fix not truncating when promoting bswap/bitreverse
Matt Arsenault [Wed, 31 Jan 2018 23:54:16 +0000 (23:54 +0000)]
DAG: Fix not truncating when promoting bswap/bitreverse

These need to convert back to the original type, like any
other promotion.

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

6 years agoRevert "[ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations"
Evgeniy Stepanov [Wed, 31 Jan 2018 22:55:19 +0000 (22:55 +0000)]
Revert "[ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations"

Miscompiles code. Testcase pending.

This reverts commit r323869.

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

6 years agoUtils: Fix DomTree update for entry block
Matt Arsenault [Wed, 31 Jan 2018 22:54:37 +0000 (22:54 +0000)]
Utils: Fix DomTree update for entry block

If SplitBlockPredecessors was used on a function entry block,
it wouldn't update the dominator tree.

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

6 years agoAMDGPU: Fix missing SCC def from s_xor_b64_term
Matt Arsenault [Wed, 31 Jan 2018 22:54:27 +0000 (22:54 +0000)]
AMDGPU: Fix missing SCC def from s_xor_b64_term

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

6 years ago[AggressiveInstCombine] Fixed TruncCombine class to handle TruncInst leaf node correctly.
Amjad Aboud [Wed, 31 Jan 2018 22:39:05 +0000 (22:39 +0000)]
[AggressiveInstCombine] Fixed TruncCombine class to handle TruncInst leaf node correctly.
This covers the case where TruncInst leaf node is a constant expression.
See PR36121 for more details.

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

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

6 years ago[X86] Make the type checks in detectAVX512USatPattern more robust
Craig Topper [Wed, 31 Jan 2018 22:26:31 +0000 (22:26 +0000)]
[X86] Make the type checks in detectAVX512USatPattern more robust

This code currently uses isSimple and getSizeInBits in an attempt to prune types. But isSimple will return true for any type that any target supports natively. I don't think that's a good way to prune types. I also don't think the dest element type checks are very robust since we didn't do an isSimple check on the dest type.

This patch adds a check for the input type being legal to the one caller that didn't already check that. Then we explicitly check the element types for the destination are i8, i16, or i32

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

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

6 years ago[llvm-cov] Fix incorrect usage of .precision specifier in format() call.
Max Moroz [Wed, 31 Jan 2018 22:13:07 +0000 (22:13 +0000)]
[llvm-cov] Fix incorrect usage of .precision specifier in format() call.

Summary: Existing version doesn't work on Windows as it always prints 0.00.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: llvm-commits

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

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

6 years agoFollowup on Proposal to move MIR physical register namespace to '$' sigil.
Puyan Lotfi [Wed, 31 Jan 2018 22:04:26 +0000 (22:04 +0000)]
Followup on Proposal to move MIR physical register namespace to '$' sigil.

Discussed here:

http://lists.llvm.org/pipermail/llvm-dev/2018-January/120320.html

In preparation for adding support for named vregs we are changing the sigil for
physical registers in MIR to '$' from '%'. This will prevent name clashes of
named physical register with named vregs.

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

6 years ago[Hexagon] Rename HexagonISelLowering::getNode to getInstr, NFC
Krzysztof Parzyszek [Wed, 31 Jan 2018 21:17:03 +0000 (21:17 +0000)]
[Hexagon] Rename HexagonISelLowering::getNode to getInstr, NFC

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

6 years ago[x86] Make the retpoline thunk insertion a machine function pass.
Chandler Carruth [Wed, 31 Jan 2018 20:56:37 +0000 (20:56 +0000)]
[x86] Make the retpoline thunk insertion a machine function pass.

Summary:
This removes the need for a machine module pass using some deeply
questionable hacks. This should address PR36123 which is a case where in
full LTO the memory usage of a machine module pass actually ended up
being significant.

We should revert this on trunk as soon as we understand and fix the
memory usage issue, but we should include this in any backports of
retpolines themselves.

Reviewers: echristo, MatzeB

Subscribers: sanjoy, mcrosier, mehdi_amini, hiraditya, llvm-commits

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

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

6 years ago[Hexagon] Implement HVX codegen for vector shifts
Krzysztof Parzyszek [Wed, 31 Jan 2018 20:49:24 +0000 (20:49 +0000)]
[Hexagon] Implement HVX codegen for vector shifts

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

6 years ago[SeparateConstOffsetFromGEP] Fix up addrspace in the AMDGPU test
Marek Olsak [Wed, 31 Jan 2018 20:49:19 +0000 (20:49 +0000)]
[SeparateConstOffsetFromGEP] Fix up addrspace in the AMDGPU test

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

6 years ago[Hexagon] Handle ANY_EXTEND_VECTOR_INREG in lowering
Krzysztof Parzyszek [Wed, 31 Jan 2018 20:48:11 +0000 (20:48 +0000)]
[Hexagon] Handle ANY_EXTEND_VECTOR_INREG in lowering

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

6 years ago[Hexagon] Handle SETCC on vector pairs in lowering
Krzysztof Parzyszek [Wed, 31 Jan 2018 20:46:55 +0000 (20:46 +0000)]
[Hexagon] Handle SETCC on vector pairs in lowering

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

6 years ago[GlobalOpt] Fix exponential compile-time with selects.
Eli Friedman [Wed, 31 Jan 2018 20:42:25 +0000 (20:42 +0000)]
[GlobalOpt] Fix exponential compile-time with selects.

If you have a long chain of select instructions created from something
like `int* p = &g; if (foo()) p += 4; if (foo2()) p += 4;` etc., a naive
recursive visitor will recursively visit each select twice, which is
O(2^N) in the number of select instructions. Use the visited set to cut
off recursion in this case.

(No testcase because this doesn't actually change the behavior, just the
time.)

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

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

6 years agoAMDGPU: Fold inline offset for loads properly in moveToVALU on GFX9
Marek Olsak [Wed, 31 Jan 2018 20:18:11 +0000 (20:18 +0000)]
AMDGPU: Fold inline offset for loads properly in moveToVALU on GFX9

Summary:
This enables load merging into x2, x4, which is driven by inline offsets.

6500 shaders are affected:
Code Size in affected shaders: -15.14 %

Reviewers: arsenm, nhaehnle

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

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

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

6 years agoAMDGPU: Add intrinsics llvm.amdgcn.cvt.{pknorm.i16, pknorm.u16, pk.i16, pk.u16}
Marek Olsak [Wed, 31 Jan 2018 20:18:04 +0000 (20:18 +0000)]
AMDGPU: Add intrinsics llvm.amdgcn.cvt.{pknorm.i16, pknorm.u16, pk.i16, pk.u16}

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye

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

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

6 years ago[SeparateConstOffsetFromGEP] Preserve metadata when splitting GEPs
Marek Olsak [Wed, 31 Jan 2018 20:17:52 +0000 (20:17 +0000)]
[SeparateConstOffsetFromGEP] Preserve metadata when splitting GEPs

Summary:
!amdgpu.uniform needs to be preserved for AMDGPU, otherwise bad things
happen.

Reviewers: arsenm, nhaehnle, jingyue, broune, majnemer, bjarke.roune, dblaikie

Subscribers: wdng, tpr, llvm-commits

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

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

6 years ago[MachineOutliner] Freeze registers in new functions
Geoff Berry [Wed, 31 Jan 2018 20:15:16 +0000 (20:15 +0000)]
[MachineOutliner] Freeze registers in new functions

Summary:
Call MRI.freezeReservedRegs() on functions created during outlining so
that calls to isReserved() by the verifier called after this pass won't
assert.

Reviewers: MatzeB, qcolombet, paquette

Subscribers: mcrosier, javed.absar, llvm-commits

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

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

6 years ago[WebAssembly] MC: Remove unused code for handling of wasm globals
Sam Clegg [Wed, 31 Jan 2018 19:50:14 +0000 (19:50 +0000)]
[WebAssembly] MC: Remove unused code for handling of wasm globals

For now, we are not using wasm globals, except for modeling of
the stack points.

Alos, factor out common struct WasmGlobalType, which matches the
name for that tuple in the Wasm spec and rename methods
to "isBindingGlobal", "isTypeGlobal" to avoid ambiguity.

Patch by Nicholas Wilson!

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

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

6 years ago[WebAssembly] MC: Resolve aliases when creating provisional table entries
Sam Clegg [Wed, 31 Jan 2018 19:28:47 +0000 (19:28 +0000)]
[WebAssembly] MC: Resolve aliases when creating provisional table entries

This change is useful for the upcoming addition of the symbol
table (D41954) since in that world aliases for given function
all share the same function index.

This change does not effect lld because it essentially ignores
the wasm "table".  The table exists only to the wasm objects
will validate and disassembly meaningfully.

Patch by Nicholas Wilson!

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

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

6 years ago[X86] Generate testl instruction through truncates.
Amaury Sechet [Wed, 31 Jan 2018 19:20:06 +0000 (19:20 +0000)]
[X86] Generate testl instruction through truncates.

Summary:
This was introduced in D42646 but ended up being reverted because the original implementation was buggy.

Depends on D42646

Reviewers: craig.topper, niravd, spatel, hfinkel

Subscribers: llvm-commits

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

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

6 years ago[Analysis] Disable calls to *_finite and other glibc-only functions on Android.
Chih-Hung Hsieh [Wed, 31 Jan 2018 19:12:50 +0000 (19:12 +0000)]
[Analysis] Disable calls to *_finite and other glibc-only functions on Android.

Since r322087, glibc's finite lib calls are generated when possible.
However, they are not supported on Android. This change also
disables other functions not available on Android.

Differential Revision: http://reviews.llvm.org/D42668

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

6 years ago[llvm-cov] Improvements for summary report generated in HTML format.
Max Moroz [Wed, 31 Jan 2018 17:37:21 +0000 (17:37 +0000)]
[llvm-cov] Improvements for summary report generated in HTML format.

Summary:
This commit adds the following changes:

1) coverage numbers are aligned to the left and padded with spaces in order to
provide better readability for percentage values, e.g.:

```
file1     |  89.13% (123 / 2323)    | 100.00% (55 / 55)    |   9.33% (14545 / 234234)
file_asda |   1.78% ( 23 / 4323)    |  32.31% (555 / 6555) |  67.89% (1545 / 2234)
fileXXX   | 100.00% (12323 / 12323) | 100.00% (555 / 555)  | 100.00% (12345 / 12345)
```

2) added "hover" attribute to CSS for highlighting table row under mouse cursor
see screenshot attached to the phabricator review page

{F5764813}

3) table title row and "totals" row now use bold text

Reviewers: vsk, morehouse

Reviewed By: vsk

Subscribers: kcc, llvm-commits

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

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

6 years ago[CodeGenPrepare] Improve source and dest alignments of memory intrinsics independently
Daniel Neilson [Wed, 31 Jan 2018 17:24:53 +0000 (17:24 +0000)]
[CodeGenPrepare] Improve source and dest alignments of memory intrinsics independently

Summary:
  This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
CodeGenPrepare pass to be more aggressive in improving the source and destination alignments
of memcpy/memmove/memset by exploiting our new ability to record independent alignments
for each argument.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

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

6 years ago[Hexagon] Handle BUILD_VECTOR from undef values in buildHvxVectorReg
Krzysztof Parzyszek [Wed, 31 Jan 2018 16:52:15 +0000 (16:52 +0000)]
[Hexagon] Handle BUILD_VECTOR from undef values in buildHvxVectorReg

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

6 years ago[X86] Avoid using high register trick for test instruction
Amaury Sechet [Wed, 31 Jan 2018 16:48:54 +0000 (16:48 +0000)]
[X86] Avoid using high register trick for test instruction

Summary:
It seems it's main effect is to create addition copies when values are inr register that do not support this trick, which increase register pressure and makes the code bigger.

Reviewers: craig.topper, niravd, spatel, hfinkel

Subscribers: llvm-commits

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

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

6 years ago[Hexagon] Only process bitcasts of vsplats when selecting const vectors
Krzysztof Parzyszek [Wed, 31 Jan 2018 16:48:20 +0000 (16:48 +0000)]
[Hexagon] Only process bitcasts of vsplats when selecting const vectors

Selecting of constant HVX vectors involves some "manual processing",
which mishandled an unrelated BITCAST operation causing a selection
error.

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

6 years ago[Lint] Upgrade uses of MemoryIntrinic::getAlignment() to new API. (NFCI)
Daniel Neilson [Wed, 31 Jan 2018 16:42:15 +0000 (16:42 +0000)]
[Lint] Upgrade uses of MemoryIntrinic::getAlignment() to new API. (NFCI)

Summary:
  This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the Lint
analysis to cease using the old getAlignment() API of MemoryIntrinsic in favour of getting
source & dest specific alignments through the new API.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead.
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

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

6 years ago[DWARF] Allow duplication of tails with CFI instructions
Petar Jovanovic [Wed, 31 Jan 2018 15:57:57 +0000 (15:57 +0000)]
[DWARF] Allow duplication of tails with CFI instructions

This commit came as a result for revert of patch r317579 (originally
committed as r317100). The patch made CFI instructions duplicable, because
their existence in the epilogue block was affecting the Tail duplication
pass. However, duplicating blocks with CFI instructions was an issue for
compact unwind info on Darwin, which is why the patch was reverted.

This patch allows duplicating tails with CFI instructions, though they are
not duplicable, by copying them 'manually'.

Patch by Djordje Kovacevic.

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

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

6 years ago[InstCombine] move related tests into the same file; NFC
Sanjay Patel [Wed, 31 Jan 2018 15:47:59 +0000 (15:47 +0000)]
[InstCombine] move related tests into the same file; NFC

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

6 years ago[InstCombine] add tests to show limit of canEvaluate* ; NFC
Sanjay Patel [Wed, 31 Jan 2018 15:28:39 +0000 (15:28 +0000)]
[InstCombine] add tests to show limit of canEvaluate* ; NFC

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

6 years ago[DAG] Prevent NodeId pruning of TokenFactors in Instruction Selection.
Nirav Dave [Wed, 31 Jan 2018 15:23:17 +0000 (15:23 +0000)]
[DAG] Prevent NodeId pruning of TokenFactors in Instruction Selection.

Summary:
Instruction Selection preserves relative orders of all nodes save
TokenFactors which we treat specially. As a result Node Ids for
TokenFactors may violate the topological ordering and should not be
considered as valid pruning candidates in predecessor search.

Fixes PR35316.

Reviewers: RKSimon, hfinkel

Subscribers: hiraditya, llvm-commits

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

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

6 years agoFix formatting for r323876. NFC
Diana Picus [Wed, 31 Jan 2018 15:16:17 +0000 (15:16 +0000)]
Fix formatting for r323876. NFC

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

6 years ago[InstCombine] reduce code duplication for canEvaluate* functions; NFCI
Sanjay Patel [Wed, 31 Jan 2018 14:55:53 +0000 (14:55 +0000)]
[InstCombine] reduce code duplication for canEvaluate* functions; NFCI

We'd have to make the change suggested in D42536 3x otherwise.

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

6 years ago[ARM GlobalISel] Modernize LegalizerInfo. NFCI
Diana Picus [Wed, 31 Jan 2018 14:55:07 +0000 (14:55 +0000)]
[ARM GlobalISel] Modernize LegalizerInfo. NFCI

Start using the new LegalizerInfo API introduced in r323681.

Keep the old API for opcodes that need Lowering in some circumstances
(G_FNEG and G_UREM/G_SREM).

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

6 years agoFix build error in r323870
Marina Yatsina [Wed, 31 Jan 2018 14:18:37 +0000 (14:18 +0000)]
Fix build error in r323870

Change-Id: I15a8b27764a4d817cfbe48836bf09dc6520934b7

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

6 years ago[MachineCombiner] Add check for optimal pattern order.
Florian Hahn [Wed, 31 Jan 2018 13:54:30 +0000 (13:54 +0000)]
[MachineCombiner] Add check for optimal pattern order.

In D41587, @mssimpso discovered that the order of some patterns for
AArch64 was sub-optimal. I thought a bit about how we could avoid that
case in the future. I do not think there is a need for evaluating all
patterns for now. But this patch adds an extra (expensive) check, that
evaluates the latencies of all patterns, and ensures that the latency
saved decreases for subsequent patterns.

This catches the sub-optimal order fixed in D41587, but I am not
entirely happy with the check, as it only applies to sub-optimal
patterns seen while building with EXPENSIVE_CHECKS on. It did not
discover any other sub-optimal pattern ordering.

Reviewers: Gerolf, spatel, mssimpso

Reviewed By: Gerolf, mssimpso

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

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

6 years agoTake into account the cost of local intervals when selecting split candidate.
Marina Yatsina [Wed, 31 Jan 2018 13:31:08 +0000 (13:31 +0000)]
Take into account the cost of local intervals when selecting split candidate.

When selecting a split candidate for region splitting, the register allocator tries to predict which candidate will have the cheapest spill cost.
Global splitting may cause the creation of local intervals, and they might spill.

This patch makes RA take into account the spill cost of local split intervals in use blocks (we already take into account the spill cost in through blocks).
A flag ("-condsider-local-interval-cost") controls weather we do this advanced cost calculation (it's on by default for X86 target, off for the rest).

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

Change-Id: Icccb8ad2dbf13124f5d97a18c67d95aa6be0d14d

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

6 years ago[ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations
Pablo Barrio [Wed, 31 Jan 2018 13:20:10 +0000 (13:20 +0000)]
[ARM] Lower lower saturate to 0 and lower saturate to -1 using bit-operations

Summary:
Expressions of the form x < 0 ? 0 :  x; and x < -1 ? -1 : x can be lowered using bit-operations instead of branching or conditional moves

In thumb-mode this results in a two-instruction sequence, a shift followed by a bic or or while in ARM/thumb2 mode that has flexible second operand the shift can be folded into a single bic/or instructions. In most cases this results in smaller code and possibly less branches, and in no case larger than before.

Patch by Marten Svanfeldt.

Reviewers: fhahn, pbarrio

Reviewed By: pbarrio

Subscribers: efriedma, rogfer01, aemerson, javed.absar, kristof.beyls, llvm-commits

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

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

6 years agoAdd a regression test for problems caused by D42646 . NFC
Amaury Sechet [Wed, 31 Jan 2018 13:02:01 +0000 (13:02 +0000)]
Add a regression test for problems caused by D42646 . NFC

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

6 years ago[SystemZ] Check the bitwidth before calling isInt/isUInt.
Jonas Paulsson [Wed, 31 Jan 2018 12:41:25 +0000 (12:41 +0000)]
[SystemZ] Check the bitwidth before calling isInt/isUInt.

Since these methods will assert if the integer does not fit into 64 bits,
it is necessary to do this check before calling them in
supportedAddressingMode().

Review: Ulrich Weigand.

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

6 years ago[AggressiveInstCombine] Make TruncCombine class ignore unreachable basic blocks.
Amjad Aboud [Wed, 31 Jan 2018 10:41:31 +0000 (10:41 +0000)]
[AggressiveInstCombine] Make TruncCombine class ignore unreachable basic blocks.
Because dead code may contain non-standard IR that causes infinite looping or crashes in underlying analysis.
See PR36134 for more details.

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

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

6 years ago[ARM] Armv8.2-A FP16 code generation (part 2/3)
Sjoerd Meijer [Wed, 31 Jan 2018 10:18:29 +0000 (10:18 +0000)]
[ARM] Armv8.2-A FP16 code generation (part 2/3)

Half-precision arguments and return values are passed as if it were an int or
float for ARM. This results in truncates and bitcasts to/from i16 and f16
values, which are legalized very early to stack stores/loads. When FullFP16 is
enabled, we want to avoid codegen for these bitcasts as it is unnecessary and
inefficient.

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

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

6 years ago[PowerPC] Return true in enableMultipleCopyHints().
Jonas Paulsson [Wed, 31 Jan 2018 09:26:51 +0000 (09:26 +0000)]
[PowerPC]  Return true in enableMultipleCopyHints().

Enable multiple COPY hints to eliminate more COPYs during register allocation.

Note that this is something all targets should do, see
https://reviews.llvm.org/D38128.

Review: Nemanja Ivanovic

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

6 years ago[ARM] Allow the scheduler to clone a node with glue to avoid a copy CPSR ↔ GPR.
Roger Ferrer Ibanez [Wed, 31 Jan 2018 09:23:43 +0000 (09:23 +0000)]
[ARM] Allow the scheduler to clone a node with glue to avoid a copy CPSR ↔ GPR.

In Thumb 1, with the new ADDCARRY / SUBCARRY the scheduler may need to do
copies CPSR ↔ GPR but not all Thumb1 targets implement them.

The schedule can attempt, before attempting a copy, to clone the instructions
but it does not currently do that for nodes with input glue. In this patch we
introduce a target-hook to let the hook decide if a glued machinenode is still
eligible for copying. In this case these are ARM::tADCS and ARM::tSBCS .

As a follow-up of this change we should actually implement the copies for the
Thumb1 targets that do implement them and restrict the hook to the targets that
can't really do such copy as these clones are not ideal.

This change fixes PR35836.

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

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

6 years agoMark two tests REQUIRES: x86-registered-backend
Justin Bogner [Wed, 31 Jan 2018 07:32:03 +0000 (07:32 +0000)]
Mark two tests REQUIRES: x86-registered-backend

These were introduced in r323783 and use an X86 triple. I'll follow up
on the list to check if it would make more sense to remove the triple
and mark them REQUIRES: default_triple instead.

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

6 years ago[WebAssembly] Remove some unused code and tidy logging. NFC.
Sam Clegg [Wed, 31 Jan 2018 04:21:44 +0000 (04:21 +0000)]
[WebAssembly] Remove some unused code and tidy logging. NFC.

Patch by Nicholas Wilson!

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

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

6 years agoLTO: Drop comdats when converting definitions to declarations.
Peter Collingbourne [Wed, 31 Jan 2018 02:51:03 +0000 (02:51 +0000)]
LTO: Drop comdats when converting definitions to declarations.

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

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

6 years agoRevert r323559 due to EXPENSIVE_CHECKS regression.
Eli Friedman [Wed, 31 Jan 2018 00:40:42 +0000 (00:40 +0000)]
Revert r323559 due to EXPENSIVE_CHECKS regression.

I have a fix for the issue (https://reviews.llvm.org/D42655) but
it's taking a while to get reviewed, so reverting in the meantime.

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

6 years ago[X86] Add more madd reduction tests with wider vectors.
Craig Topper [Wed, 31 Jan 2018 00:30:32 +0000 (00:30 +0000)]
[X86] Add more madd reduction tests with wider vectors.

We had no test case exercising 512-bit vpmaddwd usage.

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

6 years agodocs: wordsmith some of the linker option extension
Saleem Abdulrasool [Wed, 31 Jan 2018 00:16:23 +0000 (00:16 +0000)]
docs: wordsmith some of the linker option extension

Apply the grammatical improvements suggested by Rafael Avila de
Espindola in post-commit review.

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

6 years agollvm-nm should show a symbol type of T for symbols in the (__TEXT_EXEC,__text) section.
Kevin Enderby [Wed, 31 Jan 2018 00:00:41 +0000 (00:00 +0000)]
llvm-nm should show a symbol type of T for symbols in the (__TEXT_EXEC,__text) section.

When a the Apple link editor builds a kext bundle file type and the
value of the -miphoneos-version-min argument is significantly current
(like 11.0) then the (__TEXT,__text) section is changed to the
(__TEXT_EXEC,__text) section.  So it would be nice for llvm-nm to
show symbols in that section with a type of T instead of the generic
type of S for some section other than text, data, etc.

rdar://36262205

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

6 years ago[AMDGPU] Update relocation documentation and elf flag machine architecture numbers
Tony Tye [Tue, 30 Jan 2018 23:59:43 +0000 (23:59 +0000)]
[AMDGPU] Update relocation documentation and elf flag machine architecture numbers

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

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

6 years agoRename path libpath in .linker-options.
Rui Ueyama [Tue, 30 Jan 2018 23:49:27 +0000 (23:49 +0000)]
Rename path libpath in .linker-options.

"path" is too generic name for -L or --library-path because a lot of
linker options take paths as arguments. This change renames the option
to avoid confusion.

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

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

6 years ago[RDF] Clear the renamable flag when copy propagating reserved registers
Krzysztof Parzyszek [Tue, 30 Jan 2018 23:19:44 +0000 (23:19 +0000)]
[RDF] Clear the renamable flag when copy propagating reserved registers

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