OSDN Git Service

android-x86/external-llvm.git
7 years ago[CMake] Connecting check-all and test-depends targets correctly
Chris Bieneman [Thu, 1 Sep 2016 18:26:01 +0000 (18:26 +0000)]
[CMake] Connecting check-all and test-depends targets correctly

My previous attempt at this connected the sub-project check targets to the test-depends target instead of to the check-all target. That resulted in the tests running multiple times on bots that built "test-depends" and "check-all" in separate build invocations.

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

7 years agoRename some variables to have meaningful names. NFC.
Michael Kuperstein [Thu, 1 Sep 2016 18:24:42 +0000 (18:24 +0000)]
Rename some variables to have meaningful names. NFC.

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

7 years ago[LV] Move VectorParts allocation and mapping into PHI widening (NFC)
Matthew Simpson [Thu, 1 Sep 2016 18:14:27 +0000 (18:14 +0000)]
[LV] Move VectorParts allocation and mapping into PHI widening (NFC)

This patch moves the allocation of VectorParts for PHI nodes into the actual
PHI widening code. Previously, we allocated these VectorParts in
vectorizeBlockInLoop, and passed them by reference to widenPHIInstruction. Upon
returning, we would then map the VectorParts in VectorLoopValueMap. This
behavior is problematic for the cases where we only want to generate a scalar
version of a PHI node. For example, if in the future we only generate a scalar
version of an induction variable, we would end up inserting an empty vector
entry into the map once we return to vectorizeBlockInLoop. We now no longer
need to pass VectorParts to the various PHI widening functions, and we can keep
VectorParts allocation as close as possible to the point at which they are
actually mapped in VectorLoopValueMap.

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

7 years ago[codeview] Properly propagate the TypeLeafKind through the pipeline.
Zachary Turner [Thu, 1 Sep 2016 18:08:19 +0000 (18:08 +0000)]
[codeview] Properly propagate the TypeLeafKind through the pipeline.

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

7 years ago[DAGCombine] Don't fold a trunc if it feeds an anyext
Michael Kuperstein [Thu, 1 Sep 2016 17:59:24 +0000 (17:59 +0000)]
[DAGCombine] Don't fold a trunc if it feeds an anyext

Legalization tends to create anyext(trunc) patterns. This should always be
combined - into either a single trunc, a single ext, or nothing if the
types match exactly. But if we happen to combine the trunc first, we may pull
the trunc away from the anyext or make it implicit (e.g. the truncate(extract)
-> extract(bitcast) fold).

To prevent this, we can avoid doing the fold, similarly to how we already handle
fpround(fpextend).

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

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

7 years agoAMDGPU/SI: MIMG TD Refactoring.
Changpeng Fang [Thu, 1 Sep 2016 17:54:54 +0000 (17:54 +0000)]
AMDGPU/SI: MIMG TD Refactoring.

Summary:
 Created a new td file MIMGInstructions.td which contains all definitions
of MIMG related instructions.

Reviewed by:
  kzhuravl, vpykhtin

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

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

7 years ago[lit] Use multiprocessing by default on Windows
Reid Kleckner [Thu, 1 Sep 2016 17:19:44 +0000 (17:19 +0000)]
[lit] Use multiprocessing by default on Windows

Apparently nobody evaluated multiprocessing on Windows since Daniel
enabled multiprocessing on Unix in r193279. It works so far as I can
tell.

Today this is worth about an 8x speedup (631.29s to 73.25s) on my 24
core Windows machine. Hopefully this will improve Windows buildbot cycle
time, where currently it takes more time to run check-all than it does
to self-host with assertions enabled:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/20
  build stage 2 ninja all ( 28 mins, 22 secs )
  ninja check 2 stage 2   ( 37 mins, 38 secs )

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

7 years ago[CMake] Revive LLVM_*_DIRS variables
Chris Bieneman [Thu, 1 Sep 2016 16:43:39 +0000 (16:43 +0000)]
[CMake] Revive LLVM_*_DIRS variables

This is a partial revert of r280013. Brad King pointed out these variable names are matching CMake conventions, so we should preserve them.

I've also added a direct mapping of the LLVM_*_DIR variables which we need to make projects support building in and out of tree.

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

7 years ago[EarlyCSE] Change C API pass interface for EarlyCSE w/ MemorySSA
Geoff Berry [Thu, 1 Sep 2016 15:07:46 +0000 (15:07 +0000)]
[EarlyCSE] Change C API pass interface for EarlyCSE w/ MemorySSA

Previous change broke the C API for creating an EarlyCSE pass w/
MemorySSA by adding a bool parameter to control whether MemorySSA was
used or not.  This broke the OCaml bindings.  Instead, change the old C
API entry point back and add a new one to request an EarlyCSE pass with
MemorySSA.

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

7 years ago[mips] Include missed file from previous commit
Simon Dardis [Thu, 1 Sep 2016 15:03:13 +0000 (15:03 +0000)]
[mips] Include missed file from previous commit

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

7 years ago[X86][SSE] Dropped (V)CVTPD2PS intrinsic patterns now that its bound to X86vfpround
Simon Pilgrim [Thu, 1 Sep 2016 14:59:20 +0000 (14:59 +0000)]
[X86][SSE] Dropped (V)CVTPD2PS intrinsic patterns now that its bound to X86vfpround

It now uses X86vfpround patterns directly instead.

Followup to D23797

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

7 years ago[mips] interAptiv based generic schedule model
Simon Dardis [Thu, 1 Sep 2016 14:53:53 +0000 (14:53 +0000)]
[mips] interAptiv based generic schedule model

This scheduler describes a processor which covers all MIPS ISAs based
around the interAptiv and P5600 timings.

Reviewers: vkalintiris, dsanders

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

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

7 years ago[CMake] Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC
Andrey Bokhanko [Thu, 1 Sep 2016 14:39:54 +0000 (14:39 +0000)]
[CMake] Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC

Patch by Johannes Sebastian Mueller-Roemer.

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

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

7 years ago[InstCombine] remove fold of an icmp pattern that should never happen
Sanjay Patel [Thu, 1 Sep 2016 14:20:43 +0000 (14:20 +0000)]
[InstCombine] remove fold of an icmp pattern that should never happen

While removing a scalar shackle from an icmp fold, I noticed that I couldn't find any tests to trigger
this code path.

The 'and' shrinking transform should be handled by InstCombiner::foldCastedBitwiseLogic()
or eliminated with InstSimplify. The icmp narrowing is part of InstCombiner::foldICmpWithCastAndCast().

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

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

7 years ago[Hexagon] Deal with undefs when extending live intervals
Krzysztof Parzyszek [Thu, 1 Sep 2016 13:59:35 +0000 (13:59 +0000)]
[Hexagon] Deal with undefs when extending live intervals

Reapply r280275, since MSVC accepts r280358.

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

7 years agoOptimized FMA intrinsic + FNEG , like
Elena Demikhovsky [Thu, 1 Sep 2016 13:58:53 +0000 (13:58 +0000)]
Optimized FMA intrinsic + FNEG , like
-(a*b+c)

and FNEG + FMA, like
a*b-c or (-a)*b+c.

The bug description is here :  https://llvm.org/bugs/show_bug.cgi?id=28892

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

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

7 years ago[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches
James Molloy [Thu, 1 Sep 2016 12:58:13 +0000 (12:58 +0000)]
[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches

This was a real restriction in the original version of SinkIfThenCodeToEnd. Now it's been rewritten, the restriction can be lifted.

As part of this, we handle a very common and useful case where one of the incoming branches is actually conditional. Consider:

   if (a)
     x(1);
   else if (b)
     x(2);

This produces the following CFG:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \    |  /
          [ end ]

[end] has two unconditional predecessor arcs and one conditional. The conditional refers to the implicit empty 'else' arc. This same pattern can also be caused by an empty default block in a switch.

We can't sink the call to x() down to end because no call to x() happens on the third incoming arc (assume that x() has sideeffects for the sake of argument; if something is safe to speculate we could indeed sink nevertheless but this cannot happen in the general case and causes many extra selects).

We are now able to detect this case and split off the unconditional arcs to a common successor:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \   /    |
     [sink.split] |
           \     /
           [ end ]

Now we can sink the call to x() into %sink.split. This can cause significant code simplification in many testcases.

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

7 years agoAdd an optional parameter with a list of undefs to extendToIndices
Krzysztof Parzyszek [Thu, 1 Sep 2016 12:10:36 +0000 (12:10 +0000)]
Add an optional parameter with a list of undefs to extendToIndices

Reapply r280268, hopefully in a version that MSVC likes.

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

7 years ago[IR] Properly handle escape characters in Attribute::getAsString()
Honggyu Kim [Thu, 1 Sep 2016 11:44:06 +0000 (11:44 +0000)]
[IR] Properly handle escape characters in Attribute::getAsString()

If an attribute name has special characters such as '\01', it is not
properly printed in LLVM assembly language format.  Since the format
expects the special characters are printed as it is, it has to contain
escape characters to make it printable.

Before:
  attributes #0 = { ... "counting-function"="^A__gnu_mcount_nc" ...

After:
  attributes #0 = { ... "counting-function"="\01__gnu_mcount_nc" ...

Reviewers: hfinkel, rengolin, rjmccall, compnerd

Subscribers: nemanjai, mcrosier, hans, shenhan, majnemer, llvm-commits

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

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

7 years ago[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd
James Molloy [Thu, 1 Sep 2016 10:44:35 +0000 (10:44 +0000)]
[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd

r279460 rewrote this function to be able to handle more than two incoming edges and took pains to ensure this didn't regress anything.

This time we change the logic for determining if an instruction should be sunk. Previously we used a single pass greedy algorithm - sink instructions until one requires more than one PHI node or we run out of instructions to sink.

This had the problem that sinking instructions that had non-identical but trivially the same operands needed extra logic so we sunk them aggressively. For example:

    %a = load i32* %b          %d = load i32* %b
    %c = gep i32* %a, i32 0    %e = gep i32* %d, i32 1

Sinking %c and %e would naively require two PHI merges as %a != %d. But the loads are obviously equivalent (and maybe can't be hoisted because there is no common predecessor).

This is why we implemented the fairly complex function areValuesTriviallySame(), to look through trivial differences like this. However it's just not clever enough.

Instead, throw areValuesTriviallySame away, use pointer equality to check equivalence of operands and switch to a two-stage algorithm.

In the "scan" stage, we look at every sinkable instruction in isolation from end of block to front. If it's sinkable, we keep track of all operands that required PHI merging.

In the "sink" stage, we iteratively sink the last non-terminator in the source blocks. But when calculating how many PHIs are actually required to be inserted (to work out if we should stop or not) we remove any values that have already been sunk from the set of PHI-merges required, which allows us to be more aggressive.

This turns an algorithm with potentially recursive lookahead (looking through GEPs, casts, loads and any other instruction potentially not CSE'd) to two linear scans.

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

7 years agoAdd ISD::EH_DWARF_CFA, simplify @llvm.eh.dwarf.cfa on Mips, fix on PowerPC
Hal Finkel [Thu, 1 Sep 2016 10:28:47 +0000 (10:28 +0000)]
Add ISD::EH_DWARF_CFA, simplify @llvm.eh.dwarf.cfa on Mips, fix on PowerPC

LLVM has an @llvm.eh.dwarf.cfa intrinsic, used to lower the GCC-compatible
__builtin_dwarf_cfa() builtin. As pointed out in PR26761, this is currently
broken on PowerPC (and likely on ARM as well). Currently, @llvm.eh.dwarf.cfa is
lowered using:

  ADD(FRAMEADDR, FRAME_TO_ARGS_OFFSET)

where FRAME_TO_ARGS_OFFSET defaults to the constant zero. On x86,
FRAME_TO_ARGS_OFFSET is lowered to 2*SlotSize. This setup, however, does not
work for PowerPC. Because of the way that the stack layout works, the canonical
frame address is not exactly (FRAMEADDR + FRAME_TO_ARGS_OFFSET) on PowerPC
(there is a lower save-area offset as well), so it is not just a matter of
implementing FRAME_TO_ARGS_OFFSET for PowerPC (unless we redefine its
semantics -- We can do that, since it is currently used only for
@llvm.eh.dwarf.cfa lowering, but the better to directly lower the CFA construct
itself (since it can be easily represented as a fixed-offset FrameIndex)). Mips
currently does this, but by using a custom lowering for ADD that specifically
recognizes the (FRAMEADDR, FRAME_TO_ARGS_OFFSET) pattern.

This change introduces a ISD::EH_DWARF_CFA node, which by default expands using
the existing logic, but can be directly lowered by the target. Mips is updated
to use this method (which simplifies its implementation, and I suspect makes it
more robust), and updates PowerPC to do the same.

Fixes PR26761.

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

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

7 years ago[AMDGPU] Scalar Memory instructions TD refactoring
Valery Pykhtin [Thu, 1 Sep 2016 09:56:47 +0000 (09:56 +0000)]
[AMDGPU] Scalar Memory instructions TD refactoring

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

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

7 years agoAdd a counter-function insertion pass
Hal Finkel [Thu, 1 Sep 2016 09:42:39 +0000 (09:42 +0000)]
Add a counter-function insertion pass

As discussed in https://reviews.llvm.org/D22666, our current mechanism to
support -pg profiling, where we insert calls to mcount(), or some similar
function, is fundamentally broken. We insert these calls in the frontend, which
means they get duplicated when inlining, and so the accumulated execution
counts for the inlined-into functions are wrong.

Because we don't want the presence of these functions to affect optimizaton,
they should be inserted in the backend. Here's a pass which would do just that.
The knowledge of the name of the counting function lives in the frontend, so
we're passing it here as a function attribute. Clang will be updated to use
this mechanism.

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

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

7 years ago[Support] Fix a warning introduced in r280339 due to the member
Chandler Carruth [Thu, 1 Sep 2016 09:31:02 +0000 (09:31 +0000)]
[Support] Fix a warning introduced in r280339 due to the member
initializers not being in the same order as the members.

Specifically, 'preg' is the first member followed by 'error', so they
will be initialized in that order and should be written in the member
initializer list in that order.

For the constructor in question, there is no change in behavior.

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

7 years ago[SimplifyCFG] Fix nondeterministic iteration order
James Molloy [Thu, 1 Sep 2016 09:01:34 +0000 (09:01 +0000)]
[SimplifyCFG] Fix nondeterministic iteration order

We iterate over the result from SafeToMergeTerminators, so make it a SmallSetVector instead of a SmallPtrSet.

Should fix stage3 convergence builds.

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

7 years agoCommit of forgotten header for r280339 "[LLVM/Support] - Create no-arguments construc...
George Rimar [Thu, 1 Sep 2016 08:02:20 +0000 (08:02 +0000)]
Commit of forgotten header for r280339 "[LLVM/Support] - Create no-arguments constructor for llvm::Regex"

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

7 years ago[LLVM/Support] - Create no-arguments constructor for llvm::Regex
George Rimar [Thu, 1 Sep 2016 08:00:28 +0000 (08:00 +0000)]
[LLVM/Support] - Create no-arguments constructor for llvm::Regex

This is useful when need to defer the construction,
e.g. using Regex as a member of class.

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

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

7 years ago[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases
James Molloy [Thu, 1 Sep 2016 07:45:25 +0000 (07:45 +0000)]
[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases

A very important case is not handled here: multiple arcs to a single block with a PHI. Consider:

    a:
      %1 = icmp %b, 1
      br %1, label %c, label %e
    c:
      %2 = icmp %b, 2
      br %2, label %d, label %e
    d:
      br %e
    e:
      phi [0, %a], [1, %c], [2, %d]

FoldValueComparisonIntoPredecessors will refuse to fold this, as it doesn't know how to deal with two arcs to a common destination with different PHI values. The answer is obvious - just split all conflicting arcs.

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

7 years ago[NFC] Remove unnecessary comment
Dean Michael Berris [Thu, 1 Sep 2016 01:58:24 +0000 (01:58 +0000)]
[NFC] Remove unnecessary comment

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

7 years ago[XRay] Detect and emit sleds for sibling/tail calls
Dean Michael Berris [Thu, 1 Sep 2016 01:29:13 +0000 (01:29 +0000)]
[XRay] Detect and emit sleds for sibling/tail calls

Summary:
This change promotes the 'isTailCall(...)' member function to
TargetInstrInfo as a query interface for determining on a per-target
basis whether a given MachineInstr is a tail call instruction. We build
upon this in the XRay instrumentation pass to emit special sleds for
tail call optimisations, where we emit the correct kind of sled.

The tail call sleds look like a mix between the function entry and
function exit sleds. Form-wise, the sled comes before the "jmp"
instruction that implements the tail call similar to how we do it for
the function entry sled. Functionally, because we know this is a tail
call, it behaves much like an exit sled -- i.e. at runtime we may use
the exit trampolines instead of a different kind of trampoline.

A follow-up change to recognise these sleds will be done in compiler-rt,
so that we can start intercepting these initially as exits, but also
have the option to have different log entries to more accurately reflect
that this is actually a tail call.

Reviewers: echristo, rSerge, majnemer

Subscribers: mehdi_amini, dberris, llvm-commits

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

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

7 years ago[libFuzzer] add -minimize_crash flag (to minimize crashers). also add two tests that...
Kostya Serebryany [Thu, 1 Sep 2016 01:22:27 +0000 (01:22 +0000)]
[libFuzzer] add -minimize_crash flag (to minimize crashers). also add two tests that I failed to commit last time

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

7 years ago[XRay][NFC] Promote isTailCall() as virtual in TargetInstrInfo.
Dean Michael Berris [Thu, 1 Sep 2016 01:03:22 +0000 (01:03 +0000)]
[XRay][NFC] Promote isTailCall() as virtual in TargetInstrInfo.

This change is broken out from D23986, where XRay detects tail call
exits.

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

7 years agoRevert "Add asm.js-style setjmp/longjmp handling for wasm"
Heejin Ahn [Thu, 1 Sep 2016 00:44:37 +0000 (00:44 +0000)]
Revert "Add asm.js-style setjmp/longjmp handling for wasm"

This reverts commit r280302, it broke the integration tests.

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

7 years agoSupport: Avoid errors with LLVM_FALLTHROUGH in clang 3.6 and below in C mode
Justin Bogner [Wed, 31 Aug 2016 23:43:14 +0000 (23:43 +0000)]
Support: Avoid errors with LLVM_FALLTHROUGH in clang 3.6 and below in C mode

Older versions of clang defined __has_cpp_attribute in C mode, but
would choke on scoped attributes, as per llvm.org/PR23435. Since we
support building with clang all the way back to 3.1, we have to work
around this issue.

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

7 years agoAdd cast to appease windows builder. Fixes build break introduced in r280306.
Nick Lewycky [Wed, 31 Aug 2016 23:24:43 +0000 (23:24 +0000)]
Add cast to appease windows builder. Fixes build break introduced in r280306.

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

7 years ago[codeview] Have visitTypeBegin return the record type.
Zachary Turner [Wed, 31 Aug 2016 23:14:31 +0000 (23:14 +0000)]
[codeview] Have visitTypeBegin return the record type.

Previously we were assuming that any visitation of types would
necessarily be against a type we had binary data for.  Reasonable
assumption when were just reading PDBs and dumping them, but once
we start writing PDBs from Yaml this breaks down, because we have
no binary data yet, only Yaml, and from that we need to read the
record kind and perform the switch based on that.

So this patch does that.  Instead of having the visitor switch
on the kind that is already in the CVType record, we change the
visitTypeBegin() method to return the Kind, and switch on the
returned value.  This way, the default implementation can still
return the value from the CVType, but the implementation which
visits Yaml records and serializes binary PDB type records can
use the field in the Yaml as the source of the switch.

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

7 years agoAdd -fprofile-dir= to clang.
Nick Lewycky [Wed, 31 Aug 2016 23:04:32 +0000 (23:04 +0000)]
Add -fprofile-dir= to clang.

-fprofile-dir=path allows the user to specify where .gcda files should be
emitted when the program is run. In particular, this is the first flag that
causes the .gcno and .o files to have different paths, LLVM is extended to
support this. -fprofile-dir= does not change the file name in the .gcno (and
thus where lcov looks for the source) but it does change the name in the .gcda
(and thus where the runtime library writes the .gcda file). It's different from
a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip
paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and
-coverage-notes-file to specify the two different names. The !llvm.gcov
metadata node grows from a 2-element form {string coverage-file, node dbg.cu}
to 3-elements, {string coverage-notes-file, string coverage-data-file, node
dbg.cu}. In the 3-element form, the file name is already "mangled" with
.gcno/.gcda suffixes, while the 2-element form left that to the middle end
pass.

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

7 years agoFix the MSVC 2013 build by using Elf_Word instead of making a local typedef
Reid Kleckner [Wed, 31 Aug 2016 22:45:36 +0000 (22:45 +0000)]
Fix the MSVC 2013 build by using Elf_Word instead of making a local typedef

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

7 years ago[CMake] Increase stack size to 16MiB for all mingw executables.
NAKAMURA Takumi [Wed, 31 Aug 2016 22:43:23 +0000 (22:43 +0000)]
[CMake] Increase stack size to 16MiB for all mingw executables.

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

7 years agoAdd asm.js-style setjmp/longjmp handling for wasm
Heejin Ahn [Wed, 31 Aug 2016 22:40:34 +0000 (22:40 +0000)]
Add asm.js-style setjmp/longjmp handling for wasm

Summary: This patch adds asm.js-style setjmp/longjmp handling support for WebAssembly. It also uses JavaScript's try and catch mechanism.

Reviewers: jpp, dschuff

Subscribers: jfb, dschuff

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

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

7 years agoRevert "Add an optional parameter with a list of undefs to extendToIndices"
Reid Kleckner [Wed, 31 Aug 2016 22:36:02 +0000 (22:36 +0000)]
Revert "Add an optional parameter with a list of undefs to extendToIndices"

This reverts commit r280268, it causes all MSVC 2013 to ICE. This
appears to have been fixed in a later MSVC 2013 update, because I cannot
reproduce it locally. That said, all upstream LLVM bots are broken right
now, so I am reverting.

Also reverts dependent change r280275, "[Hexagon] Deal with undefs when
extending live intervals".

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

7 years ago[InstCombine] allow icmp (shr exact X, C2), C fold for splat constant vectors
Sanjay Patel [Wed, 31 Aug 2016 22:18:43 +0000 (22:18 +0000)]
[InstCombine] allow icmp (shr exact X, C2), C fold for splat constant vectors

The enhancement to foldICmpDivConstant ( http://llvm.org/viewvc/llvm-project?view=revision&revision=280299 )
allows us to remove the ConstantInt check; no other changes needed.

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

7 years ago[InstCombine] allow icmp (div X, Y), C folds for splat constant vectors
Sanjay Patel [Wed, 31 Aug 2016 21:57:21 +0000 (21:57 +0000)]
[InstCombine] allow icmp (div X, Y), C folds for splat constant vectors

Converting all of the overflow ops to APInt looked risky, so I've left that as a TODO.

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

7 years agoAMDGPU: Fix introducing stack access on unaligned v16i8
Matt Arsenault [Wed, 31 Aug 2016 21:52:27 +0000 (21:52 +0000)]
AMDGPU: Fix introducing stack access on unaligned v16i8

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

7 years agoAMDGPU: Use copy instead of mov during frame lowering
Matt Arsenault [Wed, 31 Aug 2016 21:52:25 +0000 (21:52 +0000)]
AMDGPU: Use copy instead of mov during frame lowering

This occurs before RA pseudos are expanded. It's less
code to emit the copy.

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

7 years agoAMDGPU: Refactor frame lowering
Matt Arsenault [Wed, 31 Aug 2016 21:52:21 +0000 (21:52 +0000)]
AMDGPU: Refactor frame lowering

This will make future changes easier.

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

7 years ago[codeview] Add TypeVisitorCallbackPipeline.
Zachary Turner [Wed, 31 Aug 2016 21:42:26 +0000 (21:42 +0000)]
[codeview] Add TypeVisitorCallbackPipeline.

We were kind of hacking this together before by embedding the
ability to forward requests into the TypeDeserializer.  When
we want to start adding more different kinds of visitor callback
interfaces though, this doesn't scale well and is very inflexible.

So introduce the notion of a pipeline, which itself implements
the TypeVisitorCallbacks interface, but which contains an internal
list of other callbacks to invoke in sequence.

Also update the existing uses of CVTypeVisitor to use this new
pipeline class for deserializing records before visiting them
with another visitor.

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

7 years agoGlobalISel: use G_TYPE to annotate physregs with a type.
Tim Northover [Wed, 31 Aug 2016 21:24:02 +0000 (21:24 +0000)]
GlobalISel: use G_TYPE to annotate physregs with a type.

More preparation for dropping source types from MachineInstrs: regsters coming
out of already-selected code (i.e. non-generic instructions) don't have a type,
but that information is needed so we must add it manually.

This is done via a new G_TYPE instruction.

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

7 years ago[WebAssembly] Disable folding of GA+reg into load/store constant offsets
Derek Schuff [Wed, 31 Aug 2016 20:27:20 +0000 (20:27 +0000)]
[WebAssembly] Disable folding of GA+reg into load/store constant offsets

Summary:
If the register has a negative value then unsigned overflow will occur;
this case is sometimes even created intentionally by LSR. For now
disable GA+reg folding. Fixes PR29127

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

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

7 years ago[InstCombine] change insertRangeTest() to use APInt instead of Constant; NFCI
Sanjay Patel [Wed, 31 Aug 2016 19:49:56 +0000 (19:49 +0000)]
[InstCombine] change insertRangeTest() to use APInt instead of Constant; NFCI

This is prep work before changing the callers to also use APInt which will
allow folds for splat vectors. Currently, the callers have ConstantInt
guards in place, so no functional change intended with this commit.

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

7 years ago[LoopInfo] Add verification by recomputation.
Michael Zolotukhin [Wed, 31 Aug 2016 19:26:19 +0000 (19:26 +0000)]
[LoopInfo] Add verification by recomputation.

Summary:
Current implementation of LI verifier isn't ideal and fails to detect
some cases when LI is incorrect. For instance, it checks that all
recorded loops are in a correct form, but it has no way to check if
there are no more other (unrecorded in LI) loops in the function. This
patch adds a way to detect such bugs.

Reviewers: chandlerc, sanjoy, hfinkel

Subscribers: llvm-commits, silvas, mzolotukhin

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

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

7 years ago[EarlyCSE] Optionally use MemorySSA. NFC.
Geoff Berry [Wed, 31 Aug 2016 19:24:10 +0000 (19:24 +0000)]
[EarlyCSE] Optionally use MemorySSA. NFC.

Summary:
Use MemorySSA, if requested, to do less conservative memory dependency
checking.

This change doesn't enable the MemorySSA enhanced EarlyCSE in the
default pipelines, so should be NFC.

Reviewers: dberlin, sanjoy, reames, majnemer

Subscribers: mcrosier, llvm-commits

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

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

7 years agoActually check for the diagnostic to be emitted!
Quentin Colombet [Wed, 31 Aug 2016 18:53:32 +0000 (18:53 +0000)]
Actually check for the diagnostic to be emitted!

This makes the test case in r280273 actually useful!

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

7 years ago[Hexagon] Deal with undefs when extending live intervals
Krzysztof Parzyszek [Wed, 31 Aug 2016 18:52:09 +0000 (18:52 +0000)]
[Hexagon] Deal with undefs when extending live intervals

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

7 years agoAMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned
Tom Stellard [Wed, 31 Aug 2016 18:46:07 +0000 (18:46 +0000)]
AMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned

Summary: This fixes some OpenCV tests that were broken by libclc commit r276443.

Reviewers: arsenm, jvesely

Subscribers: arsenm, wdng, llvm-commits

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

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

7 years ago[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.
Quentin Colombet [Wed, 31 Aug 2016 18:43:04 +0000 (18:43 +0000)]
[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.

Thanks to this patch, we know have a way to easly see if GlobalISel
failed.

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

7 years ago[ResetMachineFunction] Emit the diagnostic isel fallback when asked.
Quentin Colombet [Wed, 31 Aug 2016 18:43:01 +0000 (18:43 +0000)]
[ResetMachineFunction] Emit the diagnostic isel fallback when asked.

This pass is now able to report when the function is being reset.

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

7 years ago[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.
Quentin Colombet [Wed, 31 Aug 2016 18:42:55 +0000 (18:42 +0000)]
[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.

This will be used to warm when we fallback in GlobalISel.

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

7 years agoFix indent. NFC.
Chad Rosier [Wed, 31 Aug 2016 18:37:52 +0000 (18:37 +0000)]
Fix indent. NFC.

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

7 years agoAdd an optional parameter with a list of undefs to extendToIndices
Krzysztof Parzyszek [Wed, 31 Aug 2016 18:02:19 +0000 (18:02 +0000)]
Add an optional parameter with a list of undefs to extendToIndices

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

7 years agoNext set of additional error checks for invalid Mach-O files for bad load commands
Kevin Enderby [Wed, 31 Aug 2016 17:57:46 +0000 (17:57 +0000)]
Next set of additional error checks for invalid Mach-O files for bad load commands
that use the Mach::linkedit_data_command type for the load commands that are
currently used in the MachOObjectFile constructor.

This contains the missing checks for LC_DATA_IN_CODE and
LC_LINKER_OPTIMIZATION_HINT load commands and the fields for the
Mach::linkedit_data_command type.  Checking for other load commands that
use this type will be added later.

Also fixed a couple of places that was using sizeof(MachOObjectFile::LoadCommandInfo)
that should have been using sizeof(MachO::load_command).

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

7 years ago[EarlyCSE] Allow forwarding a non-invariant load into an invariant load.
Geoff Berry [Wed, 31 Aug 2016 17:45:31 +0000 (17:45 +0000)]
[EarlyCSE] Allow forwarding a non-invariant load into an invariant load.

Reviewers: sanjoy

Subscribers: mcrosier, llvm-commits

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

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

7 years ago[SLP] Update the debug based on Michael's suggestion.
Chad Rosier [Wed, 31 Aug 2016 17:41:12 +0000 (17:41 +0000)]
[SLP] Update the debug based on Michael's suggestion.

Passing the types/opcode check still doesn't guarantee we'll actually vectorize.
Therefore, just make it clear we're attempting to vectorize.

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

7 years ago[LangRef] Clarify !invariant.load semantics.
Geoff Berry [Wed, 31 Aug 2016 17:39:21 +0000 (17:39 +0000)]
[LangRef] Clarify !invariant.load semantics.

Based on discussion on llvm-dev.

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

7 years ago[SLP] Sink debug after checking for matching types/opcode.
Chad Rosier [Wed, 31 Aug 2016 17:31:09 +0000 (17:31 +0000)]
[SLP] Sink debug after checking for matching types/opcode.

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

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

7 years ago[lib/LTO] Factor out logic for running passes.
Davide Italiano [Wed, 31 Aug 2016 17:02:44 +0000 (17:02 +0000)]
[lib/LTO] Factor out logic for running passes.

This is in preparation for adding an option
to run a custom pipeline with the new PM. It's
currently used in lld.

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

7 years agos/static inline/static/ for headers I have changed in r279475. NFC.
Tim Shen [Wed, 31 Aug 2016 16:48:13 +0000 (16:48 +0000)]
s/static inline/static/ for headers I have changed in r279475. NFC.

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

7 years ago[LTO] Fix common test to reflect r279911 and move to X86 subdirectory
Teresa Johnson [Wed, 31 Aug 2016 16:15:39 +0000 (16:15 +0000)]
[LTO] Fix common test to reflect r279911 and move to X86 subdirectory

Adjust the test to reflect the changes to common handling in r279911.
This test wasn't running due to an incorrect REQUIRES and thus missed
being modified for r279911 before. It was changed to XFAIL when the
bad REQUIRES was discovered.

Remove the XFAIL and move to a new X86 subdirectory that will properly
disable on non-X86.

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

7 years ago[codeview] Emit vtable shape information
Reid Kleckner [Wed, 31 Aug 2016 15:59:30 +0000 (15:59 +0000)]
[codeview] Emit vtable shape information

The shape of the vtable is passed down as the size of the
__vtbl_ptr_type. This special pointer type appears both as the pointee
type of the vptr type, and by itself in every dynamic class. For classes
with multiple vtables, only the shape of the primary vftable is
included, as the shape of all secondary vftables will be the same as in
the base class.

Fixes PR28150

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

7 years ago[statepoints][experimental] Add support for live-in semantics of values in deopt...
Philip Reames [Wed, 31 Aug 2016 15:12:17 +0000 (15:12 +0000)]
[statepoints][experimental] Add support for live-in semantics of values in deopt bundles

This is a first step towards supporting deopt value lowering and reporting entirely with the register allocator. I hope to build on this in the near future to support live-on-return semantics, but I have a use case which allows me to test and investigate code quality with just the live-in semantics so I've chosen to start there. For those curious, my use cases is our implementation of the "__llvm_deoptimize" function we bind to @llvm.deoptimize. I'm choosing not to hard code that fact in the patch and instead make it configurable via function attributes.

The basic approach here is modelled on what is done for the "Live In" values on stackmaps and patchpoints. (A secondary goal here is to remove one of the last barriers to merging the pseudo instructions.) We start by adding the operands directly to the STATEPOINT SDNode. Once we've lowered to MI, we extend the remat logic used by the register allocator to fold virtual register uses into StackMap::Indirect entries as needed. This does rely on the fact that the register allocator rematerializes. If it didn't along some code path, we could end up with more vregs than physical registers and fail to allocate.

Today, we *only* fold in the register allocator. This can create some weird effects when combined with arguments passed on the stack because we don't fold them appropriately. I have an idea how to fix that, but it needs this patch in place to work on that effectively. (There's some weird interaction with the scheduler as well, more investigation needed.)

My near term plan is to land this patch off-by-default, experiment in my local tree to identify any correctness issues and then start fixing codegen problems one by one as I find them. Once I have the live-in lowering fully working (both correctness and code quality), I'm hoping to move on to the live-on-return semantics. Note: I don't have any *known* miscompiles with this patch enabled, but I'm pretty sure I'll find at least a couple. Thus, the "experimental" tag and the fact it's off by default.

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

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

7 years ago[X86][SSE] Improve awareness of (v)cvtpd2ps implicit zeroing of upper 64-bits of...
Simon Pilgrim [Wed, 31 Aug 2016 15:09:34 +0000 (15:09 +0000)]
[X86][SSE] Improve awareness of (v)cvtpd2ps implicit zeroing of upper 64-bits of xmm result

Associate x86_sse2_cvtpd2ps with X86ISD::VFPROUND to avoid inserting unnecessary zeroing shuffles.

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

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

7 years ago[SLP] Arguments should be camel case, and start with an upper case letter. NFC.
Chad Rosier [Wed, 31 Aug 2016 15:06:58 +0000 (15:06 +0000)]
[SLP] Arguments should be camel case, and start with an upper case letter. NFC.

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

7 years agoChanging a code block to text because Sphinx does not like it on the builder (http...
Aaron Ballman [Wed, 31 Aug 2016 14:37:20 +0000 (14:37 +0000)]
Changing a code block to text because Sphinx does not like it on the builder (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12517/steps/docs-llvm-html/logs/stdio)

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

7 years agoClang patch r280064 introduced ways to set the FP exceptions and denormal
Sjoerd Meijer [Wed, 31 Aug 2016 14:17:38 +0000 (14:17 +0000)]
Clang patch r280064 introduced ways to set the FP exceptions and denormal
types. This is the LLVM counterpart and it adds options that map onto FP
exceptions and denormal build attributes allowing better fp math library
selections.

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

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

7 years agoFixed spill stack objects are mutable
Krzysztof Parzyszek [Wed, 31 Aug 2016 13:52:17 +0000 (13:52 +0000)]
Fixed spill stack objects are mutable

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

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

7 years agoFix comments about IndirectBrInst in Instructions.h
Chad Rosier [Wed, 31 Aug 2016 13:39:34 +0000 (13:39 +0000)]
Fix comments about IndirectBrInst in Instructions.h

Patch by yo (Chiang, Yi-Yo) <yo@skymizer.com>.
Differential Revision: https://reviews.llvm.org/D23982

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

7 years agoRevert "[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more...
James Molloy [Wed, 31 Aug 2016 13:32:28 +0000 (13:32 +0000)]
Revert "[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases"

This reverts commit r280218. This *also* causes buildbot errors. Sigh. Not a successful day all around!

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

7 years agoChanging a code block to text because Sphinx does not like it on the builder (http...
Aaron Ballman [Wed, 31 Aug 2016 13:29:23 +0000 (13:29 +0000)]
Changing a code block to text because Sphinx does not like it on the builder (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/12516/steps/docs-llvm-html/logs/stdio)

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

7 years agoRevert "[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd"
James Molloy [Wed, 31 Aug 2016 13:16:52 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd"

This reverts commit r280216 - it caused buildbot failures.

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

7 years agoRevert "[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches"
James Molloy [Wed, 31 Aug 2016 13:16:45 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches"

This reverts commit r280217. r280216 caused buildbot failures - backing out the entire chain.

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

7 years agoRevert "[SimplifyCFG] Add a workaround to fix PR30188"
James Molloy [Wed, 31 Aug 2016 13:16:36 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Add a workaround to fix PR30188"

This reverts commit r280219. r280216 caused buildbot failures - backing out the entire chain.

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

7 years agoRevert "[SimplifyCFG] Fix bootstrap failure after r280220"
James Molloy [Wed, 31 Aug 2016 13:16:30 +0000 (13:16 +0000)]
Revert "[SimplifyCFG] Fix bootstrap failure after r280220"

This reverts commit r280228. r280216 caused buildbot failures - backing out the entire sequence.

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

7 years agoUse abstraction in AArch64AsmPrinter::lowerSTACKMAP. NFCI
Diana Picus [Wed, 31 Aug 2016 12:43:49 +0000 (12:43 +0000)]
Use abstraction in AArch64AsmPrinter::lowerSTACKMAP. NFCI

Use functionality from StackMapOpers instead of hardcoding an operand access.

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

7 years agoTypo fixes. NFC
Diana Picus [Wed, 31 Aug 2016 12:43:44 +0000 (12:43 +0000)]
Typo fixes. NFC

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

7 years ago[SimplifyCFG] Fix bootstrap failure after r280220
James Molloy [Wed, 31 Aug 2016 12:33:48 +0000 (12:33 +0000)]
[SimplifyCFG] Fix bootstrap failure after r280220

We check that a sinking candidate is used by only one PHI node during our legality checks. However for instructions that are used by other sinking candidates our heuristic is less conservative. This can result in a candidate actually being illegal when we come to sink it because of how we sunk a predecessor. Do the used-by-only-one-PHI checks again during sinking to ensure we don't crash.

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

7 years agoAMDGPU/SI: Handle aliases in AMDGPUAlwaysInlinePass
Nikolay Haustov [Wed, 31 Aug 2016 11:18:33 +0000 (11:18 +0000)]
AMDGPU/SI: Handle aliases in AMDGPUAlwaysInlinePass

Summary:
Simply replace usage of aliases to functions with aliasee.
This came up when bitcode linking to builtin library and
calls to aliases not being resolved.

Also made minor improvements to existing test.

Reviewers: tstellarAMD, alex-t, vpykhtin

Subscribers: arsenm, wdng, rampitec

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

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

7 years ago[SimplifyCFG] Add a workaround to fix PR30188
James Molloy [Wed, 31 Aug 2016 10:46:45 +0000 (10:46 +0000)]
[SimplifyCFG] Add a workaround to fix PR30188

We're sinking stores, which is a good thing, but in the process creating selects for the store address operand, which SROA/Mem2Reg can't look through, which caused serious regressions.

The real fix is in SROA, which I'll be looking into.

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

7 years ago[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases
James Molloy [Wed, 31 Aug 2016 10:46:39 +0000 (10:46 +0000)]
[SimplifyCFG] Improve FoldValueComparisonIntoPredecessors to handle more cases

A very important case is not handled here: multiple arcs to a single block with a PHI. Consider:

    a:
      %1 = icmp %b, 1
      br %1, label %c, label %e
    c:
      %2 = icmp %b, 2
      br %2, label %d, label %e
    d:
      br %e
    e:
      phi [0, %a], [1, %c], [2, %d]

FoldValueComparisonIntoPredecessors will refuse to fold this, as it doesn't know how to deal with two arcs to a common destination with different PHI values. The answer is obvious - just split all conflicting arcs.

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

7 years ago[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches
James Molloy [Wed, 31 Aug 2016 10:46:33 +0000 (10:46 +0000)]
[SimplifyCFG] Handle tail-sinking of more than 2 incoming branches

This was a real restriction in the original version of SinkIfThenCodeToEnd. Now it's been rewritten, the restriction can be lifted.

As part of this, we handle a very common and useful case where one of the incoming branches is actually conditional. Consider:

   if (a)
     x(1);
   else if (b)
     x(2);

This produces the following CFG:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \    |  /
          [ end ]

[end] has two unconditional predecessor arcs and one conditional. The conditional refers to the implicit empty 'else' arc. This same pattern can also be caused by an empty default block in a switch.

We can't sink the call to x() down to end because no call to x() happens on the third incoming arc (assume that x() has sideeffects for the sake of argument; if something is safe to speculate we could indeed sink nevertheless but this cannot happen in the general case and causes many extra selects).

We are now able to detect this case and split off the unconditional arcs to a common successor:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \   /    |
     [sink.split] |
           \     /
           [ end ]

Now we can sink the call to x() into %sink.split. This can cause significant code simplification in many testcases.

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

7 years ago[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd
James Molloy [Wed, 31 Aug 2016 10:46:23 +0000 (10:46 +0000)]
[SimplifyCFG] Change the algorithm in SinkThenElseCodeToEnd

r279460 rewrote this function to be able to handle more than two incoming edges and took pains to ensure this didn't regress anything.

This time we change the logic for determining if an instruction should be sunk. Previously we used a single pass greedy algorithm - sink instructions until one requires more than one PHI node or we run out of instructions to sink.

This had the problem that sinking instructions that had non-identical but trivially the same operands needed extra logic so we sunk them aggressively. For example:

    %a = load i32* %b          %d = load i32* %b
    %c = gep i32* %a, i32 0    %e = gep i32* %d, i32 1

Sinking %c and %e would naively require two PHI merges as %a != %d. But the loads are obviously equivalent (and maybe can't be hoisted because there is no common predecessor).

This is why we implemented the fairly complex function areValuesTriviallySame(), to look through trivial differences like this. However it's just not clever enough.

Instead, throw areValuesTriviallySame away, use pointer equality to check equivalence of operands and switch to a two-stage algorithm.

In the "scan" stage, we look at every sinkable instruction in isolation from end of block to front. If it's sinkable, we keep track of all operands that required PHI merging.

In the "sink" stage, we iteratively sink the last non-terminator in the source blocks. But when calculating how many PHIs are actually required to be inserted (to work out if we should stop or not) we remove any values that have already been sunk from the set of PHI-merges required, which allows us to be more aggressive.

This turns an algorithm with potentially recursive lookahead (looking through GEPs, casts, loads and any other instruction potentially not CSE'd) to two linear scans.

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

7 years ago[SimplifyCFG] Tail-merge calls with sideeffects
James Molloy [Wed, 31 Aug 2016 10:46:16 +0000 (10:46 +0000)]
[SimplifyCFG] Tail-merge calls with sideeffects

This was deliberately disabled during my rewrite of SinkIfThenToEnd to keep behaviour
at least vaguely consistent with the previous version and keep it as close to NFC as
I could.

There's no real reason not to merge sideeffect calls though, so let's do it! Small fixup
along the way to ensure we don't create indirect calls.

Should fix PR28964.

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

7 years ago[X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm...
Simon Pilgrim [Wed, 31 Aug 2016 10:35:13 +0000 (10:35 +0000)]
[X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm result

Add patterns to avoid inserting unnecessary zeroing shuffles when lowering fptrunc to (v)cvtpd2ps

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

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

7 years ago[Coverage] Make sorting criteria for CounterMappingRegions local.
Igor Kudrin [Wed, 31 Aug 2016 07:01:17 +0000 (07:01 +0000)]
[Coverage] Make sorting criteria for CounterMappingRegions local.

Move the comparison function into the only place there it is used,
i.e. the call to std::stable_sort in CoverageMappingWriter::write().

Add sorting by region kinds as it is required to ensure stable order
in our tests and to simplify D23987.

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

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

7 years ago[AVX-512] Add patterns to select masked logical operations if the select has a floati...
Craig Topper [Wed, 31 Aug 2016 05:37:52 +0000 (05:37 +0000)]
[AVX-512] Add patterns to select masked logical operations if the select has a floating point type.

This is needed in order to replace the masked floating point logical op intrinsics with native IR.

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

7 years ago[AVX-512] Add test cases for masked floating point logic operations with bitcasts...
Craig Topper [Wed, 31 Aug 2016 05:37:50 +0000 (05:37 +0000)]
[AVX-512] Add test cases for masked floating point logic operations with bitcasts between the logic ops and the select. We don't currently select masked operations for these cases.

Test cases taken from optimized clang output after trying to convert the masked floating point logical op intrinsics to native IR.

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

7 years ago[X86] Regenerate a test using update_llc_test_checks.py.
Craig Topper [Wed, 31 Aug 2016 05:37:47 +0000 (05:37 +0000)]
[X86] Regenerate a test using update_llc_test_checks.py.

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

7 years ago[XRay] Support multiple return instructions in a single basic block
Dean Michael Berris [Wed, 31 Aug 2016 05:20:08 +0000 (05:20 +0000)]
[XRay] Support multiple return instructions in a single basic block

Add a .mir test to catch this case, and fix the xray-instrumentation
pass to handle it appropriately.

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

7 years ago[Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer
David Majnemer [Wed, 31 Aug 2016 03:22:32 +0000 (03:22 +0000)]
[Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer

There were paths where we wouldn't populate the visited set, causing us
to recurse forever if an SSA variable was defined in terms of itself.

This fixes PR30210.

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

7 years ago[PowerPC] Don't spill the frame pointer twice
Hal Finkel [Wed, 31 Aug 2016 00:52:03 +0000 (00:52 +0000)]
[PowerPC] Don't spill the frame pointer twice

When a function contains something, such as inline asm, which explicitly
clobbers the register used as the frame pointer, don't spill it twice. If we
need a frame pointer, it will be saved/restored in the prologue/epilogue code.
Explicitly spilling it again will reuse the same spill slot used by the
prologue/epilogue code, thus clobbering the saved value. The same applies
to the base-pointer or PIC-base register.

Partially fixes PR26856. Thanks to Ulrich for his analysis and the small
inline-asm reproducer.

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

7 years ago[Coroutines] Part 10: Add coroutine promise support.
Gor Nishanov [Wed, 31 Aug 2016 00:35:41 +0000 (00:35 +0000)]
[Coroutines] Part 10: Add coroutine promise support.

Summary:
1) CoroEarly now lowers llvm.coro.promise intrinsic that allows to obtain
a coroutine promise pointer from a coroutine frame and vice versa.

2) CoroFrame now interprets Promise argument of llvm.coro.begin to
place CoroutinPromise alloca at a deterministic offset from the coroutine frame.

Now, the coroutine promise example from docs\Coroutines.rst compiles and produces expected result (see test/Transform/Coroutines/ex4.ll).

Reviewers: majnemer

Subscribers: llvm-commits, mehdi_amini

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

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