OSDN Git Service

android-x86/external-llvm.git
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

6 years ago[AMDGPU] Clarify ReqdWorkGroupSize and MaxFlatWorkGroupSize metadata
Tony Tye [Tue, 30 Jan 2018 23:07:10 +0000 (23:07 +0000)]
[AMDGPU] Clarify ReqdWorkGroupSize and MaxFlatWorkGroupSize metadata

- If ReqdWorkGroupSize is present it must have all elements >=1.
- If MaxFlatWorkGroupSize must be consistent with ReqdWorkGroupSize.
- Remove FixedWorkGroupSize as now equivalent to ReqdWorkGroupSize.

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

6 years agoLLParser: add an argument for overriding data layout and do not check alloca addr...
Yaxun Liu [Tue, 30 Jan 2018 22:32:39 +0000 (22:32 +0000)]
LLParser: add an argument for overriding data layout and do not check alloca addr space

Sometimes users do not specify data layout in LLVM assembly and let llc set the
data layout by target triple after loading the LLVM assembly.

Currently the parser checks alloca address space no matter whether the LLVM
assembly contains data layout definition, which causes false alarm since the
default data layout does not contain the correct alloca address space.

The parser also calls verifier to check debug info and updating invalid debug
info. Currently there is no way to let the verifier to check debug info only.
If the verifier finds non-debug-info issues the parser will fail.

For llc, the fix is to remove the check of alloca addr space in the parser and
disable updating debug info, and defer the updating of debug info and
verification to be after setting data layout of the IR by target.

For other llvm tools, since they do not override data layout by target but
instead can override data layout by a command line option, an argument for
overriding data layout is added to the parser. In cases where data layout
overriding is necessary for the parser, the data layout can be provided by
command line.

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

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

6 years ago[Hexagon] Handle truncates in polynomial multiply idiom recognition
Krzysztof Parzyszek [Tue, 30 Jan 2018 22:03:59 +0000 (22:03 +0000)]
[Hexagon] Handle truncates in polynomial multiply idiom recognition

This is in anticipation of https://reviews.llvm.org/D42424, which would
otherwise break one of the pmpy testcases.

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

6 years ago[X86] Remove redundant check for hasAVX512 before calling hasBWI. NFC
Craig Topper [Tue, 30 Jan 2018 21:53:35 +0000 (21:53 +0000)]
[X86] Remove redundant check for hasAVX512 before calling hasBWI. NFC

hasBWI implies hasAVX512.

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

6 years agoTurn two static functions into methods, to simplify calling them.
Paul Robinson [Tue, 30 Jan 2018 21:39:28 +0000 (21:39 +0000)]
Turn two static functions into methods, to simplify calling them.

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

6 years ago[LLVM-C] Add Accessors For A Module's Source File Name
Robert Widmann [Tue, 30 Jan 2018 21:34:29 +0000 (21:34 +0000)]
[LLVM-C] Add Accessors For A Module's Source File Name

Summary: Also unblocks some cleanup in the echo-test.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: harlanhaskins, llvm-commits

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

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

6 years ago[ThinLTO/gold] Write empty imports even for modules with symbols
Vitaly Buka [Tue, 30 Jan 2018 21:19:26 +0000 (21:19 +0000)]
[ThinLTO/gold] Write empty imports even for modules with symbols

Summary: ThinLTO may skip object for other reasons, e.g. if there is no summary.

Reviewers: pcc, eugenis

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

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

6 years ago[AArch64] Expand testing of zero cycle zeroing
Evandro Menezes [Tue, 30 Jan 2018 21:14:11 +0000 (21:14 +0000)]
[AArch64] Expand testing of zero cycle zeroing

Make sure that r321824 doesn't change zeroing.

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

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

6 years ago[SLP] Add extra test for extractelement shuffle, NFC.
Alexey Bataev [Tue, 30 Jan 2018 21:06:06 +0000 (21:06 +0000)]
[SLP] Add extra test for extractelement shuffle, NFC.

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

6 years agoTeach ValueMapper to use ODR uniqued types when available
Teresa Johnson [Tue, 30 Jan 2018 20:16:32 +0000 (20:16 +0000)]
Teach ValueMapper to use ODR uniqued types when available

Summary:
This is exposed during ThinLTO compilation, when we import an alias by
creating a clone of the aliasee. Without this fix the debug type is
unnecessarily cloned and we get a duplicate, undoing the uniquing.

Fixes PR36089.

Reviewers: mehdi_amini, pcc

Subscribers: eraman, JDevlieghere, llvm-commits

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

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

6 years ago[dsymutil] Enable -minimize feature.
Jonas Devlieghere [Tue, 30 Jan 2018 19:54:16 +0000 (19:54 +0000)]
[dsymutil] Enable -minimize feature.

Passing -minimize to dsymutil prevents the emission of .debug_inlines,
.debug_pubnames, and .debug_pubtypes in favor of the Apple accelerator
tables.

The actual check in the DWARF linker was added in r323655. This patch
simply enables it.

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

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

6 years ago[GlobalISel] Bail out on calls to dllimported functions
Martin Storsjo [Tue, 30 Jan 2018 19:50:58 +0000 (19:50 +0000)]
[GlobalISel] Bail out on calls to dllimported functions

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

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

6 years ago[AArch64] Properly handle dllimport of variables when using fast-isel
Martin Storsjo [Tue, 30 Jan 2018 19:50:51 +0000 (19:50 +0000)]
[AArch64] Properly handle dllimport of variables when using fast-isel

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

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

6 years ago[TableGen] Make sure !if is evaluated throughout class inheritance.
Artem Belevich [Tue, 30 Jan 2018 19:29:21 +0000 (19:29 +0000)]
[TableGen] Make sure !if is evaluated throughout class inheritance.

Without the patch !if() is only evaluated if it's used directly.
If it's passed through more than one level of class inheritance,
we end up with a reference to an anonymous record with unresolved
references to the original arguments !if may have used.

The root cause of the problem is that TernOpInit::isComplete()
was always returning false and that prevented use of the folded
value of !if() as an initializer for the record at the next level
of inheritance.

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

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

6 years ago[LoopStrengthReduce] add test to show potential macro-fusion-based diff (PR35681...
Sanjay Patel [Tue, 30 Jan 2018 19:17:38 +0000 (19:17 +0000)]
[LoopStrengthReduce] add test to show potential macro-fusion-based diff (PR35681); NFC

This is the baseline output for the test proposed with D42607.

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

6 years ago[DWARF] Recommitting a test that was removed with r323564. Restricted to x86 linux...
Wolfgang Pieb [Tue, 30 Jan 2018 18:41:31 +0000 (18:41 +0000)]
[DWARF] Recommitting a test that was removed with r323564. Restricted to x86 linux target.

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

6 years ago[XRay] fix 99th percentile lookups by sorting the array correctly
Martin Pelikan [Tue, 30 Jan 2018 18:18:51 +0000 (18:18 +0000)]
[XRay] fix 99th percentile lookups by sorting the array correctly

Summary:
It was a copy-paste typo, sorting only to the 90th percentile twice.
Now, it only sorts the array prefix once, and extracts what we need.

Reviewers: dberris, kpw, eizan

Subscribers: llvm-commits

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

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

6 years ago[Hexagon] Handle non-aligned offsets in globals in extender optimization
Krzysztof Parzyszek [Tue, 30 Jan 2018 18:12:37 +0000 (18:12 +0000)]
[Hexagon] Handle non-aligned offsets in globals in extender optimization

Instructions like memd(r0+##global+1) are legal as long as the entire
address is properly aligned. Assuming that "global" is aligned at an
8-byte boundary, the expression "global+1" appears to be misaligned.
Handle such cases in HexagonConstExtenders, and make sure that any non-
extended offsets generated are still aligned accordingly.

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

6 years agoRevert: [Hexagon] Make sure that offset on globals matches alignment requirements
Krzysztof Parzyszek [Tue, 30 Jan 2018 18:10:27 +0000 (18:10 +0000)]
Revert: [Hexagon] Make sure that offset on globals matches alignment requirements

This reverts r323562, since it wasn't actually necessary. Constant-
extended offsets do not need to be aligned, as long as the effective
address is aligned.

Keep the testcase, with a modification which checks that such offsets
are not unnecessarily avoided.

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

6 years ago[X86][XOP] Update isVectorShiftByScalarCheap with cases covered by XOP
Simon Pilgrim [Tue, 30 Jan 2018 18:10:21 +0000 (18:10 +0000)]
[X86][XOP] Update isVectorShiftByScalarCheap with cases covered by XOP

Similar to D42437, XOP supports variable shift for v16i8/v8i16/v4i32/v2i64 types.

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

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

6 years ago[AMDGPU] isRenamable fixes to support copy forwarding
Geoff Berry [Tue, 30 Jan 2018 17:37:39 +0000 (17:37 +0000)]
[AMDGPU] isRenamable fixes to support copy forwarding

Mark more opcodes as hasExtraSrcRegAllocReq so that their operands will
be marked as not renamable, to avoid copy forwarding violating the
constraint that only one operand may use the constant bus.

These changes fix a few mis-compiles when copy forwarding is enabled in
MachineCopyPropagation by D41835 (and were reviewed as part of that change).

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