OSDN Git Service

android-x86/external-llvm.git
6 years agoUpdate the Go bindings for r309426 (remove offset from llvm.dbg.value)
Adrian Prantl [Fri, 28 Jul 2017 22:44:44 +0000 (22:44 +0000)]
Update the Go bindings for r309426 (remove offset from llvm.dbg.value)

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

6 years agoAdded tests for i8 interleaved-load-pattern of stride=4, VF=(8, 16, 32).
Farhana Aleen [Fri, 28 Jul 2017 22:43:34 +0000 (22:43 +0000)]
Added tests for i8 interleaved-load-pattern of stride=4, VF=(8, 16, 32).

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

6 years agoRemove the unused DBG_VALUE offset parameter from RegAllocFast (NFC)
Adrian Prantl [Fri, 28 Jul 2017 22:36:55 +0000 (22:36 +0000)]
Remove the unused DBG_VALUE offset parameter from RegAllocFast (NFC)

Followup to r309426.
rdar://problem/33580047

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

6 years agoAdd documentation for the attribute "no-jump-tables"
Sumanth Gundapaneni [Fri, 28 Jul 2017 22:26:22 +0000 (22:26 +0000)]
Add documentation for the attribute "no-jump-tables"

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

6 years ago[SimplifyCFG] Make the no-jump-tables attribute also disable switch lookup tables
Sumanth Gundapaneni [Fri, 28 Jul 2017 22:25:40 +0000 (22:25 +0000)]
[SimplifyCFG] Make the no-jump-tables attribute also disable switch lookup tables

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

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

6 years ago[libFuzzer] improve support for inline-8bit-counters (make it more correct and faster)
Kostya Serebryany [Fri, 28 Jul 2017 22:00:56 +0000 (22:00 +0000)]
[libFuzzer] improve support for inline-8bit-counters (make it more correct and faster)

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

6 years ago[Hexagon] Formatting changes, NFC
Krzysztof Parzyszek [Fri, 28 Jul 2017 21:52:21 +0000 (21:52 +0000)]
[Hexagon] Formatting changes, NFC

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

6 years ago[Inliner] Do not apply any bonus for cold callsites.
Easwaran Raman [Fri, 28 Jul 2017 21:47:36 +0000 (21:47 +0000)]
[Inliner] Do not apply any bonus for cold callsites.

Summary:
Inlining threshold is increased by application of bonuses when the
callee has a single reachable basic block or is rich in vector
instructions. Similarly, inlining cost is reduced by applying a large
bonus when the last call to a static function is considered for
inlining. This patch disables the application of these bonuses when the
callsite or the callee is cold. The intention here is to prevent a large
cold callsite from being inlined to a non-cold caller that could prevent
the caller from being inlined. This is especially important when the
cold callsite is a last call to a static since the associated bonus is
very high.

Reviewers: chandlerc, davidxl

Subscribers: danielcdh, llvm-commits

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

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

6 years agoRemove the unused dbg.value offset from SelectionDAG (NFC)
Adrian Prantl [Fri, 28 Jul 2017 21:27:35 +0000 (21:27 +0000)]
Remove the unused dbg.value offset from SelectionDAG (NFC)

Followup to r309426.
rdar://problem/33580047

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

6 years ago[lit] Use a %{python} substitution to avoid relying on python being on PATH
Reid Kleckner [Fri, 28 Jul 2017 21:13:47 +0000 (21:13 +0000)]
[lit] Use a %{python} substitution to avoid relying on python being on PATH

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

6 years ago[lit] Remove stale test inputs before running check-lit
Reid Kleckner [Fri, 28 Jul 2017 21:00:57 +0000 (21:00 +0000)]
[lit] Remove stale test inputs before running check-lit

This should fix googletest-format test failures on the clang modules
buildbots, which have a stale copy of the OneTest script in the build
directory.

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

6 years agoReword sentence in LangRef
Adrian Prantl [Fri, 28 Jul 2017 20:44:29 +0000 (20:44 +0000)]
Reword sentence in LangRef

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

6 years agoRemove the obsolete offset parameter from @llvm.dbg.value
Adrian Prantl [Fri, 28 Jul 2017 20:21:02 +0000 (20:21 +0000)]
Remove the obsolete offset parameter from @llvm.dbg.value

There is no situation where this rarely-used argument cannot be
substituted with a DIExpression and removing it allows us to simplify
the DWARF backend. Note that this patch does not yet remove any of
the newly dead code.

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

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

6 years ago[SLP] Allow vectorization of the instruction from the same basic blocks only, NFC.
Alexey Bataev [Fri, 28 Jul 2017 20:11:16 +0000 (20:11 +0000)]
[SLP] Allow vectorization of the instruction from the same basic blocks only, NFC.

Summary:
After some changes in SLP vectorizer we missed some additional checks to
limit the instructions for vectorization. We should not perform analysis
of the instructions if the parent of instruction is not the same as the
parent of the first instruction in the tree or it was analyzed already.

Subscribers: mzolotukhin

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

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

6 years agoFix conditional tail call branch folding when both edges are the same
Reid Kleckner [Fri, 28 Jul 2017 19:48:40 +0000 (19:48 +0000)]
Fix conditional tail call branch folding when both edges are the same

The conditional tail call logic did the wrong thing when both
destinations of a conditional branch were the same:

BB#1: derived from LLVM BB %entry
    Live Ins: %EFLAGS
    Predecessors according to CFG: BB#0
        JE_1 <BB#5>, %EFLAGS<imp-use,kill>
        JMP_1 <BB#5>

BB#5: derived from LLVM BB %sw.epilog
    Predecessors according to CFG: BB#1
        TCRETURNdi64 <ga:@mergeable_conditional_tailcall>, 0, ...

We would fold the JE_1 to a TCRETURNdi64cc, and then remove our BB#5
successor. Then BB#5 would be deleted as it had no predecessors, leaving
a dangling "JMP_1 <BB#5>" reference behind to cause assertions later.

This patch checks that both conditional branch destinations are
different before doing the transform. The standard branch folding logic
is able to remove both the JMP_1 and the JE_1, and for my test case we
end up forming a better conditional tail call later.

Fixes PR33980

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

6 years agoAMDGPU: Look through a bitcast user of an out argument
Matt Arsenault [Fri, 28 Jul 2017 19:06:16 +0000 (19:06 +0000)]
AMDGPU: Look through a bitcast user of an out argument

This allows handling of a lot more of the interesting
cases in Blender. Most of the large functions unlikely
to be inlined have this pattern.

This is a special case for what clang emits for OpenCL 3
element vectors. Annoyingly, these are emitted as
<3 x elt>* pointers, but accessed as <4 x elt>* operations.
This also needs to handle cases where a struct containing
a single vector is used.

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

6 years ago[Value Tracking] Refactor icmp comparison logic into helper. NFC.
Chad Rosier [Fri, 28 Jul 2017 18:47:43 +0000 (18:47 +0000)]
[Value Tracking] Refactor icmp comparison logic into helper. NFC.

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

6 years agoAMDGPU: Add pass to replace out arguments
Matt Arsenault [Fri, 28 Jul 2017 18:40:05 +0000 (18:40 +0000)]
AMDGPU: Add pass to replace out arguments

It is better to return arguments directly in registers
if we are making a call rather than introducing expensive
stack usage. In one of sample compile from one of
Blender's many kernel variants, this fires on about
~20 different functions. Future improvements may be to
recognize simple cases where the pointer is indexing a small
array. This also fails when the store to the out argument
is in a separate block from the return, which happens in
a few of the Blender functions. This should also probably
be using MemorySSA which might help with that.

I'm not sure this is correct as a FunctionPass, but
MemoryDependenceAnalysis seems to not work with
a ModulePass.

I'm also not sure where it should run.I think it should
run  before DeadArgumentElimination, so maybe either
EP_CGSCCOptimizerLate or EP_ScalarOptimizerLate.

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

6 years ago[LVI] Constant-propagate a zero extension of the switch condition value through case...
Hiroshi Yamauchi [Fri, 28 Jul 2017 18:35:25 +0000 (18:35 +0000)]
[LVI] Constant-propagate a zero extension of the switch condition value through case edges

Summary:
LazyValueInfo currently computes the constant value of the switch condition through case edges, which allows the constant value to be propagated through the case edges.

But we have seen a case where a zero-extended value of the switch condition is used past case edges for which the constant propagation doesn't occur.

This patch adds a small logic to handle such a case in getEdgeValueLocal().

This is motivated by the Python 2.7 eval loop in PyEval_EvalFrameEx() where the lack of the constant propagation causes longer live ranges and more spill code than necessary.

With this patch, we see that the code size of PyEval_EvalFrameEx() decreases by ~5.4% and a performance test improves by ~4.6%.

Reviewers: wmi, dberlin, sanjoy

Reviewed By: sanjoy

Subscribers: davide, davidxl, llvm-commits

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

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

6 years agoGlobalISel: map 128-bit values to an FPR by default.
Tim Northover [Fri, 28 Jul 2017 17:11:01 +0000 (17:11 +0000)]
GlobalISel: map 128-bit values to an FPR by default.

Eventually we may want to allow a pair of GPRs but absolutely nothing in the
entire world is ready for that yet.

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

6 years ago[lit] Dump some FileCheck inputs to try to debug some failing tests
Reid Kleckner [Fri, 28 Jul 2017 16:24:18 +0000 (16:24 +0000)]
[lit] Dump some FileCheck inputs to try to debug some failing tests

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

6 years ago[lit] Fix shtest-format external_shell failures
Reid Kleckner [Fri, 28 Jul 2017 16:13:02 +0000 (16:13 +0000)]
[lit] Fix shtest-format external_shell failures

When using win32 cmd.exe, turn off command echoing at the beginning of
the script (@echo off).

Replace a bash shell script with a python script for the
fail_with_bad_encoding test.

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

6 years agoAMDGPU: Annotate implicitarg.ptr usage
Matt Arsenault [Fri, 28 Jul 2017 15:52:08 +0000 (15:52 +0000)]
AMDGPU: Annotate implicitarg.ptr usage

We need to pass something to functions for this to work.
It isn't derivable just from the kernarg segment pointer
because the implicit arguments are placed after the
kernel arguments.

Also fixes missing test for the intrinsic.

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

6 years ago[GVN] Recommit the patch "Add phi-translate support in scalarpre"
Wei Mi [Fri, 28 Jul 2017 15:47:25 +0000 (15:47 +0000)]
[GVN] Recommit the patch "Add phi-translate support in scalarpre"

Recommit after workaround the bug PR31652.

Three bugs fixed in previous recommits: The first one is to use CurrentBlock
instead of PREInstr's Parent as param of performScalarPREInsertion because
the Parent of a clone instruction may be uninitialized. The second one is stop
PRE when CurrentBlock to its predecessor is a backedge and an operand of CurInst
is defined inside of CurrentBlock. The same value defined inside of loop in last
iteration can not be regarded as available. The third one is an out-of-bound
array access in a flipped if guard.

Right now scalarpre doesn't have phi-translate support, so it will miss some
simple pre opportunities. Like the following testcase, current scalarpre cannot
recognize the last "a * b" is fully redundent because a and b used by the last
"a * b" expr are both defined by phis.

long a[100], b[100], g1, g2, g3;
__attribute__((pure)) long goo();

void foo(long a, long b, long c, long d) {

  g1 = a * b;
  if (__builtin_expect(g2 > 3, 0)) {
    a = c;
    b = d;
    g2 = a * b;
  }
  g3 = a * b;      // fully redundant.

}

The patch adds phi-translate support in scalarpre. This is only a temporary
solution before the newpre based on newgvn is available.

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

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

6 years ago[CMake] NFC. Add intrinsics_gen target to CMake Exports
Chris Bieneman [Fri, 28 Jul 2017 15:33:35 +0000 (15:33 +0000)]
[CMake]  NFC. Add intrinsics_gen target to CMake Exports

By creating a dummy of this target in LLVMConfig.cmake, projects that can build against out-of-tree LLVM can freely depend on the target without needing to have conditionals for if LLVM is in-tree or out-of-tree.

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

6 years ago[ValueTracking] Remove a number of unused arguments. NFC.
Chad Rosier [Fri, 28 Jul 2017 14:39:06 +0000 (14:39 +0000)]
[ValueTracking] Remove a number of unused arguments. NFC.

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

6 years ago[AArch64] Standardize suffixes for LSE Atomics mnemonics (NFCI)
Joel Jones [Fri, 28 Jul 2017 14:09:24 +0000 (14:09 +0000)]
[AArch64] Standardize suffixes for LSE Atomics mnemonics (NFCI)

This NFC changeset standardizes the suffixes used for LSE Atomics
instructions.

It changes the existing suffixes - 'b', 'h', 's', 'd' - to the existing
standard 'B', 'H', 'W' and 'X'.

This changeset is the result of the code review discussion for D35319.

Patch by: steleman

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

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

6 years ago[ARM] Add the option to directly access TLS pointer
Strahinja Petrovic [Fri, 28 Jul 2017 12:54:57 +0000 (12:54 +0000)]
[ARM] Add the option to directly access TLS pointer

This patch enables choice for accessing thread local
storage pointer (like '-mtp' in gcc).

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

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

6 years ago[X86] Add test case for PR33290
Simon Pilgrim [Fri, 28 Jul 2017 09:43:52 +0000 (09:43 +0000)]
[X86] Add test case for PR33290

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

6 years ago[X86][AVX] Cleanup shuffle combine tests - remove old prefixes.
Simon Pilgrim [Fri, 28 Jul 2017 09:41:55 +0000 (09:41 +0000)]
[X86][AVX] Cleanup shuffle combine tests - remove old prefixes.

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

6 years ago[ARM] Add test to check pcs of ARM ABI runtime floating point helpers
Peter Smith [Fri, 28 Jul 2017 09:21:00 +0000 (09:21 +0000)]
[ARM] Add test to check pcs of ARM ABI runtime floating point helpers

The ARM Runtime ABI document (IHI0043) defines the AEABI floating point
helper functions in section 4.1.2 The floating-point helper functions.
The functions listed in this section must always use the base AAPCS calling
convention.

This test generates calls to all the helper functions that llvm supports
and checks that the base AAPCS calling convention has been used. We test
the equivalent of -mfloat-abi=soft, -mfloat-abi=softfp, -mfloat-abi=hardfp
with an FPU that supports single and double precision, and one that only
supports double precision.

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

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

6 years ago[SCEV] Do not visit nodes twice in containsConstantSomewhere
Max Kazantsev [Fri, 28 Jul 2017 06:42:15 +0000 (06:42 +0000)]
[SCEV] Do not visit nodes twice in containsConstantSomewhere

This patch reworks the function that searches constants in Add and Mul SCEV expression
chains so that now it does not visit a node more than once, and also renames this function
for better correspondence between its implementation and semantics.

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

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

6 years ago[MachineOutliner] NFC: Comment tidying
Jessica Paquette [Fri, 28 Jul 2017 05:59:30 +0000 (05:59 +0000)]
[MachineOutliner] NFC: Comment tidying

The comment on describing the suffix tree had some pruning
stuff that was out of date in it.

Also fixed some typos.

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

6 years agoRevert rL309320 - "[OCaml] Respect CMAKE_C_FLAGS for OCaml C files"
Michal Gorny [Fri, 28 Jul 2017 04:29:20 +0000 (04:29 +0000)]
Revert rL309320 - "[OCaml] Respect CMAKE_C_FLAGS for OCaml C files"

This causes buildbot breakage for systems where OCaml files are built
with a different compiler.

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

6 years agotest: require x86 backend
Saleem Abdulrasool [Fri, 28 Jul 2017 04:15:35 +0000 (04:15 +0000)]
test: require x86 backend

Ensure that the target is registered before using it.  Should fix the
hexagon Bots.

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

6 years agoMC: add support for cfi_return_column
Saleem Abdulrasool [Fri, 28 Jul 2017 03:39:19 +0000 (03:39 +0000)]
MC: add support for cfi_return_column

This adds support for the CFI pseudo-op return_column.  This specifies
the frame table column which contains the return address.

Addresses PR33953!

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

6 years agoMC: clang-format enumeration (NFC)
Saleem Abdulrasool [Fri, 28 Jul 2017 03:39:18 +0000 (03:39 +0000)]
MC: clang-format enumeration (NFC)

This was hard to insert elements into.  clang-format it so that it is
easier.  NFC.

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

6 years agoRevert "[SCEV] Cache results of computeExitLimit"
Sanjoy Das [Fri, 28 Jul 2017 03:25:07 +0000 (03:25 +0000)]
Revert "[SCEV] Cache results of computeExitLimit"

This reverts commit r309080.  The patch needs to clear out the
ScalarEvolution::ExitLimits cache in forgetMemoizedResults.

I've replied on the commit thread for the patch with more details.

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

6 years ago[MachineOutliner] NFC: Split up getOutliningBenefit
Jessica Paquette [Fri, 28 Jul 2017 03:21:58 +0000 (03:21 +0000)]
[MachineOutliner] NFC: Split up getOutliningBenefit

This is some more cleanup in preparation for some actual
functional changes. This splits getOutliningBenefit into
two cost functions: getOutliningCallOverhead and
getOutliningFrameOverhead. These functions return the
number of instructions that would be required to call
a specific function and the number of instructions
that would be required to construct a frame for a
specific funtion. The actual outlining benefit logic
is moved into the outliner, which calls these functions.

The goal of refactoring getOutliningBenefit is to:

- Get us closer to getting rid of the IsTailCall flag

- Further split up "target-specific" things and
"general algorithm" things

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

6 years ago[JumpThreading] Stop falsely preserving LazyValueInfo.
Davide Italiano [Fri, 28 Jul 2017 03:10:43 +0000 (03:10 +0000)]
[JumpThreading] Stop falsely preserving LazyValueInfo.

JumpThreading claims to preserve LVI, but it doesn't preserve
the analyses which LVI holds a reference to (e.g. the Dominator).
In the current pass manager infrastructure, after JT runs, the
PM frees these analyses (including DominatorTree) but preserves
LVI.

CorrelatedValuePropagation runs immediately after and queries
a corrupted domtree, causing weird miscompiles.

This commit disables the preservation of LVI for the time being.
Eventually, we should either move LVI to a proper dependency
tracking mechanism (i.e. an analyses shouldn't hold references
to other analyses and compute them on demand if needed), or
we should teach all the passes preserving LVI to preserve the
analyses LVI depends on.

The new pass manager has a mechanism to invalidate LVI in case
one of the analyses it depends on becomes invalid, so this problem
shouldn't exist (at least not in this immediate form), but handling
of analyses holding references is still a very delicate subject.

Fixes PR33917 (and rustc).

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

6 years agoDebugInfo: Consider a CU containing only local imported entities to be 'empty'
David Blaikie [Fri, 28 Jul 2017 03:06:25 +0000 (03:06 +0000)]
DebugInfo: Consider a CU containing only local imported entities to be 'empty'

This can come up in ThinLTO & wastes space & makes degenerate IR.

As per the added FIXME, ultimately, local imported entities should hang
off the function and that way the imported entity list on the CU can be
tested for emptiness like all the other CU lists.

(function-attached local imported entities are probably also the best
path forward for fixing how imported entities are handled both in
cross-module use (currently, while ThinLTO preserves the imported
entities, they would not get used at the imported inlined location -
only in the abstract origin that appears in the partial CU created by
the import (which isn't emitted under Fission due to cross-CU
limitations there)) and to reduce the number of points where imported
entities are emitted (they're currently emitted into every inlined
instance, concrete instance, and abstract origin - they should only go
in teh abstract origin if there is one, otherwise in the concrete
instance - but this requires lots of delayed handling and wiring up,
same as abstract variables & subprograms))

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

6 years ago[JumpThreading] Add an option to dump LazyValueInfo after the run.
Davide Italiano [Fri, 28 Jul 2017 02:57:43 +0000 (02:57 +0000)]
[JumpThreading] Add an option to dump LazyValueInfo after the run.

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

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

6 years agoARMFrameLowering: Only set ExtraCSSpill for actually unused registers.
Matthias Braun [Fri, 28 Jul 2017 01:36:32 +0000 (01:36 +0000)]
ARMFrameLowering: Only set ExtraCSSpill for actually unused registers.

The code assumed that unclobbered/unspilled callee saved registers are
unused in the function. This is not true for callee saved registers that are
also used to pass parameters such as swiftself.

rdar://33401922

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

6 years ago[lit] Port googletest lit tests to Windows
Reid Kleckner [Fri, 28 Jul 2017 01:05:55 +0000 (01:05 +0000)]
[lit] Port googletest lit tests to Windows

Summary:
The technique of directly calling subprocess.Popen on a python script
doesn't work on Windows. The executable path of the command must refer
to a valid win32 executable.

Instead, rename all the python scripts masquerading as gtest executables
to have .py extensions, so we can easily detect then and call the python
executable for them. Do this on Linux as well as Windows for
consistency.

The test suite directory names also come out in lower-case on Windows.
We can consider removing that in a later patch. This change just updates
the FileCheck lines to match on Windows.

Fixes PR33933

Reviewers: modocache, mgorny

Subscribers: llvm-commits

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

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

6 years agoChanging the default MaxNumPromotions from 2 to 3.
Dehao Chen [Fri, 28 Jul 2017 01:03:10 +0000 (01:03 +0000)]
Changing the default MaxNumPromotions from 2 to 3.

Summary: In performance tuning, we see performance benefits when enlarge the maximum num promotion targets to 3. This is safe as soon as we have total percentage threshold properly setup (https://reviews.llvm.org/D35962)

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits, sanjoy

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

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

6 years agoSeparate the ICP total threshold and remaining threshold.
Dehao Chen [Fri, 28 Jul 2017 01:02:54 +0000 (01:02 +0000)]
Separate the ICP total threshold and remaining threshold.

Summary: In the current implementation, isPromotionProfitable only checks if the call count to a direct target is no less than a certain percentage threshold of the remaining call counts that have not been promoted. This causes code size problems when the target count is small but greater than a large portion of remaining counts. E.g. target1 takes 99.9%, while target2 takes 0.1%. Both targets will be promoted and inlined, makes the function size too large, which potentially prevents it from further inlining into its callers. This patch adds another percentage threshold against the total indirect call count. If the target count needs to be no less than both thresholds in order to be promoted speculatively.

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

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

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

6 years agoIncrease the ImportHotMultiplier to 10.0
Dehao Chen [Fri, 28 Jul 2017 01:02:34 +0000 (01:02 +0000)]
Increase the ImportHotMultiplier to 10.0

Summary: The original 3.0 hot mupltiplier is too small, and would prevent hot callsites from being inline. This patch increases the hot multilier to 10.0

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits, sanjoy

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

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

6 years ago[X86] Fix latent bug in sibcall eligibility logic
Reid Kleckner [Fri, 28 Jul 2017 00:58:35 +0000 (00:58 +0000)]
[X86] Fix latent bug in sibcall eligibility logic

The X86 tail call eligibility logic was correct when it was written, but
the addition of inalloca and argument copy elision broke its
assumptions. It was assuming that fixed stack objects were immutable.

Currently, we aim to emit a tail call if no arguments have to be
re-arranged in memory. This code would trace the outgoing argument
values back to check if they are loads from an incoming stack object.
If the stack argument is immutable, then we won't need to store it back
to the stack when we tail call.

Fortunately, stack objects track their mutability, so we can just make
the obvious check to fix the bug.

This was http://crbug.com/749826

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

6 years ago[sanitizer-coverage] rename sanitizer-coverage-create-pc-table into sanitizer-coverag...
Kostya Serebryany [Fri, 28 Jul 2017 00:09:29 +0000 (00:09 +0000)]
[sanitizer-coverage] rename sanitizer-coverage-create-pc-table into sanitizer-coverage-pc-table and add plumbing for a clang flag

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

6 years agoRemove unused function from AArch64 backend (NFC)
Adrian Prantl [Thu, 27 Jul 2017 23:52:06 +0000 (23:52 +0000)]
Remove unused function from AArch64 backend (NFC)

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

6 years ago[sanitizer-coverage] add a feature sanitizer-coverage-create-pc-table=1 (works with...
Kostya Serebryany [Thu, 27 Jul 2017 23:36:49 +0000 (23:36 +0000)]
[sanitizer-coverage] add a feature sanitizer-coverage-create-pc-table=1 (works with trace-pc-guard and inline-8bit-counters) that adds a static table of instrumented PCs to be used at run-time

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

6 years ago[MachineOutliner] Cleanup: move findCandidates out of suffix tree
Jessica Paquette [Thu, 27 Jul 2017 23:24:43 +0000 (23:24 +0000)]
[MachineOutliner] Cleanup: move findCandidates out of suffix tree

Doing some cleanup in preparation for some functional changes.
This commit moves findCandidates out of the suffix tree and into the
MachineOutliner class. This is much easier to follow, and removes
the burden of candidate choice from the suffix tree.

It also adds a couple FIXMEs and simplifies building outlined function
names.

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

6 years ago[llvm-pdbutil] Clean up ExitOnError usage to add ": " to our errors
Reid Kleckner [Thu, 27 Jul 2017 23:13:18 +0000 (23:13 +0000)]
[llvm-pdbutil] Clean up ExitOnError usage to add ": " to our errors

The banner parameter is supposed to end in a separator, like ": ".
Otherwise, we get ugly errors like:

Error while reading publics streamNative error: blah blah

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

6 years ago[PDB] Initialize the std::array<ulittle32_t> used for the gsi bitmap
Reid Kleckner [Thu, 27 Jul 2017 23:13:05 +0000 (23:13 +0000)]
[PDB] Initialize the std::array<ulittle32_t> used for the gsi bitmap

With ASan, we would write about 512 bytes of malloc fill value to the
PDB, with some random bits ORed in here and there. Dumping the PDB would
always fail reliably.

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

6 years ago[ConstantFolder] Don't try to fold gep when the idx is a vector.
Davide Italiano [Thu, 27 Jul 2017 22:20:44 +0000 (22:20 +0000)]
[ConstantFolder] Don't try to fold gep when the idx is a vector.

The code in ConstantFoldGetElementPtr() assumes integers, and
therefore it crashes trying to get the integer bidwith of a vector
type (in this case <4 x i32>. I just changed the code to prevent
the folding in case of vectors and I didn't bother to generalize
as this doesn't seem to me something that really happens in
practice, but I'm willing to change the patch if you think
it's worth it.
This is hard to trigger from -instsimplify or -instcombine
only as the second instruction is dead, so the test uses loop-unroll.

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

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

6 years ago[X86] Don't lie about legality to TLI's demanded bits.
Ahmed Bougacha [Thu, 27 Jul 2017 21:28:59 +0000 (21:28 +0000)]
[X86] Don't lie about legality to TLI's demanded bits.

Like r309323, X86 had a typo where it passed the wrong flags to TLO.

Found by inspection; I haven't been able to tickle this into having
observable behavior.  I don't think it does, given that X86 doesn't have
custom demanded bits logic, and the generic logic doesn't have a lot of
exposure to illegal constructs.

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

6 years ago[AArch64] Remove outdated comment. NFC.
Ahmed Bougacha [Thu, 27 Jul 2017 21:27:58 +0000 (21:27 +0000)]
[AArch64] Remove outdated comment. NFC.

There hasn't been a ternary since r231987.

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

6 years ago[AArch64] Fix legality info passed to demanded bits for TBI opt.
Ahmed Bougacha [Thu, 27 Jul 2017 21:27:25 +0000 (21:27 +0000)]
[AArch64] Fix legality info passed to demanded bits for TBI opt.

The (seldom-used) TBI-aware optimization had a typo lying dormant since
it was first introduced, in r252573:  when asking for demanded bits, it
told TLI that it was running after legalize, where the opposite was
true.

This is an important piece of information, that the demanded bits
analysis uses to make assumptions about the node.  r301019 added such an
assumption, which was broken by the TBI combine.

Instead, pass the correct flags to TLO.

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

6 years ago[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG
Michal Gorny [Thu, 27 Jul 2017 21:13:25 +0000 (21:13 +0000)]
[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG

Account for the possibility of LLVMDumpType() not being available with
NDEBUG in the OCaml bindings. If it is not built into LLVM, make
the dump function raise an exception.

Since rL293359, the dump functions are built only if either NDEBUG is
not defined, or LLVM_ENABLE_DUMP is defined. As a result, if the dump
functions are not built in LLVM, the dynamic OCaml libraries fail to
load due to undefined LLVMDumpType symbol.

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

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

6 years ago[OCaml] Respect CMAKE_C_FLAGS for OCaml C files
Michal Gorny [Thu, 27 Jul 2017 21:13:19 +0000 (21:13 +0000)]
[OCaml] Respect CMAKE_C_FLAGS for OCaml C files

Pass the values of CMAKE_C_FLAGS and CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}
as -ccopt to ocamlc. This enforces the specific flags used for the LLVM
build to be used for OCaml bindings as well, notably -O and -march
flags.

This also solves the issue of the user being unable to force specific
flags for OCaml bindings builds. Gentoo needs this to enforce -DNDEBUG
consistently between the LLVM build and the split OCaml bindings build.

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

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

6 years agoAdd test to reject merging of empty manifest.
Eric Beckmann [Thu, 27 Jul 2017 19:58:12 +0000 (19:58 +0000)]
Add test to reject merging of empty manifest.

Reviewers: ruiu, rnk

Subscribers: llvm-commits

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

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

6 years ago[ARM] Add use-misched feature, to enable the MachineScheduler.
Florian Hahn [Thu, 27 Jul 2017 19:56:44 +0000 (19:56 +0000)]
[ARM] Add use-misched feature, to enable the MachineScheduler.

Summary:
This change makes it easier to experiment with the MachineScheduler in
the ARM backend and also makes it very explicit which CPUs use the
MachineScheduler (currently only swift and cyclone).

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

Reviewed By: MatzeB

Subscribers: aemerson, kristof.beyls, llvm-commits

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

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

6 years agoChange prefix in vector-shuffle-combining-avx.patch to reduce test size.
Dinar Temirbulatov [Thu, 27 Jul 2017 19:47:35 +0000 (19:47 +0000)]
Change prefix in vector-shuffle-combining-avx.patch to reduce test size.

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

6 years ago[MergeFunctions] Remove alias support.
whitequark [Thu, 27 Jul 2017 19:36:13 +0000 (19:36 +0000)]
[MergeFunctions] Remove alias support.

The alias support was dead code since 2011. It was last touched
in r124182, where it was reintroduced after being removed
in r110434, and since then it was gated behind a HasGlobalAliases
flag that was permanently stuck as `false`.

It is also broken. I'm not sure if it bitrotted or was just broken
in the first place because it appears to have never been tested,
but the following IR results in a crash:

    define internal i32 @a(i32 %a, i32 %b) unnamed_addr {
      %c = add i32 %a, %b
      %d = xor i32 %a, %c
      ret i32 %c
    }

    define internal i32 @b(i32 %a, i32 %b) unnamed_addr {
      %c = add i32 %a, %b
      %d = xor i32 %a, %c
      ret i32 %c
    }

It seems safe to remove buggy untested code that no one cared about
for seven years.

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

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

6 years ago[lit] Fix TestRunner unit test on Windows
Brian Gesiak [Thu, 27 Jul 2017 19:27:10 +0000 (19:27 +0000)]
[lit] Fix TestRunner unit test on Windows

Summary:
Normally Python converts all newline characters, Windows or Unix,
to Unix newlines when opening a file. However, lit opens files in
binary mode, which does not perform this conversion. As a result,
trailing Windows newlines are not stripped from test input, which
caused a failure in the TestRunner unit test:

```
FAIL: test_custom (__main__.TestIntegratedTestKeywordParser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\bgesiak\src\llvm\llvm\utils\lit\tests\unit\TestRunner.py", line 109, in test_custom
    self.assertItemsEqual(value, ['a', 'b', 'c'])
AssertionError: Element counts were not equal:
First has 1, Second has 0: 'c\r'
First has 0, Second has 1:  'c'
```

Fix the discrepancy in behavior across the two platforms by
manually stripping Windows newlines before yielding each line in
the test file.

Reviewers: echristo, beanz, ddunbar, delcypher, rnk

Reviewed By: rnk

Subscribers: mehdi_amini, llvm-commits

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

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

6 years agoUn-revert "Teach the CMake build system to run lit's test suite. These can be run"
Brian Gesiak [Thu, 27 Jul 2017 19:18:35 +0000 (19:18 +0000)]
Un-revert "Teach the CMake build system to run lit's test suite. These can be run"

Summary:
Depends on https://reviews.llvm.org/D35879.

This reverts rL257268, which in turn was a revert of rL257221.
https://reviews.llvm.org/D35879 marks the tests in the lit test suite
that fail on Windows as XFAIL, which should allow these tests to pass
on Windows-based buildbots.

Reviewers: delcypher, beanz, mgorny, jroelofs, rnk

Reviewed By: mgorny

Subscribers: rnk, ddunbar, george.karpenkov, llvm-commits

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

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

6 years ago[FunctionImport] Prefer isa<> to dyn_cast<> as the value is not used.
Davide Italiano [Thu, 27 Jul 2017 18:38:09 +0000 (18:38 +0000)]
[FunctionImport] Prefer isa<> to dyn_cast<> as the value is not used.

This change makes GCC7 happy again.

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

6 years ago[InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have...
Hiroshi Yamauchi [Thu, 27 Jul 2017 18:27:11 +0000 (18:27 +0000)]
[InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index

Summary:
Pointer difference simplifications currently happen only if input GEPs don't have other uses or their indexes are all constants, to avoid duplicating indexing arithmetic.

This patch enables cases with exactly one non-constant index among input GEPs to happen where there is no duplicated arithmetic or code size increase even if input GEPs have other uses.

For example, this patch allows "(&A[42][i]-&A[42][0])" --> "i", which didn't happen previously, if the input GEP(s) have other uses.

Reviewers: sanjoy, bkramer

Reviewed By: sanjoy

Subscribers: mcrosier, llvm-commits

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

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

6 years ago[PDB] Write public symbol records and the publics hash table
Reid Kleckner [Thu, 27 Jul 2017 18:25:59 +0000 (18:25 +0000)]
[PDB] Write public symbol records and the publics hash table

Summary:
MSVC link.exe records all external symbol names in the publics stream.
It provides similar functionality to an ELF .symtab.

Reviewers: zturner, ruiu

Subscribers: hiraditya, llvm-commits

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

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

6 years ago[SelectionDAG] Improve DAGTypeLegalizer::convertMask assertion (PR33960)
Simon Pilgrim [Thu, 27 Jul 2017 18:15:54 +0000 (18:15 +0000)]
[SelectionDAG] Improve DAGTypeLegalizer::convertMask assertion (PR33960)

Improve DAGTypeLegalizer::convertMask's isSETCCorConvertedSETCC assertion to properly check for any mixture of SETCC or BUILD_VECTOR of constants, or a logical mask op of them.

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

6 years ago[X86] SET0 to use XMM registers where possible PR26018 PR32862
Dinar Temirbulatov [Thu, 27 Jul 2017 17:47:01 +0000 (17:47 +0000)]
[X86] SET0 to use XMM registers where possible PR26018 PR32862

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

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

6 years agoRelax the matching in these tests
Adam Nemet [Thu, 27 Jul 2017 17:45:02 +0000 (17:45 +0000)]
Relax the matching in these tests

Looks like the template arguments are displayed differently depending on the
host compiler(?).  E.g.:

InnerAnalysisManagerProxy<CGSCCAnalysisManager
InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::LazyCallGraph::SCC, ...

Fix fallout after r309294

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

6 years ago[ICP] Migrate to OptimizationRemarkEmitter
Adam Nemet [Thu, 27 Jul 2017 16:54:15 +0000 (16:54 +0000)]
[ICP] Migrate to OptimizationRemarkEmitter

This is a module pass so for the old PM, we can't use ORE, the function
analysis pass.  Instead ORE is created on the fly.

A few notes:

- isPromotionLegal is folded in the caller since we want to emit the Function
in the remark but we can only do that if the symbol table look-up succeeded.

- There was good test coverage for remarks in this pass.

- promoteIndirectCall uses ORE conditionally since it's also used from
SampleProfile which does not use ORE yet.

Fixes PR33792.

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

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

6 years ago[OptRemark] Allow streaming of 64-bit integers
Adam Nemet [Thu, 27 Jul 2017 16:54:13 +0000 (16:54 +0000)]
[OptRemark] Allow streaming of 64-bit integers

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

6 years ago[lit] Fix order of checks in shtest-shell.py test
Brian Gesiak [Thu, 27 Jul 2017 16:50:40 +0000 (16:50 +0000)]
[lit] Fix order of checks in shtest-shell.py test

Summary:
An expectation in `utils/lit/tests/Inputs/shtest-shell/redirects.txt`
expects that first a string printed to stdout is seen, and then a
string printed to stderr. Add `flush()` calls to ensure that stdout is
printed before stderr, as expected.

Reviewers: rnk, mgorny, jroelofs

Reviewed By: rnk

Subscribers: llvm-commits

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

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

6 years agoAll libcalls should be considered to be GC-leaf functions.
Daniel Neilson [Thu, 27 Jul 2017 16:49:39 +0000 (16:49 +0000)]
All libcalls should be considered to be GC-leaf functions.

Summary:
It is possible for some passes to materialize a call to a libcall (ex: ldexp, exp2, etc),
but these passes will not mark the call as a gc-leaf-function. All libcalls are
actually gc-leaf-functions, so we change llvm::callsGCLeafFunction() to tell us that
available libcalls are equivalent to gc-leaf-function calls.

Reviewers: sanjoy, anna, reames

Reviewed By: anna

Subscribers: llvm-commits

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

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

6 years ago[TargetParser] Use enum classes for various ARM kind enums.
Florian Hahn [Thu, 27 Jul 2017 16:27:56 +0000 (16:27 +0000)]
[TargetParser] Use enum classes for various ARM kind enums.

Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.

FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.

Reviewers: rengolin, javed.absar, chandlerc, rovka

Reviewed By: rovka

Subscribers: aemerson, kristof.beyls, llvm-commits

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

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

6 years ago[SLP] Outline code for the check that instruction users are part of
Alexey Bataev [Thu, 27 Jul 2017 15:48:44 +0000 (15:48 +0000)]
[SLP] Outline code for the check that instruction users are part of
vectorization tree, NFC.

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

6 years ago[SelectionDAG] Avoid repeated calls to getNumOperands in for loop. NFCI.
Simon Pilgrim [Thu, 27 Jul 2017 15:42:21 +0000 (15:42 +0000)]
[SelectionDAG] Avoid repeated calls to getNumOperands in for loop. NFCI.

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

6 years agoFix assert from r309278
David Blaikie [Thu, 27 Jul 2017 15:28:10 +0000 (15:28 +0000)]
Fix assert from r309278

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

6 years agoremove redundant check
Adrian Prantl [Thu, 27 Jul 2017 15:24:20 +0000 (15:24 +0000)]
remove redundant check

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

6 years agoThinLTO: Don't import aliases of any kind (even linkonce_odr)
David Blaikie [Thu, 27 Jul 2017 15:09:06 +0000 (15:09 +0000)]
ThinLTO: Don't import aliases of any kind (even linkonce_odr)

Summary:
Until a more advanced version of importing can be implemented for
aliases (one that imports an alias as an available_externally definition
of the aliasee), skip the narrow subset of cases that was possible but
came at a cost: aliases of linkonce_odr functions could be imported
because the linkonce_odr function could be safely duplicated from the
source module. This came/comes at the cost of not being able to 'home'
imported linkonce functions (they had to be emitted linkonce_odr in all
the destination modules (even if they weren't used by an alias) rather
than as available_externally - causing extra object size).

Tangentially, this also was the only reason ThinLTO would emit multiple
CUs in to the resulting DWARF - which happens to be a problem for
Fission (there's a fix for this in GDB but not released yet, etc).
(actually it's not the only reason - but I'm sending a patch to fix the
other reason shortly)

There's no reason to believe this particularly narrow alias importing
was especially/meaningfully important, only that it was /possible/ to
implement in this way. When a more general solution is done, it should
still satisfy the DWARF concerns above, since the import will still be
available_externally, and thus not create extra CUs.

Since now all aliases are treated the same, I removed/simplified some
test cases since they were testing corner cases where there are no
longer any corners.

Reviewers: tejohnson, mehdi_amini

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

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

6 years ago[SelectionDAG] Tidyup mask creation. NFCI.
Simon Pilgrim [Thu, 27 Jul 2017 15:08:53 +0000 (15:08 +0000)]
[SelectionDAG] Tidyup mask creation. NFCI.

Assign all concat elements to UNDEF and then just replace the first element, instead of copying everything individually.

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

6 years ago[ARM] Mark labels in skipAlignedDPRCS2Spills as fallthrough (NFC).
Florian Hahn [Thu, 27 Jul 2017 14:37:17 +0000 (14:37 +0000)]
[ARM] Mark labels in skipAlignedDPRCS2Spills as fallthrough (NFC).

The comment at the top of the switch statement indicates that the
fall-through behavior is intentional. By using LLVM_FALLTHROUGH,
-Wimplicit-fallthrough are silenced, which is enabled by default in GCC
7.

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

6 years agoAdded cost of ZEROALL and ZEROUPPER instrs in btver2 cpu.
Andrew V. Tischenko [Thu, 27 Jul 2017 13:12:08 +0000 (13:12 +0000)]
Added cost of ZEROALL and ZEROUPPER instrs in btver2 cpu.
Differential Revision https://reviews.llvm.org/D35834

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

6 years ago[InlineCost, NFC] Change CallAnalyzer::isGEPFree to use TTI::getUserCost instead...
Evgeny Astigeevich [Thu, 27 Jul 2017 12:49:27 +0000 (12:49 +0000)]
[InlineCost, NFC] Change CallAnalyzer::isGEPFree to use TTI::getUserCost instead of TTI::getGEPCost

Currently CallAnalyzer::isGEPFree uses TTI::getGEPCost to check if GEP is free.
TTI::getGEPCost cannot handle cases when GEPs participate in Def-Use dependencies
(see https://reviews.llvm.org/D31186 for example).
There is TTI::getUserCost which can calculate the cost more accurately by
taking dependencies into account.

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

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

6 years ago[globalisel][tablegen] Ensure MatchTable's are compile-time constants with constexpr...
Daniel Sanders [Thu, 27 Jul 2017 12:47:31 +0000 (12:47 +0000)]
[globalisel][tablegen] Ensure MatchTable's are compile-time constants with constexpr. NFC.

This should prevent any re-occurence of the problem where the table was
initialized at run-time.

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

6 years ago[X86][AVX] Regenerate shuffle tests with broadcast comments.
Simon Pilgrim [Thu, 27 Jul 2017 12:32:45 +0000 (12:32 +0000)]
[X86][AVX] Regenerate shuffle tests with broadcast comments.

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

6 years agoRe-commit: r309094 [globalisel][tablegen] Fuse the generated tables together.
Daniel Sanders [Thu, 27 Jul 2017 11:03:45 +0000 (11:03 +0000)]
Re-commit: r309094 [globalisel][tablegen] Fuse the generated tables together.

Summary:
Now that we have control flow in place, fuse the per-rule tables into a
single table. This is a compile-time saving at this point. However, this will
also enable the optimization of a table so that similar instructions can be
tested together, reducing the time spent on the matching the code.

This is NFC in terms of externally visible behaviour but some internals have
changed slightly. State.MIs is no longer reset between each rule that is
attempted because it's not necessary to do so. As a consequence of this the
restriction on the order that instructions are added to State.MIs has been
relaxed to only affect recorded instructions that require new elements to be
added to the vector. GIM_RecordInsn can now write to any element from 1 to
State.MIs.size() instead of just State.MIs.size().

The compile-time regressions from the last commit were caused by the ARM target
including a non-const variable (zero_reg) in the table and therefore generating
an initializer for it. That variable is now const.

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

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

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

6 years ago[X86] Adding test cases for LEA factorization (PR32755 / D35014)
Simon Pilgrim [Thu, 27 Jul 2017 10:36:09 +0000 (10:36 +0000)]
[X86] Adding test cases for LEA factorization (PR32755 / D35014)

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

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

6 years ago[X86] Tidyup MaskedLoad/Store mask creation. NFCI.
Simon Pilgrim [Thu, 27 Jul 2017 10:29:04 +0000 (10:29 +0000)]
[X86] Tidyup MaskedLoad/Store mask creation. NFCI.

Assign all concat elements to zero and then just replace the first element, instead of setting them all to null and copying everything in.

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

6 years ago[TTI] fixing a bug in the isLegalMaskedScatter API
Mohammed Agabaria [Thu, 27 Jul 2017 10:28:16 +0000 (10:28 +0000)]
[TTI] fixing a bug in the isLegalMaskedScatter API

isLegalMaskedScatter called the Gather version which is a bug.
use test case is provided within the patch of AVX2 gathers at: https://reviews.llvm.org/D35772

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

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

6 years ago[PowerPC] enable optimizeCompareInstr for branch with static branch hint
Hiroshi Inoue [Thu, 27 Jul 2017 08:14:48 +0000 (08:14 +0000)]
[PowerPC] enable optimizeCompareInstr for branch with static branch hint

In optimizeCompareInstr, a compare instruction is eliminated by using a record form instruction if possible.
If the branch instruction that uses the result of the compare has a static branch hint, the optimization does not happen.
This patch makes this optimization happen regardless of the branch hint by splitting branch hint and branch condition before checking the predicate to identify the possible optimizations.

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

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

6 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Thu, 27 Jul 2017 06:02:05 +0000 (06:02 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This change is failing tests on Windows bots due to permissions.

This reverts commit r309249.

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

6 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Thu, 27 Jul 2017 04:35:30 +0000 (04:35 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

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

6 years ago[X86] Improve the unknown stepping support for Intel CPUs in getHostCPUName
Craig Topper [Thu, 27 Jul 2017 03:26:52 +0000 (03:26 +0000)]
[X86] Improve the unknown stepping support for Intel CPUs in getHostCPUName

This patch improves our guessing of unknown Intel CPUs to support Goldmont and skylake-avx512.

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

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

6 years ago[GISel]: Missed passing in a parameter to addUsesFromArgs
Aditya Nandakumar [Thu, 27 Jul 2017 02:15:34 +0000 (02:15 +0000)]
[GISel]: Missed passing in a parameter to addUsesFromArgs

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

6 years agoRemove check for i686.
Eric Beckmann [Thu, 27 Jul 2017 01:16:19 +0000 (01:16 +0000)]
Remove check for i686.

libxml2 is supported for 32 bit, so our build system should be checking
the target rather than native os when choosing shared libs.

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

6 years agoRe-enable libxml2 tests.
Eric Beckmann [Thu, 27 Jul 2017 01:11:53 +0000 (01:11 +0000)]
Re-enable libxml2 tests.

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

6 years ago[DWARF] Minor code style modification, no functionality change.
Spyridoula Gravani [Thu, 27 Jul 2017 00:59:33 +0000 (00:59 +0000)]
[DWARF] Minor code style modification, no functionality change.

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