OSDN Git Service

android-x86/external-llvm.git
7 years agoSwitch the default for building GlobalISel.
Quentin Colombet [Thu, 26 Jan 2017 23:53:31 +0000 (23:53 +0000)]
Switch the default for building GlobalISel.

Now, GlobalISel will be built by default. To turn that off, one has to
use -DLLVM_BUILD_GLOBAL_ISEL=OFF on the cmake command line.

<rdar://problem/30004433>

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

7 years agoCMake is funky on detecting Intel 17 as GCC compatible.
Yichao Yu [Thu, 26 Jan 2017 23:50:18 +0000 (23:50 +0000)]
CMake is funky on detecting Intel 17 as GCC compatible.

Summary: This adds a fallback in case that the Intel compiler is failed to be detected correctly.

Reviewers: chapuni

Reviewed By: chapuni

Subscribers: llvm-commits, mgorny

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

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

7 years ago[ARM] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 26 Jan 2017 23:40:06 +0000 (23:40 +0000)]
[ARM] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoGlobalISel: support debug intrinsics.
Tim Northover [Thu, 26 Jan 2017 23:39:14 +0000 (23:39 +0000)]
GlobalISel: support debug intrinsics.

The translation scheme is mostly cribbed from FastISel, and it's not entirely
convincing semantically. But it does seem to work in the common cases and allow
variables to be printed so it can't be all wrong.

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

7 years agoRevert a couple of InstCombine/Guard checkins
Sanjoy Das [Thu, 26 Jan 2017 23:38:11 +0000 (23:38 +0000)]
Revert a couple of InstCombine/Guard checkins

This change reverts:

r293061: "[InstCombine] Canonicalize guards for NOT OR condition"
r293058: "[InstCombine] Canonicalize guards for AND condition"

They miscompile cases like:

```
declare void @llvm.experimental.guard(i1, ...)

define void @test_guard_not_or(i1 %A, i1 %B) {
  %C = or i1 %A, %B
  %D = xor i1 %C, true
  call void(i1, ...) @llvm.experimental.guard(i1 %D, i32 20, i32 30)[ "deopt"() ]
  ret void
}
```

because they do transfer the `i32 20, i32 30` parameters to newly
created guard instructions.

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

7 years agoAdd intrinsics for constrained floating point operations
Andrew Kaylor [Thu, 26 Jan 2017 23:27:59 +0000 (23:27 +0000)]
Add intrinsics for constrained floating point operations

This commit introduces a set of experimental intrinsics intended to prevent
optimizations that make assumptions about the rounding mode and floating point
exception behavior.  These intrinsics will later be extended to specify
flush-to-zero behavior.  More work is also required to model instruction
dependencies in machine code and to generate these instructions from clang
(when required by pragmas and/or command line options that are not currently
supported).

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

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

7 years ago[PM] Enable the main loop pass pipelines with everything but
Chandler Carruth [Thu, 26 Jan 2017 23:21:17 +0000 (23:21 +0000)]
[PM] Enable the main loop pass pipelines with everything but
loop-unswitch in the main pipelines for the new PM.

All of these now work, and Clang built using this pipeline can build the
test suite and SPEC without hitting any asserts of ASan failures.

There are still some bugs hiding though -- 7 tests regress with the new
PM. I'm going to be investigating these, but it seems worthwhile to at
least get the pipelines in place so that others can play with them, and
they aren't completely broken.

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

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

7 years ago[obj2yaml] Produce correct output for invalid relocations.
Davide Italiano [Thu, 26 Jan 2017 23:12:53 +0000 (23:12 +0000)]
[obj2yaml] Produce correct output for invalid relocations.

R_X86_64_NONE can be emitted without a symbol associated (well,
in theory it should never be emitted in an ABI-compliant relocatable
object). So, if there's no symbol associated to a reloc, emit one
with an empty name, instead of crashing.

Ack'ed by Michael Spencer offline.

PR: 31768

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

7 years ago[Hexagon] Require IPO library in Hexagon build
Krzysztof Parzyszek [Thu, 26 Jan 2017 23:03:22 +0000 (23:03 +0000)]
[Hexagon] Require IPO library in Hexagon build

This should unbreak the Hexagon build bots.

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

7 years agoNewGVN: Fix bug exposed by PR31761
Daniel Berlin [Thu, 26 Jan 2017 22:21:48 +0000 (22:21 +0000)]
NewGVN: Fix bug exposed by PR31761

Summary:
This does not actually fix the testcase in PR31761 (discussion is
ongoing on the testcase), but does fix a bug it exposes, where stores
were not properly clobbering loads.

We accomplish this by unifying the memory equivalence infratructure
back into the normal congruence infrastructure, and then properly
destroying congruence classes when memory state leaders disappear.

Reviewers: davide

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] fold (X >>u C) << C --> X & (-1 << C)
Sanjay Patel [Thu, 26 Jan 2017 22:08:10 +0000 (22:08 +0000)]
[InstCombine] fold (X >>u C) << C --> X & (-1 << C)

We already have this fold when the lshr has one use, but it doesn't need that
restriction. We may be able to remove some code from foldShiftedShift().

Also, move the similar:
(X << C) >>u C --> X & (-1 >>u C)
...directly into visitLShr to help clean up foldShiftByConstOfShiftByConst().

That whole function seems questionable since it is called by commonShiftTransforms(),
but there's really not much in common if we're checking the shift opcodes for every
fold.

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

7 years ago[GlobalISel] Remove duplicate function using variadic templates. NFC.
Ahmed Bougacha [Thu, 26 Jan 2017 22:07:37 +0000 (22:07 +0000)]
[GlobalISel] Remove duplicate function using variadic templates. NFC.

I think the initial version of r293172 was trying:
  std::forward<Args...>(args)...
which doesn't compile.  This seems like the correct way:
  std::forward<Args>(args)...

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

7 years ago[Hexagon] Add Hexagon-specific loop idiom recognition pass
Krzysztof Parzyszek [Thu, 26 Jan 2017 21:41:10 +0000 (21:41 +0000)]
[Hexagon] Add Hexagon-specific loop idiom recognition pass

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

7 years agoNewGVN: Add algorithm overview
Daniel Berlin [Thu, 26 Jan 2017 21:39:49 +0000 (21:39 +0000)]
NewGVN: Add algorithm overview

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

7 years ago[InstCombine] use m_APInt to allow (X << C) >>u C --> X & (-1 >>u C) with splat vectors
Sanjay Patel [Thu, 26 Jan 2017 20:52:27 +0000 (20:52 +0000)]
[InstCombine] use m_APInt to allow (X << C) >>u C --> X & (-1 >>u C) with splat vectors

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

7 years ago[Doc][LangRef] Fix typo-ish error in description of Masked Gather
Zvi Rackover [Thu, 26 Jan 2017 20:29:15 +0000 (20:29 +0000)]
[Doc][LangRef] Fix typo-ish error in description of Masked Gather

Summary: Fix the example of equivalent expansion for when mask is all ones.

Reviewers: delena

Reviewed By: delena

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] add tests for shift-shift folds; NFC
Sanjay Patel [Thu, 26 Jan 2017 20:10:55 +0000 (20:10 +0000)]
[InstCombine] add tests for shift-shift folds; NFC

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

7 years ago[AArch64] Refine Kryo Machine Model
Balaram Makam [Thu, 26 Jan 2017 20:10:41 +0000 (20:10 +0000)]
[AArch64] Refine Kryo Machine Model

Summary: Refine floating point SQRT and DIV with accurate latency information.

Reviewers: mcrosier

Subscribers: aemerson, rengolin, llvm-commits

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

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

7 years ago[IfConversion] Use reverse_iterator to simplify. NFC
Kyle Butt [Thu, 26 Jan 2017 20:02:47 +0000 (20:02 +0000)]
[IfConversion] Use reverse_iterator to simplify. NFC

This simplifies skipping debug instructions and shrinking ranges.

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

7 years ago[PPC] cleanup of mayLoad/mayStore flags and memory operands.
Sean Fertile [Thu, 26 Jan 2017 18:59:15 +0000 (18:59 +0000)]
[PPC] cleanup of mayLoad/mayStore flags and memory operands.

1) Explicitly sets mayLoad/mayStore property in the tablegen files on load/store
   instructions.
2) Updated the flags on a number of intrinsics indicating that they write
    memory.
3) Added SDNPMemOperand flags for some target dependent SDNodes so that they
   propagate their memory operand

Review: https://reviews.llvm.org/D28818

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

7 years agoNewGVN: Fix output of pr31578 testcase now that we mark unreachable blocks as unreachable
Daniel Berlin [Thu, 26 Jan 2017 18:49:03 +0000 (18:49 +0000)]
NewGVN: Fix output of pr31578 testcase now that we mark unreachable blocks as unreachable

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

7 years agoNewGVN: Make unreachable blocks be marked with unreachable
Daniel Berlin [Thu, 26 Jan 2017 18:30:29 +0000 (18:30 +0000)]
NewGVN: Make unreachable blocks be marked with unreachable

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

7 years agoReplace addEarlyAsPossiblePasses callback with adjustPassManager
Stanislav Mekhanoshin [Thu, 26 Jan 2017 16:49:08 +0000 (16:49 +0000)]
Replace addEarlyAsPossiblePasses callback with adjustPassManager

This change introduces adjustPassManager target callback giving a
target an opportunity to tweak PassManagerBuilder before pass
managers are populated.

This generalizes and replaces addEarlyAsPossiblePasses target
callback. In particular that can be used to add custom passes to
extension points other than EP_EarlyAsPossible.

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

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

7 years agoRevert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is...
Nirav Dave [Thu, 26 Jan 2017 16:46:13 +0000 (16:46 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."

This reverts commit r293184 which is failing in LTO builds

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

7 years ago[XRay][Arm32] Reduce the portion of the stub and implement more staging for tail...
Serge Rogatch [Thu, 26 Jan 2017 16:17:03 +0000 (16:17 +0000)]
[XRay][Arm32] Reduce the portion of the stub and implement more staging for tail calls - in LLVM

Summary:
This patch provides more staging for tail calls in XRay Arm32 . When the logging part of XRay is ready for tail calls, its support in the core part of XRay Arm32 may be as easy as changing the number passed to the handler from 1 to 2.
Coupled patch:
- https://reviews.llvm.org/D28674

Reviewers: dberris, rengolin

Reviewed By: dberris

Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris

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

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

7 years agoIn visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Nirav Dave [Thu, 26 Jan 2017 16:02:24 +0000 (16:02 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.

    * Simplify Consecutive Merge Store Candidate Search

    Now that address aliasing is much less conservative, push through
    simplified store merging search and chain alias analysis which only
    checks for parallel stores through the chain subgraph. This is cleaner
    as the separation of non-interfering loads/stores from the
    store-merging logic.

    When merging stores search up the chain through a single load, and
    finds all possible stores by looking down from through a load and a
    TokenFactor to all stores visited.

    This improves the quality of the output SelectionDAG and the output
    Codegen (save perhaps for some ARM cases where we correctly constructs
    wider loads, but then promotes them to float operations which appear
    but requires more expensive constant generation).

    Some minor peephole optimizations to deal with improved SubDAG shapes (listed below)

    Additional Minor Changes:

      1. Finishes removing unused AliasLoad code

      2. Unifies the chain aggregation in the merged stores across code
         paths

      3. Re-add the Store node to the worklist after calling
         SimplifyDemandedBits.

      4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
         arbitrary, but seems sufficient to not cause regressions in
         tests.

      5. Remove Chain dependencies of Memory operations on CopyfromReg
         nodes as these are captured by data dependence

      6. Forward loads-store values through tokenfactors containing
          {CopyToReg,CopyFromReg} Values.

      7. Peephole to convert buildvector of extract_vector_elt to
         extract_subvector if possible (see
         CodeGen/AArch64/store-merge.ll)

      8. Store merging for the ARM target is restricted to 32-bit as
         some in some contexts invalid 64-bit operations are being
         generated. This can be removed once appropriate checks are
         added.

    This finishes the change Matt Arsenault started in r246307 and
    jyknight's original patch.

    Many tests required some changes as memory operations are now
    reorderable, improving load-store forwarding. One test in
    particular is worth noting:

      CodeGen/PowerPC/ppc64-align-long-double.ll - Improved load-store
      forwarding converts a load-store pair into a parallel store and
      a memory-realized bitcast of the same value. However, because we
      lose the sharing of the explicit and implicit store values we
      must create another local store. A similar transformation
      happens before SelectionDAG as well.

    Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle

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

7 years agoUse shouldAssumeDSOLocal in classifyGlobalReference.
Rafael Espindola [Thu, 26 Jan 2017 15:02:31 +0000 (15:02 +0000)]
Use shouldAssumeDSOLocal in classifyGlobalReference.

And teach shouldAssumeDSOLocal that ppc has no copy relocations.

The resulting code handle a few more case than before. For example, it
knows that a weak symbol can be resolved to another .o file, but it
will still be in the main executable.

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

7 years ago[X86][SSE] Add support for combining ANDNP byte masks with target shuffles
Simon Pilgrim [Thu, 26 Jan 2017 14:31:12 +0000 (14:31 +0000)]
[X86][SSE] Add support for combining ANDNP byte masks with target shuffles

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

7 years ago[SCEV] Introduce add operation inlining limit
Daniil Fukalov [Thu, 26 Jan 2017 13:33:17 +0000 (13:33 +0000)]
[SCEV] Introduce add operation inlining limit

Inlining in getAddExpr() can cause abnormal computational time in some cases.
New parameter -scev-addops-inline-threshold is intruduced with default value 500.

Reviewers: sanjoy

Subscribers: mzolotukhin, llvm-commits

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

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

7 years ago[X86][SSE] Pull out target shuffle resolve code into helper. NFCI.
Simon Pilgrim [Thu, 26 Jan 2017 13:06:02 +0000 (13:06 +0000)]
[X86][SSE] Pull out target shuffle resolve code into helper. NFCI.

Pulled out code that removed unused inputs from a target shuffle mask into a helper function to allow it to be reused in a future commit.

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

7 years agoRemove a '#if 0' that wasn't intended for commit in r293173.
Daniel Sanders [Thu, 26 Jan 2017 12:10:43 +0000 (12:10 +0000)]
Remove a '#if 0' that wasn't intended for commit in r293173.

The '#if 0' contained the code I had intended to use but clang
rejects it (possibly incorrectly).

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

7 years agoAttempt to fix windows buildbots after r293172.
Daniel Sanders [Thu, 26 Jan 2017 11:23:49 +0000 (11:23 +0000)]
Attempt to fix windows buildbots after r293172.

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

7 years ago[globalisel] Re-factor ISel matchers into a hierarchy. NFC
Daniel Sanders [Thu, 26 Jan 2017 11:10:14 +0000 (11:10 +0000)]
[globalisel] Re-factor ISel matchers into a hierarchy. NFC

Summary:
This should make it possible to easily add everything needed to import all
the existing SelectionDAG rules. It should also serve the likely
kinds of GlobalISel rules (some of which are not currently representable
in SelectionDAG) once we've nailed down the tablegen definition for that.

The hierarchy is as follows:
  MatcherRule - A matching rule. Currently used to emit C++ ISel code but will
  |             also be used to emit test cases and tablegen definitions in the
  |             near future.
  |- Instruction(s) - Represents the instruction to be matched.
     |- Instruction Predicate(s) - Test the opcode, arithmetic flags, etc. of an
     |                             instruction.
     \- Operand(s) - Represents a particular operand of the instruction. In the
        |            future, there may be subclasses to test the same predicates
        |            on multiple operands (including for variadic instructions).
        \ Operand Predicate(s) - Test the type, register bank, etc. of an operand.
                                 This is where the ComplexPattern equivalent
                                 will be represented. It's also
                                 nested-instruction matching will live as a
                                 predicate that follows the DefUse chain to the
                                 Def and tests a MatcherRule from that position.

Support for multiple instruction matchers in a rule has been retained from
the existing code but has been adjusted to assert when it is used.
Previously it would silently drop all but the first instruction matcher.

The tablegen-erated file is not functionally changed but has more
parentheses and no longer attempts to format the if-statements since
keeping track of the indentation is tricky in the presence of the matcher
hierarchy. It would be nice to have CMakes tablegen() run the output
through clang-format (when available) so we don't have to complicate
TableGen with pretty-printing.

It's also worth mentioning that this hierarchy will also be able to emit
TableGen definitions and test cases in the near future. This is the reason
for favouring explicit emit*() calls rather than the << operator.

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

Reviewed By: ab

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

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

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

7 years ago[AMDGPU] Fix typo in GCNSchedStrategy
Valery Pykhtin [Thu, 26 Jan 2017 10:51:47 +0000 (10:51 +0000)]
[AMDGPU] Fix typo in GCNSchedStrategy

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

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

7 years agoRevert "[mips] N64 static relocation model support"
Simon Dardis [Thu, 26 Jan 2017 10:46:07 +0000 (10:46 +0000)]
Revert "[mips] N64 static relocation model support"

This reverts commit r293164. There are multiple tests failing.

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

7 years ago[LV] Fix an issue where forming LCSSA in the place that we did would
Chandler Carruth [Thu, 26 Jan 2017 10:41:09 +0000 (10:41 +0000)]
[LV] Fix an issue where forming LCSSA in the place that we did would
change the set of uniform instructions in the loop causing an assert
failure.

The problem is that the legalization checking also builds data
structures mapping various facts about the loop body. The immediate
cause was the set of uniform instructions. If these then change when
LCSSA is formed, the data structures would already have been built and
become stale. The included test case triggered an assert in loop
vectorize that was reduced out of the new PM's pipeline.

The solution is to form LCSSA early enough that no information is cached
across the changes made. The only really obvious position is outside of
the main logic to vectorize the loop. This also has the advantage of
removing one case where forming LCSSA could mutate the loop but we
wouldn't track that as a "Changed" state.

If it is significantly advantageous to do some legalization checking
prior to this, we can do a more careful positioning but it seemed best
to just back off to a safe position first.

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

7 years ago[mips] N64 static relocation model support
Simon Dardis [Thu, 26 Jan 2017 10:19:02 +0000 (10:19 +0000)]
[mips] N64 static relocation model support

This patch makes one change to GOT handling and two changes to N64's
relocation model handling. Furthermore, the jumptable encodings have
been corrected for static N64.

Big GOT handling is now done via a new SDNode MipsGotHi - this node is
unconditionally lowered to an lui instruction.

The first change to N64's relocation handling is the lifting of the
restriction that N64 always uses PIC. Now it is possible to target static
environments.

The second change adds support for 64 bit symbols and enables them by
default. Previously N64 had patterns for sym32 mode only. In this mode all
symbols are assumed to have 32 bit addresses. sym32 mode support
is selectable with attribute 'sym32'. A follow on patch for clang will
add the necessary frontend parameter.

This partially resolves PR/23485.

Thanks to Brooks Davis for reporting the issue!

Reviewers: dsanders, seanbruno, zoran.jovanovic, vkalintiris

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

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

7 years ago[ARM] GlobalISel: Load i1, i8 and i16 args from stack
Diana Picus [Thu, 26 Jan 2017 09:20:47 +0000 (09:20 +0000)]
[ARM] GlobalISel: Load i1, i8 and i16 args from stack

Add support for loading i1, i8 and i16 arguments from the stack, with or without
the ABI extension flags.

When the ABI extension flags are present, we load a 4-byte value, otherwise we
preserve the size of the load and let the instruction selector replace it with a
LDRB/LDRH. This generates the same thing as DAGISel.

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

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

7 years ago[SLP] Add one more reduction operation for extra argument test to make
Alexey Bataev [Thu, 26 Jan 2017 09:18:41 +0000 (09:18 +0000)]
[SLP] Add one more reduction operation for extra argument test to make
it vectorizable.

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

7 years ago[PM] Use PoisoningVH correctly when merely deleting entries in a map
Chandler Carruth [Thu, 26 Jan 2017 08:31:54 +0000 (08:31 +0000)]
[PM] Use PoisoningVH correctly when merely deleting entries in a map
with it.

This code was dereferencing the PoisoningVH which isn't allowed once it
is poisoned. But the code itself really doesn't need to access the
pointer, it is just doing the safe stuff of clearing out data structures
keyed on the pointer value.

Change the code to use iterators to erase directly from a DenseMap. This
is also substantially more efficient as it avoids lots of hashing and
lookups to do the erasure. DenseMap supports iterating behind the
iteration which is fairly easy to implement.

Sadly, I don't have a test case here. I'm not even close and I don't
know that I ever will be. The issue is that several of the tricky
aspects of fixing this only show up when you cause the stack's
SmallVector to be in *EXACTLY* the right location. I only ever got
a reproduction for those with Clang, and only with *exactly* the right
command line flags. Any adjustment, even to seemingly unrelated flags,
would make partial and half-way solutions magically start to "work". In
good news, all of this was caught with the LLVM test suite. Also, there
is no *specific* code here that is untested, just that the old pattern
of code won't immediately fail on any test case I've managed to
contrive.

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

7 years agoChapter3/KaleidoscopeJIT.h: Fix a warning. [-Wunused-lambda-capture]
NAKAMURA Takumi [Thu, 26 Jan 2017 08:31:14 +0000 (08:31 +0000)]
Chapter3/KaleidoscopeJIT.h: Fix a warning. [-Wunused-lambda-capture]

"this", aka class members, is not referred in the body.

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

7 years ago[TargetTransformInfo] Add override keywords to supporess -Winconsistent-missing-override.
Craig Topper [Thu, 26 Jan 2017 08:04:27 +0000 (08:04 +0000)]
[TargetTransformInfo] Add override keywords to supporess -Winconsistent-missing-override.

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

7 years ago[AVX-512] Move the combine that runs combineBitcastForMaskedOp to the last DAG combin...
Craig Topper [Thu, 26 Jan 2017 07:17:58 +0000 (07:17 +0000)]
[AVX-512] Move the combine that runs combineBitcastForMaskedOp to the last DAG combine phase where I had originally meant to put it.

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

7 years ago[X86] When bitcasting INSERT_SUBVECTOR/EXTRACT_SUBVECTOR to match masked operations...
Craig Topper [Thu, 26 Jan 2017 07:17:53 +0000 (07:17 +0000)]
[X86] When bitcasting INSERT_SUBVECTOR/EXTRACT_SUBVECTOR to match masked operations, use the correct type for the immediate operand.

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

7 years ago[TargetTransformInfo] Refactor and improve getScalarizationOverhead()
Jonas Paulsson [Thu, 26 Jan 2017 07:03:25 +0000 (07:03 +0000)]
[TargetTransformInfo]  Refactor and improve getScalarizationOverhead()

Refactoring to remove duplications of this method.

New method getOperandsScalarizationOverhead() that looks at the present unique
operands and add extract costs for them. Old behaviour was to just add extract
costs for one operand of the type always, which still happens in
getArithmeticInstrCost() if no operands are provided by the caller.

This is a good start of improving on this, but there are more places
that can be improved by using getOperandsScalarizationOverhead().

Review: Hal Finkel
https://reviews.llvm.org/D29017

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

7 years ago[SLP] Fixed test for extra arguments in horizontal reductions.
Alexey Bataev [Thu, 26 Jan 2017 06:19:52 +0000 (06:19 +0000)]
[SLP] Fixed test for extra arguments in horizontal reductions.

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

7 years ago[DAGCombiner] Fold extract_subvector of undef to undef. Fold away inserting undef...
Craig Topper [Thu, 26 Jan 2017 05:38:46 +0000 (05:38 +0000)]
[DAGCombiner] Fold extract_subvector of undef to undef. Fold away inserting undef subvectors.

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

7 years ago[X86] Add demanded elts support for the inputs to pclmul intrinsic
Craig Topper [Thu, 26 Jan 2017 05:17:13 +0000 (05:17 +0000)]
[X86] Add demanded elts support for the inputs to pclmul intrinsic

This intrinsic uses bit 0 and bit 4 of an immediate argument to determine which bits of its inputs to read. This patch uses this information to simplify the demanded elements of the input vectors.

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

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

7 years agoRevert test commit
Taewook Oh [Thu, 26 Jan 2017 04:34:25 +0000 (04:34 +0000)]
Revert test commit

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

7 years agotest commit
Taewook Oh [Thu, 26 Jan 2017 04:32:40 +0000 (04:32 +0000)]
test commit

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

7 years ago[OptDiag] Predicates to check the same type of IR and MIR opt remarks
Adam Nemet [Thu, 26 Jan 2017 04:03:18 +0000 (04:03 +0000)]
[OptDiag] Predicates to check the same type of IR and MIR opt remarks

It will be used from clang.

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

7 years agogold-plugin: Fix test case.
Peter Collingbourne [Thu, 26 Jan 2017 02:15:08 +0000 (02:15 +0000)]
gold-plugin: Fix test case.

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

7 years ago[PM] Simplify the new PM interface to the loop unroller and expose two
Chandler Carruth [Thu, 26 Jan 2017 02:13:50 +0000 (02:13 +0000)]
[PM] Simplify the new PM interface to the loop unroller and expose two
factory functions for the two modes the loop unroller is actually used
in in-tree: simplified full-unrolling and the entire thing including
partial unrolling.

I've also wired these up to nice names so you can express both of these
being in a pipeline easily. This is a precursor to actually enabling
these parts of the O2 pipeline.

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

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

7 years ago[Loops] Restructure the LoopInfo verify function so that it more
Chandler Carruth [Thu, 26 Jan 2017 02:07:20 +0000 (02:07 +0000)]
[Loops] Restructure the LoopInfo verify function so that it more
directly walks the current loop structure verifying that a matching
structure can be found in a freshly computed version.

Also pull things out of containers when necessary once an issue is found
and print them directly.

This makes it substantially easier to debug verification failures as
the process stops at the exact point in the loop nest where they diverge
and has in easily accessed local variables (or printed to stderr
already) the loops and other information needed to analyze the failure.

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

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

7 years agogold-plugin: Simplify naming of object files created with save-temps or obj-path.
Peter Collingbourne [Thu, 26 Jan 2017 02:07:05 +0000 (02:07 +0000)]
gold-plugin: Simplify naming of object files created with save-temps or obj-path.

Now we never append a number to the file name for task ID 0.

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

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

7 years agoFix --Wunused-function.
Rui Ueyama [Thu, 26 Jan 2017 02:03:58 +0000 (02:03 +0000)]
Fix --Wunused-function.

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

7 years ago[libFuzzer] remove a bit of stale code
Kostya Serebryany [Thu, 26 Jan 2017 01:45:54 +0000 (01:45 +0000)]
[libFuzzer] remove a bit of stale code

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

7 years ago[libFuzzer] further simplify __sanitizer_cov_trace_pc_guard
Kostya Serebryany [Thu, 26 Jan 2017 01:34:58 +0000 (01:34 +0000)]
[libFuzzer] further simplify __sanitizer_cov_trace_pc_guard

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

7 years agoAMDGPU: Fold fneg into round instructions
Matt Arsenault [Thu, 26 Jan 2017 01:25:36 +0000 (01:25 +0000)]
AMDGPU: Fold fneg into round instructions

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

7 years ago[ImplicitNullChecks] Add a test demonstrating a case we don't get today
Sanjoy Das [Thu, 26 Jan 2017 01:07:33 +0000 (01:07 +0000)]
[ImplicitNullChecks] Add a test demonstrating a case we don't get today

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

7 years ago[libFuzzer] simplify the code for __sanitizer_cov_trace_pc_guard and make sure it...
Kostya Serebryany [Thu, 26 Jan 2017 01:04:54 +0000 (01:04 +0000)]
[libFuzzer] simplify the code for __sanitizer_cov_trace_pc_guard and make sure it is not asan/msan-instrumented

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

7 years ago[LoopUnroll] Properly update loopinfo for runtime unrolling by 2
Michael Kuperstein [Thu, 26 Jan 2017 01:04:11 +0000 (01:04 +0000)]
[LoopUnroll] Properly update loopinfo for runtime unrolling by 2

Even when we don't create a remainder loop (that is, when we unroll by 2), we
may duplicate nested loops into the remainder. This is complicated by the fact
the remainder may itself be either inserted into an outer loop, or at the top
level. In the latter case, we may need to create new top-level loops.

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

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

7 years ago[NewGVN] Skip uses in unreachable blocks.
Davide Italiano [Thu, 26 Jan 2017 00:42:42 +0000 (00:42 +0000)]
[NewGVN] Skip uses in unreachable blocks.

Otherwise we ask for a domtree node that's not there, and we crash.

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

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

7 years ago[llc] Add -pass-remarks-output
Adam Nemet [Thu, 26 Jan 2017 00:39:51 +0000 (00:39 +0000)]
[llc] Add -pass-remarks-output

This is the opt/llc counterpart of -fsave-optimization-record to output
optimization remarks in a YAML file.

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

7 years agoLowerTypeTests: Ignore external globals with type metadata.
Peter Collingbourne [Thu, 26 Jan 2017 00:32:15 +0000 (00:32 +0000)]
LowerTypeTests: Ignore external globals with type metadata.

Thanks to Davide Italiano for finding the problem and providing a test case.

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

7 years ago[libFuzzer] don't call GetPreviousInstructionPc on the hot path -- only when dumping...
Kostya Serebryany [Thu, 26 Jan 2017 00:22:08 +0000 (00:22 +0000)]
[libFuzzer] don't call GetPreviousInstructionPc on the hot path -- only when dumping the PCs

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

7 years ago[APFloat] Fix comments. NFC.
Tim Shen [Thu, 26 Jan 2017 00:11:07 +0000 (00:11 +0000)]
[APFloat] Fix comments. NFC.

Summary: Fix comments in response to jlebar's comments in D27872.

Reviewers: jlebar

Subscribers: llvm-commits

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

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

7 years ago[ValueTracking] Implement SignBitMustBeZero correctly for sqrt.
Justin Lebar [Thu, 26 Jan 2017 00:10:26 +0000 (00:10 +0000)]
[ValueTracking] Implement SignBitMustBeZero correctly for sqrt.

Summary:
Previously we assumed that the result of sqrt(x) always had 0 as its
sign bit.  But sqrt(-0) == -0.

Reviewers: hfinkel, efriedma, sanjoy

Subscribers: llvm-commits

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

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

7 years agoChange the test added in r293099 so it does not have the string "llvm-nm" to fix
Kevin Enderby [Wed, 25 Jan 2017 23:57:32 +0000 (23:57 +0000)]
Change the test added in r293099 so it does not have the string "llvm-nm" to fix
the clang-x86-windows-msvc2015 bot as the name is "llvm-nm.EXE" in that case.

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

7 years ago[llc] Add -pass-remarks-with-hotness
Adam Nemet [Wed, 25 Jan 2017 23:55:59 +0000 (23:55 +0000)]
[llc] Add -pass-remarks-with-hotness

Analogous to the code in opt, this enables hotness in opt-remarks.

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

7 years ago[NewGVN] Simplify folding a lambda used only once. NFCI.
Davide Italiano [Wed, 25 Jan 2017 23:37:49 +0000 (23:37 +0000)]
[NewGVN] Simplify folding a lambda used only once. NFCI.

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

7 years agoNew OptimizationRemarkEmitter pass for MIR
Adam Nemet [Wed, 25 Jan 2017 23:20:33 +0000 (23:20 +0000)]
New OptimizationRemarkEmitter pass for MIR

This allows MIR passes to emit optimization remarks with the same level
of functionality that is available to IR passes.

It also hooks up the greedy register allocator to report spills.  This
allows for interesting use cases like increasing interleaving on a loop
until spilling of registers is observed.

I still need to experiment whether reporting every spill scales but this
demonstrates for now that the functionality works from llc
using -pass-remarks*=<pass>.

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

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

7 years ago[OptDiag] Split code region out of DiagnosticInfoOptimizationBase
Adam Nemet [Wed, 25 Jan 2017 23:20:25 +0000 (23:20 +0000)]
[OptDiag] Split code region out of DiagnosticInfoOptimizationBase

Code region is the only part of this class that is IR-specific.  Code
region is moved down in the inheritance tree to a new derived class,
called DiagnosticInfoIROptimization.

All the existing remarks are derived from this new class now.

This allows the new MIR pass-remark classes to be derived from
DiagnosticInfoOptimizationBase.

Also because we keep the name DiagnosticInfoOptimizationBase, the clang
parts don't need any adjustment.

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

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

7 years agoFix for r293104, which renamed a directory.
Adrian McCarthy [Wed, 25 Jan 2017 22:48:57 +0000 (22:48 +0000)]
Fix for r293104, which renamed a directory.

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

7 years agoNFC: Rename (PDB) RawSession to NativeSession
Adrian McCarthy [Wed, 25 Jan 2017 22:38:55 +0000 (22:38 +0000)]
NFC:  Rename (PDB) RawSession to NativeSession

This eliminates one overload on the term Raw.

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

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

7 years agoLangRef: Document the allowed metadata dropping transforms.
Peter Collingbourne [Wed, 25 Jan 2017 21:50:14 +0000 (21:50 +0000)]
LangRef: Document the allowed metadata dropping transforms.

Document the current practice regarding dropping metadata on modules,
functions and global variables.

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

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

7 years agoAdd a warning when the llvm-nm -print-size flag is used on a Mach-O file as
Kevin Enderby [Wed, 25 Jan 2017 21:33:38 +0000 (21:33 +0000)]
Add a warning when the llvm-nm -print-size flag is used on a Mach-O file as
Mach-O files don’t have size information about the symbols in the object file
format unlike ELF.

Also add the part of the fix to llvm-nm that was missed with r290001 so
-arch armv7m works.

rdar://25681018

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

7 years agoRevert "[PPC] Give unaligned memory access lower cost on processor that supports it"
Daniel Jasper [Wed, 25 Jan 2017 21:21:08 +0000 (21:21 +0000)]
Revert "[PPC] Give unaligned memory access lower cost on processor that supports it"

This reverts commit r292680. It is causing significantly worse
performance and test timeouts in our internal builds. I have already
routed reproduction instructions your way.

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

7 years ago[pdb] Fix failing test
Zachary Turner [Wed, 25 Jan 2017 21:21:02 +0000 (21:21 +0000)]
[pdb] Fix failing test

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

7 years ago[pdb] Correctly parse the hash adjusters table from TPI stream.
Zachary Turner [Wed, 25 Jan 2017 21:17:40 +0000 (21:17 +0000)]
[pdb] Correctly parse the hash adjusters table from TPI stream.

This is not a list of pairs, it is a hash table data structure. We now
correctly parse this out and dump it from llvm-pdbdump.

We still need to understand the conditions that lead to a type
getting an entry in the hash adjuster table.  That will be done
in a followup investigation / patch.

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

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

7 years agoSDag: fix how initial loads are formed when splitting vector ops.
Tim Northover [Wed, 25 Jan 2017 20:58:26 +0000 (20:58 +0000)]
SDag: fix how initial loads are formed when splitting vector ops.

Later code expects the vector loads produced to be directly
concatenable, which means we shouldn't pad anything except the last load
produced with UNDEF.

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

7 years agoGlobalISel: rework getOrCreateVReg to avoid double lookup. NFC.
Tim Northover [Wed, 25 Jan 2017 20:58:22 +0000 (20:58 +0000)]
GlobalISel: rework getOrCreateVReg to avoid double lookup. NFC.

Thanks to Quentin for suggesting the refactoring.

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

7 years agoDebugInfo: remove unused parameter from function. NFC.
Tim Northover [Wed, 25 Jan 2017 20:58:07 +0000 (20:58 +0000)]
DebugInfo: remove unused parameter from function. NFC.

I think it's a hold-over from some previous iteration, but it's never
set to true in LLVM as it exists now.

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

7 years agoMemorySSA: Link all defs together into an intrusive defslist, to make updater easier
Daniel Berlin [Wed, 25 Jan 2017 20:56:19 +0000 (20:56 +0000)]
MemorySSA: Link all defs together into an intrusive defslist, to make updater easier

Summary:
This is the first in a series of patches to add a simple, generalized updater to MemorySSA.

For MemorySSA, every def is may-def, instead of the normal must-def.
(the best way to think of memoryssa is "everything is really one variable, with different versions of that variable at different points in the program).
This means when updating, we end up having to do a bunch of work to touch defs below and above us.

In order to support this quickly, i have ilist'd all the defs for each block.  ilist supports tags, so this is quite easy. the only slightly messy part is that you can't have two iplists for the same type that differ only whether they have the ownership part enabled or not, because the traits are for the value type.

The verifiers have been updated to test that the def order is correct.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

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

7 years ago[AMDGPU] Bump up n_type for metadata v2
Konstantin Zhuravlyov [Wed, 25 Jan 2017 20:47:17 +0000 (20:47 +0000)]
[AMDGPU] Bump up n_type for metadata v2

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

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

7 years agoAMDGPU: Set call_convention bit in kernel_code_t
Matt Arsenault [Wed, 25 Jan 2017 20:21:57 +0000 (20:21 +0000)]
AMDGPU: Set call_convention bit in kernel_code_t

According to the documentation this is supposed to be -1
if indirect calls are not supported.

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

7 years ago[XRay][AArch64] More staging for tail call support in XRay on AArch64 - in LLVM
Serge Rogatch [Wed, 25 Jan 2017 20:21:49 +0000 (20:21 +0000)]
[XRay][AArch64] More staging for tail call support in XRay on AArch64 - in LLVM

Summary:
This patch prepares more for tail call support in XRay. Until the logging part supports tail calls, this is just staging, so it seems LLVM part is mostly ready with this patch.
Related: https://reviews.llvm.org/D28948 (compiler-rt)

Reviewers: dberris, rengolin

Reviewed By: dberris

Subscribers: llvm-commits, iid_iunknown, aemerson

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

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

7 years agoAdd iterator_range<regclass_iterator> to {Target,MC}RegisterInfo, NFC
Krzysztof Parzyszek [Wed, 25 Jan 2017 19:29:04 +0000 (19:29 +0000)]
Add iterator_range<regclass_iterator> to {Target,MC}RegisterInfo, NFC

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

7 years ago[SLP] Extra test for functionality with extra args.
Alexey Bataev [Wed, 25 Jan 2017 17:24:31 +0000 (17:24 +0000)]
[SLP] Extra test for functionality with extra args.

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

7 years agoRevert "Do not verify dominator tree if it has no roots"
Chad Rosier [Wed, 25 Jan 2017 17:15:48 +0000 (17:15 +0000)]
Revert "Do not verify dominator tree if it has no roots"

This reverts commit r293033, per Danny's comment.  In short, we require
domtrees to have roots at all times.

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

7 years agoPowerPC: Slight cleanup of getReservedRegs(); NFC
Matthias Braun [Wed, 25 Jan 2017 17:12:10 +0000 (17:12 +0000)]
PowerPC: Slight cleanup of getReservedRegs(); NFC

Change getReservedRegs() to not mark a register as reserved and then
revert that decision in some cases. Motivated by the discussion in
https://reviews.llvm.org/D29056

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

7 years agoAdd loop pass insertion point EP_LateLoopOptimizations
Krzysztof Parzyszek [Wed, 25 Jan 2017 16:12:25 +0000 (16:12 +0000)]
Add loop pass insertion point EP_LateLoopOptimizations

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

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

7 years ago[Guards] Introduce loop-predication pass
Artur Pilipenko [Wed, 25 Jan 2017 16:00:44 +0000 (16:00 +0000)]
[Guards] Introduce loop-predication pass

This patch introduces guard based loop predication optimization. The new LoopPredication pass tries to convert loop variant range checks to loop invariant by widening checks across loop iterations. For example, it will convert

  for (i = 0; i < n; i++) {
    guard(i < len);
    ...
  }

to

  for (i = 0; i < n; i++) {
    guard(n - 1 < len);
    ...
  }

After this transformation the condition of the guard is loop invariant, so loop-unswitch can later unswitch the loop by this condition which basically predicates the loop by the widened condition:

  if (n - 1 < len)
    for (i = 0; i < n; i++) {
      ...
    }
  else
    deoptimize

This patch relies on an NFC change to make ScalarEvolution::isMonotonicPredicate public (revision 293062).

Reviewed By: sanjoy

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

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

7 years ago[AArch64] Minor code refactoring. NFC.
Chad Rosier [Wed, 25 Jan 2017 15:56:59 +0000 (15:56 +0000)]
[AArch64] Minor code refactoring. NFC.

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

7 years agoNFC. Make ScalarEvolution::isMonotonicPredicate public
Artur Pilipenko [Wed, 25 Jan 2017 15:07:55 +0000 (15:07 +0000)]
NFC. Make ScalarEvolution::isMonotonicPredicate public

Will be used by the upcoming LoopPredication optimization.

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

7 years ago[InstCombine] Canonicalize guards for NOT OR condition
Artur Pilipenko [Wed, 25 Jan 2017 14:45:12 +0000 (14:45 +0000)]
[InstCombine] Canonicalize guards for NOT OR condition

This is a partial fix for Bug 31520 - [guards] canonicalize guards in instcombine

Reviewed By: apilipenko

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

Patch by Maxim Kazantsev.

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

7 years ago[InstCombine][SSE] Add support for PACKSS/PACKUS constant folding
Simon Pilgrim [Wed, 25 Jan 2017 14:37:24 +0000 (14:37 +0000)]
[InstCombine][SSE] Add support for PACKSS/PACKUS constant folding

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

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

7 years ago[ARM] GlobalISel: Fix stack-use-after-scope bug.
Martin Bohme [Wed, 25 Jan 2017 14:28:19 +0000 (14:28 +0000)]
[ARM] GlobalISel: Fix stack-use-after-scope bug.

Summary:
Lifetime extension wasn't triggered on the result of BuildMI because the
reference was non-const. However, instead of adding a const, I've
removed the reference entirely as RVO should kick in anyway.

Reviewers: rovka, bkramer

Reviewed By: bkramer

Subscribers: aemerson, rengolin, dberris, llvm-commits, kristof.beyls

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

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

7 years ago[InstCombine] Canonicalize guards for AND condition
Artur Pilipenko [Wed, 25 Jan 2017 14:20:52 +0000 (14:20 +0000)]
[InstCombine] Canonicalize guards for AND condition

This is a partial fix for Bug 31520 - [guards] canonicalize guards in instcombine

Reviewed By: apilipenko

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

Patch by Maxim Kazantsev.

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

7 years ago[InstCombine] Allow InstrCombine to remove one of adjacent guards if they are equivalent
Artur Pilipenko [Wed, 25 Jan 2017 14:12:12 +0000 (14:12 +0000)]
[InstCombine] Allow InstrCombine to remove one of adjacent guards if they are equivalent

This is a partial fix for Bug 31520 - [guards] canonicalize guards in instcombine

Reviewed By: majnemer, apilipenko

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

Patch by Maxim Kazantsev.

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