OSDN Git Service

android-x86/external-llvm.git
7 years ago[unittests] Delete some copy constructors (NFC)
Vedant Kumar [Wed, 12 Oct 2016 22:27:54 +0000 (22:27 +0000)]
[unittests] Delete some copy constructors (NFC)

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

7 years ago[unittest] Pass a reference instead of making a copy (NFC)
Vedant Kumar [Wed, 12 Oct 2016 22:27:52 +0000 (22:27 +0000)]
[unittest] Pass a reference instead of making a copy (NFC)

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

7 years ago[Coverage] Delete some copy constructors (NFC)
Vedant Kumar [Wed, 12 Oct 2016 22:27:49 +0000 (22:27 +0000)]
[Coverage] Delete some copy constructors (NFC)

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

7 years ago[Coverage] Factor out logic to create FunctionRecords (NFC)
Vedant Kumar [Wed, 12 Oct 2016 22:27:45 +0000 (22:27 +0000)]
[Coverage] Factor out logic to create FunctionRecords (NFC)

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

7 years agoCreate llvm.addressofreturnaddress intrinsic
Albert Gutowski [Wed, 12 Oct 2016 22:13:19 +0000 (22:13 +0000)]
Create llvm.addressofreturnaddress intrinsic

Summary: We need a new LLVM intrinsic to implement MS _AddressOfReturnAddress builtin on 64-bit Windows.

Reviewers: majnemer, rnk

Subscribers: llvm-commits

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

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

7 years agoUpdate _MSC_VER equality checks for msdiaNNN.dll
Reid Kleckner [Wed, 12 Oct 2016 21:51:14 +0000 (21:51 +0000)]
Update _MSC_VER equality checks for msdiaNNN.dll

Use inequality instead of equality to defend against minor version
increases in _MSC_VER. An _MSC_VER value of 1901 should still use
msdia140.dll, as described in this blog post:
https://blogs.msdn.microsoft.com/vcblog/2016/10/05/visual-c-compiler-version/

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

7 years ago[lit] Fix test shtest-timeout.py for modern output
Michal Gorny [Wed, 12 Oct 2016 21:40:08 +0000 (21:40 +0000)]
[lit] Fix test shtest-timeout.py for modern output

Update the CHECK lines in the shtest-timeout.py lit test to account for
the current output. The output has been changed in r271610 without
adjusting the tests.

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

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

7 years ago[lit] Fix FormatError on individual test timeout
Michal Gorny [Wed, 12 Oct 2016 21:40:04 +0000 (21:40 +0000)]
[lit] Fix FormatError on individual test timeout

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

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

7 years agoReapply "[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll...
Haicheng Wu [Wed, 12 Oct 2016 21:29:38 +0000 (21:29 +0000)]
Reapply "[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop"

Reappy r284044 after revert in r284051. Krzysztof fixed the error in r284049.

The original summary:

This patch tries to fully unroll loops having break statement like this

for (int i = 0; i < 8; i++) {
    if (a[i] == value) {
        found = true;
        break;
    }
}

GCC can fully unroll such loops, but currently LLVM cannot because LLVM only
supports loops having exact constant trip counts.

The upper bound of the trip count can be obtained from calling
ScalarEvolution::getMaxBackedgeTakenCount(). Part of the patch is the
refactoring work in SCEV to prevent duplicating code.

The feature of using the upper bound is enabled under the same circumstance
when runtime unrolling is enabled since both are used to unroll loops without
knowing the exact constant trip count.

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

7 years ago[MIRParser] Parse lane masks for register live-ins
Krzysztof Parzyszek [Wed, 12 Oct 2016 21:06:45 +0000 (21:06 +0000)]
[MIRParser] Parse lane masks for register live-ins

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

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

7 years agoRevert "[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll...
Haicheng Wu [Wed, 12 Oct 2016 21:02:22 +0000 (21:02 +0000)]
Revert "[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop"

This reverts commit r284044.

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

7 years agoFix testcases failing after r284036
Krzysztof Parzyszek [Wed, 12 Oct 2016 20:39:33 +0000 (20:39 +0000)]
Fix testcases failing after r284036

The codegen has changed slightly between my tests and the commit.

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

7 years ago[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop
Haicheng Wu [Wed, 12 Oct 2016 20:24:32 +0000 (20:24 +0000)]
[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop

This patch tries to fully unroll loops having break statement like this

for (int i = 0; i < 8; i++) {
    if (a[i] == value) {
        found = true;
        break;
    }
}

GCC can fully unroll such loops, but currently LLVM cannot because LLVM only
supports loops having exact constant trip counts.

The upper bound of the trip count can be obtained from calling
ScalarEvolution::getMaxBackedgeTakenCount(). Part of the patch is the
refactoring work in SCEV to prevent duplicating code.

The feature of using the upper bound is enabled under the same circumstance
when runtime unrolling is enabled since both are used to unroll loops without
knowing the exact constant trip count.

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

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

7 years agoLTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions().
Peter Collingbourne [Wed, 12 Oct 2016 20:12:19 +0000 (20:12 +0000)]
LTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions().

We need to use the overload of Mangler::getNameWithPrefix that takes a
GlobalValue in order to mangle in the stdcall stack byte count for Windows
targets.

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

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

7 years ago[ThinLTO] Fix bot failure due to unused variable with NDEBUG
Teresa Johnson [Wed, 12 Oct 2016 20:06:02 +0000 (20:06 +0000)]
[ThinLTO] Fix bot failure due to unused variable with NDEBUG

Put variable only used in assert under #ifndef NDEBUG.

This should fix bot failure at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/28537

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

7 years agoRevert "[ADT] Zip range adapter"
Mehdi Amini [Wed, 12 Oct 2016 19:54:08 +0000 (19:54 +0000)]
Revert "[ADT] Zip range adapter"

This reverts commit r284035, which breaks with MSVC 2013.

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

7 years agoDo not remove implicit defs in BranchFolder
Krzysztof Parzyszek [Wed, 12 Oct 2016 19:50:57 +0000 (19:50 +0000)]
Do not remove implicit defs in BranchFolder

Branch folder removes implicit defs if they are the only non-branching
instructions in a block, and the branches do not use the defined registers.
The problem is that in some cases these implicit defs are required for
the liveness information to be correct.

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

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

7 years ago[ADT] Zip range adapter
Mehdi Amini [Wed, 12 Oct 2016 19:43:02 +0000 (19:43 +0000)]
[ADT] Zip range adapter

This augments the STLExtras toolset with a zip iterator and range
adapter. Zip comes in two varieties: `zip`, which will zip to the
shortest of the input ranges, and `zip_first`, which limits its
`begin() == end()` checks to just the first krange.

Patch by: Bryant Wong <github.com/bryant>

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

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

7 years agoAMDGPU: Initial implementation of VGPR indexing mode
Matt Arsenault [Wed, 12 Oct 2016 18:49:05 +0000 (18:49 +0000)]
AMDGPU: Initial implementation of VGPR indexing mode

This is the most basic handling of the indirect access
pseudos using GPR indexing mode. This currently only enables
the mode for a single v_mov_b32 and then disables it.
This is much more complicated to use than the movrel instructions,
so a new optimization pass is probably needed to fold the access
into the uses and keep the mode enabled for them.

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

7 years ago[ThinLTO] Don't link module level assembly when importing
Teresa Johnson [Wed, 12 Oct 2016 18:39:29 +0000 (18:39 +0000)]
[ThinLTO] Don't link module level assembly when importing

Module inline asm was always being linked/concatenated
when running the IRLinker. This is correct for full LTO but not when
we are importing for ThinLTO, as it can result in multiply defined
symbols when the module asm defines a global symbol.

In order to test with llvm-lto2, I had to work around PR30396,
where a symbol that is defined in module assembly but defined in the
LLVM IR appears twice. Added workaround to llvm-lto2 with a FIXME.

Fixes PR30610.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

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

7 years ago[SimplifyCFG] Don't create PHI nodes for constant bundle operands
Sanjoy Das [Wed, 12 Oct 2016 18:15:33 +0000 (18:15 +0000)]
[SimplifyCFG] Don't create PHI nodes for constant bundle operands

Summary:
Constant bundle operands may need to retain their constant-ness for
correctness.  I'll admit that this is slightly odd, but it looks like
SimplifyCFG already does this for things like @llvm.frameaddress and
@llvm.stackmap, so I suppose adding one more case is not a big deal.

It is possible to add a mechanism to denote bundle operands that need to
remain constants, but that's probably too complicated for the time
being.

Reviewers: jmolloy

Subscribers: mcrosier, llvm-commits

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

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

7 years agoAMDGPU: Add instruction definitions for VGPR indexing
Matt Arsenault [Wed, 12 Oct 2016 18:00:51 +0000 (18:00 +0000)]
AMDGPU: Add instruction definitions for VGPR indexing

VI added a second method of indexing into VGPRs
besides using v_movrel*

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

7 years ago[X86] Add the v4i32 flavor test-case for pr30371
Zvi Rackover [Wed, 12 Oct 2016 17:06:30 +0000 (17:06 +0000)]
[X86] Add the v4i32 flavor test-case for pr30371

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

7 years agoAMDGPU/SI: Change mimg intrinsic signatures
Tom Stellard [Wed, 12 Oct 2016 16:35:29 +0000 (16:35 +0000)]
AMDGPU/SI: Change mimg intrinsic signatures

This makes more fields overridable and removes redundant bits.

Patch by: Changpeng Fang

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

7 years ago[ValueTracking] An improvement to IR ValueTracking on Non-negative Integers
Artur Pilipenko [Wed, 12 Oct 2016 16:18:43 +0000 (16:18 +0000)]
[ValueTracking] An improvement to IR ValueTracking on Non-negative Integers

Since this change is known to cause performance degradations in some cases it's commited under a temporary flag which is turned off by default.

Patch by Li Huang

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

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

7 years agoBranchRelaxation: Unique live ins when creating block
Matt Arsenault [Wed, 12 Oct 2016 15:32:04 +0000 (15:32 +0000)]
BranchRelaxation: Unique live ins when creating block

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

7 years ago[MC] Fix Error Location for ParseIdentifier
Nirav Dave [Wed, 12 Oct 2016 13:58:07 +0000 (13:58 +0000)]
[MC] Fix Error Location for ParseIdentifier

Prevent partial parsing of '$' or '@' of invalid identifiers and fixup
workaround points. NFC Intended.

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

7 years ago[DAGCombiner] Update most ADD combines to support general vector combines
Simon Pilgrim [Wed, 12 Oct 2016 13:48:10 +0000 (13:48 +0000)]
[DAGCombiner] Update most ADD combines to support general vector combines

Add a number of helper functions to match scalar or vector equivalent constant/splat values to allow most of the combine patterns to be used by vectors.

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

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

7 years ago[DAGCombiner] Do not remove the load of stored values when optimizations are disabled
Konstantin Zhuravlyov [Wed, 12 Oct 2016 13:44:24 +0000 (13:44 +0000)]
[DAGCombiner] Do not remove the load of stored values when optimizations are disabled

This combiner breaks debug experience and should not be run when optimizations are disabled.

For example:
  int main() {
    int j = 0;
    j += 2;
    if (j == 2)
      return 0;
    return 5;
  }
When debugging this code compiled in /O0, it should be valid to break at line "j+=2;" and edit the value of j. It should change the return value of the function.

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

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

7 years ago[CVP] Convert an AShr to a LShr if 1st operand is known to be nonnegative.
Chad Rosier [Wed, 12 Oct 2016 13:41:38 +0000 (13:41 +0000)]
[CVP] Convert an AShr to a LShr if 1st operand is known to be nonnegative.

An arithmetic shift can be safely changed to a logical shift if the first
operand is known positive. This allows ComputeKnownBits (and similar analysis)
to determine the sign bit of the shifted value in some cases. In turn, this
allows InstCombine to canonicalize a signed comparison (a > 0) into an equality
check (a != 0).

PR30577

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

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

7 years agoNFC: The Cost Model specialization, by Andrey Tischenko
Alexey Bataev [Wed, 12 Oct 2016 13:24:13 +0000 (13:24 +0000)]
NFC: The Cost Model specialization, by Andrey Tischenko

The current Cost Model implementation is very inaccurate and has to be
updated, improved, re-implemented to be able to take into account the
concrete CPU models and the concrete targets where this Cost Model is
being used. For example, the Latency Cost Model should be differ from
Code Size Cost Model, etc.
This patch is the first step to launch the developing and implementation
of a new Cost Model generation.

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

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

7 years ago[InstCombine] Fix constexpr issue in select combining
Simon Pilgrim [Wed, 12 Oct 2016 10:20:15 +0000 (10:20 +0000)]
[InstCombine] Fix constexpr issue in select combining

As discussed by Andrea on PR30486, we have an unsafe cast to an Instruction type in the select combine which doesn't take into account that it could be a ConstantExpr instead.

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

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

7 years ago[Support][CommandLine] Display subcommands in help when there are less than 3
Alex Lorenz [Wed, 12 Oct 2016 10:04:35 +0000 (10:04 +0000)]
[Support][CommandLine] Display subcommands in help when there are less than 3
subcommands

This commit fixes a bug where the help output doesn't display subcommands when
a tool has less than 3 subcommands.

This change doesn't include a corresponding unittest as there is no viable way
to provide a unittest for it.

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

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

7 years ago[Support/ELF] - Sort PT_OPENBSD_* added previously. NFC.
George Rimar [Wed, 12 Oct 2016 09:20:28 +0000 (09:20 +0000)]
[Support/ELF] - Sort PT_OPENBSD_* added previously. NFC.

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

7 years agoAdd AArch64 unit tests
Diana Picus [Wed, 12 Oct 2016 09:00:44 +0000 (09:00 +0000)]
Add AArch64 unit tests

Add unit tests for checking a few tricky instruction sizes. Also remove the old
tests for the instruction sizes, which were clunky and brittle.

Since this is the first set of target-specific unit tests, we need to add some
CMake plumbing. In the future, adding unit tests for a given target will be as
simple as creating a directory with the same name as the target under
unittests/Target. The tests are only run if the target is enabled in
LLVM_TARGETS_TO_BUILD.

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

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

7 years ago[LCG] Cleanup various places where comments said `SCC` but meant
Chandler Carruth [Wed, 12 Oct 2016 08:40:51 +0000 (08:40 +0000)]
[LCG] Cleanup various places where comments said `SCC` but meant
`RefSCC`.

Also improve the comments surrounding the lazy post-order iterator as
they had grown stale since the RefSCC/SCC split.

I'm sure there are more comments that need updating here, but I saw and
fixed these and didn't want to lose them. I've not gotten to doing
a really complete audit of every comment yet.

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

7 years ago[LCG] Add the necessary functionality to the LazyCallGraph to support inlining.
Chandler Carruth [Wed, 12 Oct 2016 07:59:56 +0000 (07:59 +0000)]
[LCG] Add the necessary functionality to the LazyCallGraph to support inlining.

The basic inlining operation makes the following changes to the call graph:
1) Add edges that were previously transitive edges. This is always trivial and
   this patch gives the LCG helper methods to make this more convenient.
2) Remove the inlined edge. We had existing support for this, but it contained
   bugs that needed to be fixed. Testing in the same pattern as the inliner
   exposes these bugs very nicely.
3) Delete a function when it becomes dead because it is internal and all calls
   have been inlined. The LCG had no support at all for this operation, so this
   adds that support.

Two unittests have been added that exercise this specific mutation pattern to
the call graph. They were extremely effective in uncovering bugs. Sadly,
a large fraction of the code here is just to implement those unit tests, but
I think they're paying for themselves. =]

This was split out of a patch that actually uses the routines to
implement inlining in the new pass manager in order to isolate (with
unit tests) the logic that was entirely within the LCG.

Many thanks for the careful review from folks! There will be a few minor
follow-up patches based on the comments in the review as well.

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

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

7 years agoRevert "[libFuzzer] refactoring to speed things up, NFC"
Daniel Jasper [Wed, 12 Oct 2016 07:26:46 +0000 (07:26 +0000)]
Revert "[libFuzzer] refactoring to speed things up, NFC"

This reverts commit r283946.

This breaks when build with GCC:
lib/Fuzzer/FuzzerTracePC.cpp:169:6: error: always_inline function might not be inlinable [-Werror=attributes]
lib/Fuzzer/FuzzerTracePC.cpp:169:6: error: inlining failed in call to always_inline 'void fuzzer::TracePC::HandleCmp(void*, T, T) [with T = long unsigned int]': target specific option mismatch
lib/Fuzzer/FuzzerTracePC.cpp:198:65: error: called from here

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

7 years ago[AArch64][InstructionSelector] Fix unintended test changes in r283973.
Quentin Colombet [Wed, 12 Oct 2016 04:12:44 +0000 (04:12 +0000)]
[AArch64][InstructionSelector] Fix unintended test changes in r283973.

I screwed up my merge conflict and lost some of the CHECK lines.

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

7 years ago[AArch64][InstrustionSelector] Teach the selector about G_BITCAST.
Quentin Colombet [Wed, 12 Oct 2016 03:57:52 +0000 (03:57 +0000)]
[AArch64][InstrustionSelector] Teach the selector about G_BITCAST.

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

7 years ago[AArch64][InstructionSelector] Refactor the handling of copies.
Quentin Colombet [Wed, 12 Oct 2016 03:57:49 +0000 (03:57 +0000)]
[AArch64][InstructionSelector] Refactor the handling of copies.

Although Copies are not specific to preISel, we still have to assign them
a proper register class. However, given they are not constrained to
anything we do not have to handle the source register at the copy. It
will be properly mapped when reaching the related definition.

In the process, the handlong of G_ANYEXT is slightly modified as those
end up being selected as copy. The difference is that when register size
do not match on both sides, we need to insert SUBREG_TO_REG operation,
otherwise the post RA copy expansion will not be happy!

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

7 years ago[AArch64][InstructionSelector] Fix typos in the related mir file. NFC.
Quentin Colombet [Wed, 12 Oct 2016 03:57:46 +0000 (03:57 +0000)]
[AArch64][InstructionSelector] Fix typos in the related mir file. NFC.

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

7 years ago[AArch64][MachineLegalizer] Mark more bitcasts as legal.
Quentin Colombet [Wed, 12 Oct 2016 03:57:43 +0000 (03:57 +0000)]
[AArch64][MachineLegalizer] Mark more bitcasts as legal.

Those are copies, we do not have to do any legalization action for them.

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

7 years ago[lit] Run unit tests as part of lit test suite
Brian Gesiak [Wed, 12 Oct 2016 03:35:04 +0000 (03:35 +0000)]
[lit] Run unit tests as part of lit test suite

Summary:
The Python file `utils/lit/lit/ShUtil.py` contains:

1. Logic used by lit itself
2. A set of unit tests for that logic, which can be run by invoking
  `python utils/lit/lit/ShUtil.py`

Move these unit tests to a `tests/unit` subdirectory of lit, and run
the tests as part of lit's test suite. This ensures that, should the
lit test suite be included in LLVM's own regression test suite, these
unit tests will also be run.

(Instructions on how to run lit's test suite can be found in
`utils/lit/README.txt`.)

Reviewers: ddunbar, echristo, delcypher, beanz

Subscribers: mehdi_amini, llvm-commits

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

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

7 years agoMemory-SSA cleanup of clobbers interface, NFC
Sebastian Pop [Wed, 12 Oct 2016 03:08:40 +0000 (03:08 +0000)]
Memory-SSA cleanup of clobbers interface, NFC

This implements the cleanup that Danny asked to commit separately from the
previous fix to GVN-hoist in https://reviews.llvm.org/D25476#inline-219818

Tested with ninja check on x86_64-linux.

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

7 years agoGVN-hoist: fix store past load dependence analysis (PR30216, PR30499)
Sebastian Pop [Wed, 12 Oct 2016 02:23:39 +0000 (02:23 +0000)]
GVN-hoist: fix store past load dependence analysis (PR30216, PR30499)

This is a refreshed version of a patch that was reverted: it fixes
the problems reported in both PR30216 and PR30499, and
contains all the test-cases from both bugs.

To hoist stores past loads, we used to search for potential
conflicting loads on the hoisting path by following a MemorySSA
def-def link from the store to be hoisted to the previous
defining memory access, and from there we followed the def-use
chains to all the uses that occur on the hoisting path. The
problem is that the def-def link may point to a store that does
not alias with the store to be hoisted, and so the loads that are
walked may not alias with the store to be hoisted, and even as in
the testcase of PR30216, the loads that may alias with the store
to be hoisted are not visited.

The current patch visits all loads on the path from the store to
be hoisted to the hoisting position and uses the alias analysis
to ask whether the store may alias the load. I was not able to
use the MemorySSA functionality to ask for whether load and
store are clobbered: I'm not sure which function to call, so I
used a call to AA->isNoAlias().

Store past store is still working as before using a MemorySSA
query: I added an extra test to pr30216.ll to make sure store
past store does not regress.

Tested on x86_64-linux with check and a test-suite run.

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

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

7 years ago[PPCMIPeephole] Fix splat elimination
Tim Shen [Wed, 12 Oct 2016 00:48:25 +0000 (00:48 +0000)]
[PPCMIPeephole] Fix splat elimination

Summary:
In PPCMIPeephole, when we see two splat instructions, we can't simply do the following transformation:
  B = Splat A
  C = Splat B
=>
  C = Splat A
because B may still be used between these two instructions. Instead, we should make the second Splat a PPC::COPY and let later passes decide whether to remove it or not:
  B = Splat A
  C = Splat B
=>
  B = Splat A
  C = COPY B

Fixes PR30663.

Reviewers: echristo, iteratee, kbarton, nemanjai

Subscribers: mehdi_amini, llvm-commits

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

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

7 years agoFix the stage2 MSVC 2013 build with less constexpr in RNG
Reid Kleckner [Tue, 11 Oct 2016 23:02:21 +0000 (23:02 +0000)]
Fix the stage2 MSVC 2013 build with less constexpr in RNG

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

7 years ago[DAG] Fix crash in build_vector -> vector_shuffle combine
Michael Kuperstein [Tue, 11 Oct 2016 22:44:31 +0000 (22:44 +0000)]
[DAG] Fix crash in build_vector -> vector_shuffle combine

Fixes a crash in the build_vector -> vector_shuffle combine
when the first vector input is twice as wide as the output,
and the second input vector is even wider.

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

7 years agoGlobalISel: support same-size casts on AArch64.
Tim Northover [Tue, 11 Oct 2016 22:29:23 +0000 (22:29 +0000)]
GlobalISel: support same-size casts on AArch64.

Mostly Ahmed's work again, I'm just sprucing things up slightly before
committing.

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

7 years ago[InstrProf] Add support for dead_strip+live_support functionality
Vedant Kumar [Tue, 11 Oct 2016 21:48:16 +0000 (21:48 +0000)]
[InstrProf] Add support for dead_strip+live_support functionality

On Darwin, marking a section as "regular,live_support" means that a
symbol in the section should only be kept live if it has a reference to
something that is live. Otherwise, the linker is free to dead-strip it.

Turn this functionality on for the __llvm_prf_data section.

This means that counters and data associated with dead functions will be
removed from dead-stripped binaries. This will result in smaller
profiles and binaries, and should speed up profile collection.

Tested with check-profile, llvm-lit test/tools/llvm-{cov,profdata}, and
check-llvm.

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

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

7 years ago[libFuzzer] refactoring to speed things up, NFC
Kostya Serebryany [Tue, 11 Oct 2016 21:27:37 +0000 (21:27 +0000)]
[libFuzzer] refactoring to speed things up, NFC

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

7 years agoRe-land "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"
Reid Kleckner [Tue, 11 Oct 2016 21:14:03 +0000 (21:14 +0000)]
Re-land "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"

Reverts r283938 to reinstate r283867 with a fix.

The original change had an ArrayRef referring to a destroyed temporary
initializer list. Use plain C arrays instead.

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

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Tue, 11 Oct 2016 21:04:39 +0000 (21:04 +0000)]
Next set of additional error checks for invalid Mach-O files for the
load commands that uses the MachO::linker_option_command
type but not used in llvm libObject code but used in llvm tool code.

This includes just LC_LINKER_OPTION load command.

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

7 years agoRevert "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"
Reid Kleckner [Tue, 11 Oct 2016 20:54:41 +0000 (20:54 +0000)]
Revert "[Thumb] Save/restore high registers in Thumb1 pro/epilogues"

This reverts r283867.

This appears to be an infinite loop:

    while (HiRegToSave != AllHighRegs.end() && CopyReg != AllCopyRegs.end()) {
      if (HiRegsToSave.count(*HiRegToSave)) {
        ...

        CopyReg = findNextOrderedReg(++CopyReg, CopyRegs, AllCopyRegs.end());
        HiRegToSave =
            findNextOrderedReg(++HiRegToSave, HiRegsToSave, AllHighRegs.end());
      }
    }

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

7 years agoGlobalISel: support selection of extend operations.
Tim Northover [Tue, 11 Oct 2016 20:50:21 +0000 (20:50 +0000)]
GlobalISel: support selection of extend operations.

Patch mostly by Ahmed Bougaca.

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

7 years agoMIRParser: allow types on registers with a RegBank.
Tim Northover [Tue, 11 Oct 2016 20:50:04 +0000 (20:50 +0000)]
MIRParser: allow types on registers with a RegBank.

This fixes some GlobalISel regression tests.

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

7 years agoRe-apply "Disallow ArrayRef assignment from temporaries."
Jordan Rose [Tue, 11 Oct 2016 20:39:16 +0000 (20:39 +0000)]
Re-apply "Disallow ArrayRef assignment from temporaries."

This re-applies r283798, disabled in r283803, with the static_assert
tests disabled under MSVC. The deleted functions still seem to catch
mistakes in MSVC, so it's not a significant loss.

Part of rdar://problem/16375365

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

7 years agoCodegen: Tail-duplicate during placement.
Kyle Butt [Tue, 11 Oct 2016 20:36:43 +0000 (20:36 +0000)]
Codegen: Tail-duplicate during placement.

The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.

In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.

This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.

Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.

Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.

Issue with early tail-duplication of blocks that branch to a fallthrough
predecessor fixed with test case: tail-dup-branch-to-fallthrough.ll

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

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

7 years ago[x86] add tests for negate bool
Sanjay Patel [Tue, 11 Oct 2016 20:15:20 +0000 (20:15 +0000)]
[x86] add tests for negate bool

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

7 years agoAvoid braced initialization for default member initializers for MSVC 2013
Reid Kleckner [Tue, 11 Oct 2016 20:02:57 +0000 (20:02 +0000)]
Avoid braced initialization for default member initializers for MSVC 2013

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

7 years agoSilence -Wunused-but-set-variable warning
Arnold Schwaighofer [Tue, 11 Oct 2016 19:49:29 +0000 (19:49 +0000)]
Silence -Wunused-but-set-variable warning

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

7 years agoRe-submit r283823: Define DbiStreamBuilder::addDbgStream to add stream.
Rui Ueyama [Tue, 11 Oct 2016 19:43:12 +0000 (19:43 +0000)]
Re-submit r283823: Define DbiStreamBuilder::addDbgStream to add stream.

The previous commit was failing because we filled empty slots of
the debug stream index with kInvalidStreamIndex. It should've been 0.

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

7 years ago[sanitizer-coverage] use private linkage for coverage guards, delete old commented...
Kostya Serebryany [Tue, 11 Oct 2016 19:36:50 +0000 (19:36 +0000)]
[sanitizer-coverage] use private linkage for coverage guards, delete old commented-out code.

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

7 years agoFix build error on LP64 platforms.
Rui Ueyama [Tue, 11 Oct 2016 19:28:56 +0000 (19:28 +0000)]
Fix build error on LP64 platforms.

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

7 years ago[raw_ostream] Raise some helper functions out of raw_ostream.
Zachary Turner [Tue, 11 Oct 2016 19:24:45 +0000 (19:24 +0000)]
[raw_ostream] Raise some helper functions out of raw_ostream.

Low level functionality to format numbers were embedded in the
implementation of raw_ostream.  I have need to use these through
an interface other than the overloaded stream operators, so they
need to be raised to a level that they can be used from either
raw_ostream operators or other code.

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

7 years ago[AMDGPU] Refactor waitcnt encoding
Konstantin Zhuravlyov [Tue, 11 Oct 2016 18:58:22 +0000 (18:58 +0000)]
[AMDGPU] Refactor waitcnt encoding

- Refactor bit packing/unpacking
- Calculate bit mask given bit shift and bit width
- Introduce function for decoding bits of waitcnt
- Introduce function for encoding bits of waitcnt
- Introduce function for getting waitcnt mask (instead of using bare numbers)
- Introduce function fot getting max waitcnt(s) (instead of using bare numbers)

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

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

7 years agoAllow Switch instruction to have extractProfTotalWeight called as it can terminate...
Dehao Chen [Tue, 11 Oct 2016 18:53:00 +0000 (18:53 +0000)]
Allow Switch instruction to have extractProfTotalWeight called as it can terminate a basic block. (NFC)

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

7 years agoAvoid unnecessary constexpr to appease MSVC 2013
Reid Kleckner [Tue, 11 Oct 2016 18:35:13 +0000 (18:35 +0000)]
Avoid unnecessary constexpr to appease MSVC 2013

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

7 years agoFix "static initialization order fiasco" for the XCore Target.
Mehdi Amini [Tue, 11 Oct 2016 18:22:41 +0000 (18:22 +0000)]
Fix "static initialization order fiasco" for the XCore Target.

I fixed all the other Targets in r283702, and interestingly the
sanitizers are only now "sometimes" catching this bug on the only
one I missed.

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

7 years ago[Support] Fix undefined behavior in RandomNumberGenerator.
Zachary Turner [Tue, 11 Oct 2016 18:17:26 +0000 (18:17 +0000)]
[Support] Fix undefined behavior in RandomNumberGenerator.

This has existed pretty much forever AFAICT, but the code was
never being exercised because nobody was using the class.  A
user of this class surfaced, and now we're breaking with UB.
The code was obviously wrong, so it's fixed here.

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

7 years ago[AMDGPU] Fix test that was broken by rL283893
Konstantin Zhuravlyov [Tue, 11 Oct 2016 18:16:56 +0000 (18:16 +0000)]
[AMDGPU] Fix test that was broken by rL283893

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

7 years agoARMMachineFunctionInfo.cpp: Add an initializer of ARMFunctionInfo::ReturnRegsCount...
NAKAMURA Takumi [Tue, 11 Oct 2016 17:38:30 +0000 (17:38 +0000)]
ARMMachineFunctionInfo.cpp: Add an initializer of ARMFunctionInfo::ReturnRegsCount in the explicit ctor.

It caused crash since r283867.

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

7 years agoReformat.
NAKAMURA Takumi [Tue, 11 Oct 2016 17:38:25 +0000 (17:38 +0000)]
Reformat.

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

7 years ago[DAG] add fold for masked negated sign-extended bool
Sanjay Patel [Tue, 11 Oct 2016 17:05:52 +0000 (17:05 +0000)]
[DAG] add fold for masked negated sign-extended bool

This enhances the fold added with:
https://reviews.llvm.org/rL283900

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

7 years ago[x86] add sext variants of tests added with r283894
Sanjay Patel [Tue, 11 Oct 2016 16:49:52 +0000 (16:49 +0000)]
[x86] add sext variants of tests added with r283894

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

7 years agoLet test pass for builds that support X86, but do not default to it
Bernard Ogden [Tue, 11 Oct 2016 16:34:49 +0000 (16:34 +0000)]
Let test pass for builds that support X86, but do not default to it

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

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

7 years agoFix test on non-x86 hosts
Bernard Ogden [Tue, 11 Oct 2016 16:32:37 +0000 (16:32 +0000)]
Fix test on non-x86 hosts

Summary:
This test is allowed to run on non-x86 hosts and thus must use
llvm-nm rather than nm.

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

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

7 years ago[DAG] add fold for masked negated extended bool
Sanjay Patel [Tue, 11 Oct 2016 16:26:36 +0000 (16:26 +0000)]
[DAG] add fold for masked negated extended bool

The non-obvious motivation for adding this fold (which already happens in InstCombine)
is that we want to canonicalize IR towards select instructions and canonicalize DAG
nodes towards boolean math. So we need to recreate some folds in the DAG to handle that
change in direction.

An interesting implementation difference for cases like this is that InstCombine
generally works top-down while the DAG goes bottom-up. That means we need to detect
different patterns. In this case, the SimplifyDemandedBits fold prevents us from
performing a zext to sext fold that would then be recognized as a negation of a sext.

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

7 years agoSilence unused warning in non-assert builds.
Daniel Jasper [Tue, 11 Oct 2016 16:22:36 +0000 (16:22 +0000)]
Silence unused warning in non-assert builds.

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

7 years ago[opt-viewer] Remove unnecessary call to demangle
Adam Nemet [Tue, 11 Oct 2016 16:20:40 +0000 (16:20 +0000)]
[opt-viewer] Remove unnecessary call to demangle

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

7 years ago[opt-viewer] Print hotness as percentage of the maximum hotness
Adam Nemet [Tue, 11 Oct 2016 16:20:38 +0000 (16:20 +0000)]
[opt-viewer] Print hotness as percentage of the maximum hotness

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

7 years ago[opt-viewer] Convert another HTML output to use a multiline string
Adam Nemet [Tue, 11 Oct 2016 16:19:06 +0000 (16:19 +0000)]
[opt-viewer] Convert another HTML output to use a multiline string

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

7 years ago[x86] add tests to show missed folds for masked bools
Sanjay Patel [Tue, 11 Oct 2016 16:04:37 +0000 (16:04 +0000)]
[x86] add tests to show missed folds for masked bools

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

7 years agoAMDGPU/SI: Update ISA version numbers for Tonga and Polaris10/11.
Changpeng Fang [Tue, 11 Oct 2016 16:00:47 +0000 (16:00 +0000)]
AMDGPU/SI: Update ISA version numbers for Tonga and Polaris10/11.

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

Reviewers:
  tstellarAMD

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

7 years ago[cl] Don't print subcommand help when no subcommands present.
Zachary Turner [Tue, 11 Oct 2016 15:58:48 +0000 (15:58 +0000)]
[cl] Don't print subcommand help when no subcommands present.

Previously we would print

  USAGE: <exe> [subcommand] [options]

Even if no subcommands were present.  This changes the output
format to only print "[subcommand]" if there is at least one
subcommand.

Fixes llvm.org/pr30598

Patch by Serge Guelton

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

7 years ago[DAG] simplify logic; NFC
Sanjay Patel [Tue, 11 Oct 2016 14:14:30 +0000 (14:14 +0000)]
[DAG] simplify logic; NFC

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

7 years ago[DAG] hoist DL(N) and fix formatting; NFC
Sanjay Patel [Tue, 11 Oct 2016 14:04:24 +0000 (14:04 +0000)]
[DAG] hoist DL(N) and fix formatting; NFC

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

7 years ago[X86][SSE] Regenerate scalar i64 uitofp test
Simon Pilgrim [Tue, 11 Oct 2016 14:01:38 +0000 (14:01 +0000)]
[X86][SSE] Regenerate scalar i64 uitofp test

Added 32-bit target test

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

7 years ago[X86][SSE] Regenerate vector load-trunc test
Simon Pilgrim [Tue, 11 Oct 2016 13:55:49 +0000 (13:55 +0000)]
[X86][SSE] Regenerate vector load-trunc test

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

7 years ago[X86][SSE] Regenerate vsplit and tests
Simon Pilgrim [Tue, 11 Oct 2016 13:51:44 +0000 (13:51 +0000)]
[X86][SSE] Regenerate vsplit and tests

To make it more obvious how bad some of that truncation code is....

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

7 years ago[DAG] fix formatting; NFC
Sanjay Patel [Tue, 11 Oct 2016 13:47:43 +0000 (13:47 +0000)]
[DAG] fix formatting; NFC

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

7 years ago[LCSSA] Implement linear algorithm for the isRecursivelyLCSSAForm
Igor Laevsky [Tue, 11 Oct 2016 13:37:22 +0000 (13:37 +0000)]
[LCSSA] Implement linear algorithm for the isRecursivelyLCSSAForm

For each block check that it doesn't have any uses outside of it's innermost loop.

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

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

7 years ago[x86] update test to use FileCheck and auto-generate checks
Sanjay Patel [Tue, 11 Oct 2016 13:36:07 +0000 (13:36 +0000)]
[x86] update test to use FileCheck and auto-generate checks

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

7 years ago[Support/ELF] - Add OpenBSD PT_OPENBSD_RANDOMIZE, PT_OPENBSD_WXNEEDED constants.
George Rimar [Tue, 11 Oct 2016 11:53:33 +0000 (11:53 +0000)]
[Support/ELF] - Add OpenBSD PT_OPENBSD_RANDOMIZE, PT_OPENBSD_WXNEEDED constants.

Docs for reference:
http://man.openbsd.org/OpenBSD-current/man5/elf.5
https://github.com/openbsd/src/commit/2a5a8fc7e30928c2cff57cfe5fb491c90d8478ad

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

7 years ago[Thumb] Save/restore high registers in Thumb1 pro/epilogues
Oliver Stannard [Tue, 11 Oct 2016 10:12:25 +0000 (10:12 +0000)]
[Thumb] Save/restore high registers in Thumb1 pro/epilogues

The high registers are not allocatable in Thumb1 functions, but they
could still be used by inline assembly, so we need to save and restore
the callee-saved high registers (r8-r11) in the prologue and epilogue.

This is complicated by the fact that the Thumb1 push and pop
instructions cannot access these registers. Therefore, we have to move
them down into low registers before pushing, and move them back after
popping into low registers.

In most functions, we will have low registers that are also being
pushed/popped, which we can use as the temporary registers for
saving/restoring the high registers. However, this is not guaranteed, so
we may need to push some extra low registers to ensure that the high
registers can be saved/restored. For correctness, it would be sufficient
to use just one low register, but if we have enough low registers
available then we only need one push/pop instruction, rather than one
per high register.

We can also use the argument/return registers when they are not live,
and the link register when saving (but not restoring), reducing the
number of extra registers we need to push.

There are still a few extreme edge cases where we need two push/pop
instructions, because not enough low registers can be made live in the
prologue or epilogue.

In addition to the regression tests included here, I've also tested this
using a script to generate functions which clobber different
combinations of registers, have different numbers of argument and return
registers (including variadic arguments), allocate different fixed sized
objects on the stack, and do or don't use variable sized allocas and the
__builtin_return_address intrinsic (all of which affect the available
registers in the prologue and epilogue). I ran these functions in a test
harness which verifies that all of the callee-saved registers are
correctly preserved.

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

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

7 years ago[ARM] Fix registers clobbered by SjLj EH on soft-float targets
Oliver Stannard [Tue, 11 Oct 2016 10:06:59 +0000 (10:06 +0000)]
[ARM] Fix registers clobbered by SjLj EH on soft-float targets

Currently, the Int_eh_sjlj_dispatchsetup intrinsic is marked as
clobbering all registers, including floating-point registers that may
not be present on the target. This is technically true, as we could get
linked against code that does use the FP registers, but that will not
actually work, as the soft-float code cannot save and restore the FP
registers. SjLj exception handling can only work correctly if either all
or none of the code is built for a target with FP registers. Therefore,
we can assume that, when Int_eh_sjlj_dispatchsetup is compiled for a
soft-float target, it is only going to be linked against other
soft-float code, and so only clobbers the general-purpose registers.
This allows us to check that no non-savable registers are clobbered when
generating the prologue/epilogue.

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

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

7 years ago[AArch64] Allow label arithmetic with add/sub/cmp
Diana Picus [Tue, 11 Oct 2016 09:17:47 +0000 (09:17 +0000)]
[AArch64] Allow label arithmetic with add/sub/cmp

Allow instructions such as 'cmp w0, #(end - start)' by folding the
expression into a constant. For ELF, we fold only if the symbols are in
the same section. For MachO, we fold if the expression contains only
symbols that are not linker visible.

Fixes https://llvm.org/bugs/show_bug.cgi?id=18920

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

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

7 years agoFix formatting in findRegisterUseOperandIdx. NFC.
Fraser Cormack [Tue, 11 Oct 2016 09:09:21 +0000 (09:09 +0000)]
Fix formatting in findRegisterUseOperandIdx. NFC.

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

7 years agoReverted r283740 [Object/ELF] - Do not crash on invalid Header->e_shoff value.
George Rimar [Tue, 11 Oct 2016 08:12:27 +0000 (08:12 +0000)]
Reverted r283740 [Object/ELF] - Do not crash on invalid Header->e_shoff value.

Bot does not like it: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/17075

/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Object/invalid.test:70:32: error: expected string not found in input
INVALID-SEC-ADDRESS-ALIGNMENT: Invalid address alignment of section headers
                               ^
<stdin>:1:1: note: scanning from here
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<llvm::support::endianness::little, true> >', which requires 2 byte alignment
^
<stdin>:1:125: note: possible intended match here
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<llvm::support::endianness::little, true> >', which requires 2 byte alignment

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