OSDN Git Service

android-x86/external-llvm.git
7 years ago[LoopUnswitch] Don't remove instructions with side effects.
Davide Italiano [Sat, 29 Apr 2017 00:12:18 +0000 (00:12 +0000)]
[LoopUnswitch] Don't remove instructions with side effects.

This fixes PR32818.

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

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

7 years ago[llvm-readobj] Fix incorrect printing of CV column info.
Zachary Turner [Sat, 29 Apr 2017 00:03:32 +0000 (00:03 +0000)]
[llvm-readobj] Fix incorrect printing of CV column info.

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

7 years agoFuzzer: Mark test/cxxstring.test UNSUPPORTED: windows
Duncan P. N. Exon Smith [Fri, 28 Apr 2017 23:59:53 +0000 (23:59 +0000)]
Fuzzer: Mark test/cxxstring.test UNSUPPORTED: windows

This has been mysteriously failing since r301593, which cleaned up the
types of things like size_t and SIZE_MAX for freestanding targets.  Reid
and Kostya suggested marking it as UNSUPPORTED on windows, given that no
one has been able to reproduce locally.

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

7 years ago[llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.
Zachary Turner [Fri, 28 Apr 2017 23:41:36 +0000 (23:41 +0000)]
[llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.

The llvm-readobj parsing code currently exists in our CodeView
library, so we use that to parse instead of re-writing the logic
in the tool.

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

7 years ago[Support] Provide unsafe random access for VarStreamArray.
Zachary Turner [Fri, 28 Apr 2017 23:29:33 +0000 (23:29 +0000)]
[Support] Provide unsafe random access for VarStreamArray.

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

7 years ago[InstCombine] add tests to show potentially bogus application of DeMorgan (NFC)
Sanjay Patel [Fri, 28 Apr 2017 23:14:33 +0000 (23:14 +0000)]
[InstCombine] add tests to show potentially bogus application of DeMorgan (NFC)

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

7 years agoRemove set but unused variable in BitcodeReader.cpp. NFC.
Hans Wennborg [Fri, 28 Apr 2017 23:11:16 +0000 (23:11 +0000)]
Remove set but unused variable in BitcodeReader.cpp. NFC.

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

7 years agoRevert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"
Hans Wennborg [Fri, 28 Apr 2017 23:01:32 +0000 (23:01 +0000)]
Revert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"

This broke the Clang build. (Clang-side patch missing?)

Original commit message:

> [IR] Make add/remove Attributes use AttrBuilder instead of
> AttributeList
>
> This change cleans up call sites and avoids creating temporary
> AttributeList objects.
>
> NFC

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

7 years agoInferAddressSpaces: Search constant expressions for addrspacecasts
Matt Arsenault [Fri, 28 Apr 2017 22:52:41 +0000 (22:52 +0000)]
InferAddressSpaces: Search constant expressions for addrspacecasts

These are pretty common when using local memory, and the 64-bit generic
addressing is much more expensive to compute.

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

7 years agoRemove line and file from DINamespace.
Adrian Prantl [Fri, 28 Apr 2017 22:25:46 +0000 (22:25 +0000)]
Remove line and file from DINamespace.

Fixes the issue highlighted in
http://lists.llvm.org/pipermail/cfe-dev/2014-June/037500.html.

The DW_AT_decl_file and DW_AT_decl_line attributes on namespaces can
prevent LLVM from uniquing types that are in the same namespace. They
also don't carry any meaningful information.

rdar://problem/17484998
Differential Revision: https://reviews.llvm.org/D32648

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

7 years agoInferAddressSpaces: Avoid looking up deleted values
Matt Arsenault [Fri, 28 Apr 2017 22:18:19 +0000 (22:18 +0000)]
InferAddressSpaces: Avoid looking up deleted values

While looking at pure addressing expressions, it's possible
for the value to appear later in Postorder.

I haven't been able to come up with a testcase where this
exhibits an actual issue, but if you insert a dump before
the value map lookup, a few testcases crash.

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

7 years agoInferAddressSpaces: Infer from just addrspacecasts
Matt Arsenault [Fri, 28 Apr 2017 22:18:08 +0000 (22:18 +0000)]
InferAddressSpaces: Infer from just addrspacecasts

Eliminates some more cases where some subset of the addressing
computation remains flat. Some cases with addrspacecasts
in nested constant expressions are still left behind however.

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

7 years ago[SCEV] Use early exit in createAddRecFromPHI. NFC.
Michael Zolotukhin [Fri, 28 Apr 2017 22:14:27 +0000 (22:14 +0000)]
[SCEV] Use early exit in createAddRecFromPHI. NFC.

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

7 years agoLoopRotate: Fix use after scope bug
Daniel Berlin [Fri, 28 Apr 2017 22:05:55 +0000 (22:05 +0000)]
LoopRotate: Fix use after scope bug

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

7 years ago[RDF] Correctly calculate lane masks for defs
Krzysztof Parzyszek [Fri, 28 Apr 2017 21:57:53 +0000 (21:57 +0000)]
[RDF] Correctly calculate lane masks for defs

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

7 years agoProperly handle PHIs with subregisters in UnreachableBlockElim
Krzysztof Parzyszek [Fri, 28 Apr 2017 21:56:33 +0000 (21:56 +0000)]
Properly handle PHIs with subregisters in UnreachableBlockElim

When a PHI operand has a subregister, create a COPY instead of simply
replacing the PHI output with the input it.

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

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

7 years ago[Hexagon] Do not move a block if it is on a fall-through path
Krzysztof Parzyszek [Fri, 28 Apr 2017 21:54:11 +0000 (21:54 +0000)]
[Hexagon] Do not move a block if it is on a fall-through path

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

7 years ago[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList
Reid Kleckner [Fri, 28 Apr 2017 21:48:28 +0000 (21:48 +0000)]
[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList

This change cleans up call sites and avoids creating temporary
AttributeList objects.

NFC

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

7 years ago[ConstantRange] Use APInt::isNullValue rather than APInt::isMinValue where it would...
Craig Topper [Fri, 28 Apr 2017 21:48:09 +0000 (21:48 +0000)]
[ConstantRange] Use APInt::isNullValue rather than APInt::isMinValue where it would make more sense to thing of 0 as 0 rather than the minimum unsigned value. NFC

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

7 years ago[APInt] Add an isNullValue method to check for all bits being zero. Use it in a coupl...
Craig Topper [Fri, 28 Apr 2017 21:48:06 +0000 (21:48 +0000)]
[APInt] Add an isNullValue method to check for all bits being zero. Use it in a couple internal methods where it makes more sense than isMinValue or !getBoolValue. NFC

I used Null rather than Zero to match the getNullValue method name.

There are some other places outside APInt where isNullValue would be more readable than isMinValue even though they do the same thing. I'll update those in future patches.

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

7 years ago[ConstantRange] Use const references to prevent a couple APInt copies. NFC
Craig Topper [Fri, 28 Apr 2017 21:48:03 +0000 (21:48 +0000)]
[ConstantRange] Use const references to prevent a couple APInt copies. NFC

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

7 years ago[LoopUnswitch] Make DEBUG output more readable.
Davide Italiano [Fri, 28 Apr 2017 21:30:50 +0000 (21:30 +0000)]
[LoopUnswitch] Make DEBUG output more readable.

While debugging a miscompile I realized loopunswitch doesn't
put newlines when printing the instruction being replacement.
Ending up with a single line with many instruction replaced isn't
the best for readability and/or mental sanity.

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

7 years ago[WebAssembly] Add size of section header to data relocation offsets.
Sam Clegg [Fri, 28 Apr 2017 21:22:38 +0000 (21:22 +0000)]
[WebAssembly] Add size of section header to data relocation offsets.

Also, add test for data relocations and fix addend to
be signed.

Subscribers: jfb, dschuff

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

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

7 years ago[ValueTracking] Teach isSafeToSpeculativelyExecute() about the speculatable attribute
Matt Arsenault [Fri, 28 Apr 2017 21:13:09 +0000 (21:13 +0000)]
[ValueTracking] Teach isSafeToSpeculativelyExecute() about the speculatable attribute

Patch by Tom Stellard

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

7 years ago[WebAssembly] Write initial memory in pages not bytes
Sam Clegg [Fri, 28 Apr 2017 21:12:09 +0000 (21:12 +0000)]
[WebAssembly] Write initial memory in pages not bytes

Subscribers: jfb, dschuff

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

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

7 years agoTableGen: Add IntrHasSideEffects property for intrinsics
Matt Arsenault [Fri, 28 Apr 2017 21:01:46 +0000 (21:01 +0000)]
TableGen: Add IntrHasSideEffects property for intrinsics

The IntrNoMem, IntrReadMem, IntrWriteMem, and IntrArgMemOnly intrinsic
properties differ from their corresponding LLVM IR attributes by specifying
that the intrinsic, in addition to its memory properties, has no other side
effects.

The IntrHasSideEffects flag used in combination with one of the memory flags
listed above, makes it possible to define an intrinsic such that its
properties at the CodeGen layer match its properties at the IR layer.

Patch by Tom Stellard

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

7 years agoMake getParamAlignment use argument numbers
Reid Kleckner [Fri, 28 Apr 2017 20:34:27 +0000 (20:34 +0000)]
Make getParamAlignment use argument numbers

The method is called "get *Param* Alignment", and is only used for
return values exactly once, so it should take argument indices, not
attribute indices.

Avoids confusing code like:
  IsSwiftError = CS->paramHasAttr(ArgIdx, Attribute::SwiftError);
  Alignment  = CS->getParamAlignment(ArgIdx + 1);

Add getRetAlignment to handle the one case in Value.cpp that wants the
return value alignment.

This is a potentially breaking change for out-of-tree backends that do
their own call lowering.

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

7 years agoGlobalISel: Followup for r301679
Matthias Braun [Fri, 28 Apr 2017 20:31:49 +0000 (20:31 +0000)]
GlobalISel: Followup for r301679

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

7 years agoAdd speculatable function attribute
Matt Arsenault [Fri, 28 Apr 2017 20:25:27 +0000 (20:25 +0000)]
Add speculatable function attribute

This attribute tells the optimizer that the function may be speculated.

Patch by Tom Stellard

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

7 years agoTargetLowering: Add finalizeLowering() function; NFC
Matthias Braun [Fri, 28 Apr 2017 20:25:05 +0000 (20:25 +0000)]
TargetLowering: Add finalizeLowering() function; NFC

Adds a new method finalizeLowering to TargetLoweringBase. This is in
preparation for an upcoming commit.

This function is meant for target specific adjustments to
MachineFrameInfo or register reservations.

Move the freezeRegisters() and the hasCopyImplyingStackAdjustment()
handling into the new function to prove the concept. As an added bonus
GlobalISel no longer missed the hasCopyImplyingStackAdjustment()
handling with this.

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

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

7 years agoAMDGPU: Add new amdgcn.init.exec intrinsics
Marek Olsak [Fri, 28 Apr 2017 20:21:58 +0000 (20:21 +0000)]
AMDGPU: Add new amdgcn.init.exec intrinsics

v2: More tests, bug fixes, cosmetic changes.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

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

7 years agolimit to 2 parallel links when using thinlto
Bob Haarman [Fri, 28 Apr 2017 20:17:15 +0000 (20:17 +0000)]
limit to 2 parallel links when using thinlto

Summary:
When using ThinLTO, the linker performs its own parallelism. This
change limits the number of parallel link jobs that Ninja will issue
to keep the total number of threads reasonable when linking with
ThinLTO.

Reviewers: hans, ruiu

Subscribers: mgorny, mehdi_amini, Prazek

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

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

7 years agoKill off the old SimplifyInstruction API by converting remaining users.
Daniel Berlin [Fri, 28 Apr 2017 19:55:38 +0000 (19:55 +0000)]
Kill off the old SimplifyInstruction API by converting remaining users.

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

7 years ago[IPO/MergeFunctions] This function is used only under DEBUG().
Davide Italiano [Fri, 28 Apr 2017 19:39:45 +0000 (19:39 +0000)]
[IPO/MergeFunctions] This function is used only under DEBUG().

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

7 years ago[RS4GC] Simplify attribute handling code NFC
Reid Kleckner [Fri, 28 Apr 2017 19:22:40 +0000 (19:22 +0000)]
[RS4GC] Simplify attribute handling code NFC

Avoids use of AttributeList::getNumSlots, making it easier to change the
underlying implementation.

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

7 years agoUse Argument::hasAttribute and AttributeList::ReturnIndex more
Reid Kleckner [Fri, 28 Apr 2017 18:37:16 +0000 (18:37 +0000)]
Use Argument::hasAttribute and AttributeList::ReturnIndex more

This eliminates many extra 'Idx' induction variables in loops over
arguments in CodeGen/ and Target/. It also reduces the number of places
where we assume that ReturnIndex is 0 and that we should add one to
argument numbers to get the corresponding attribute list index.

NFC

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

7 years agoCleanup: Use DIExpression::prepend in buildDbgValueForSpill(). (NFC)
Adrian Prantl [Fri, 28 Apr 2017 18:30:36 +0000 (18:30 +0000)]
Cleanup: Use DIExpression::prepend in buildDbgValueForSpill(). (NFC)

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

7 years ago[IR] Delete unused Argument::removeAttr overload
Reid Kleckner [Fri, 28 Apr 2017 17:58:18 +0000 (17:58 +0000)]
[IR] Delete unused Argument::removeAttr overload

It doesn't make sense to remove an AttributeList from an argument.

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

7 years agoClean up DIExpression::prependDIExpr a little. (NFC)
Adrian Prantl [Fri, 28 Apr 2017 17:51:05 +0000 (17:51 +0000)]
Clean up DIExpression::prependDIExpr a little. (NFC)

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

7 years agoBitcode: Do not remove empty summary entries when reading a per-module summary.
Peter Collingbourne [Fri, 28 Apr 2017 17:41:43 +0000 (17:41 +0000)]
Bitcode: Do not remove empty summary entries when reading a per-module summary.

This became no longer necessary after D19462 landed, and will be incompatible
with an upcoming change to the summary data structures that changes how we
represent references.

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

7 years agoIR: fix some doxygen grammar (NFC)
Saleem Abdulrasool [Fri, 28 Apr 2017 17:18:28 +0000 (17:18 +0000)]
IR: fix some doxygen grammar (NFC)

Fix a bit of the doxygen grammar that was off that I noticed while
looking at this file for another issue.

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

7 years ago[APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI
Craig Topper [Fri, 28 Apr 2017 16:58:05 +0000 (16:58 +0000)]
[APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI

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

7 years ago[LazyValueInfo] Fix typo in comment. NFC
Craig Topper [Fri, 28 Apr 2017 16:57:59 +0000 (16:57 +0000)]
[LazyValueInfo] Fix typo in comment. NFC

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

7 years ago[ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC
Craig Topper [Fri, 28 Apr 2017 16:57:55 +0000 (16:57 +0000)]
[ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC

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

7 years ago[bpf] add bigendian support to disassembler
Alexei Starovoitov [Fri, 28 Apr 2017 16:51:01 +0000 (16:51 +0000)]
[bpf] add bigendian support to disassembler

. swap 4-bit register encoding, 16-bit offset and 32-bit imm to support big endian archs
. add a test

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301653 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCMake: ignore git stderr when trying to sort out revision. NFC.
Tim Northover [Fri, 28 Apr 2017 16:06:00 +0000 (16:06 +0000)]
CMake: ignore git stderr when trying to sort out revision. NFC.

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

7 years ago[InlineCost] Improve the cost heuristic for Switch
Jun Bum Lim [Fri, 28 Apr 2017 16:04:03 +0000 (16:04 +0000)]
[InlineCost] Improve the cost heuristic for Switch

Summary:
The motivation example is like below which has 13 cases but only 2 distinct targets

```
lor.lhs.false2:                                   ; preds = %if.then
  switch i32 %Status, label %if.then27 [
    i32 -7012, label %if.end35
    i32 -10008, label %if.end35
    i32 -10016, label %if.end35
    i32 15000, label %if.end35
    i32 14013, label %if.end35
    i32 10114, label %if.end35
    i32 10107, label %if.end35
    i32 10105, label %if.end35
    i32 10013, label %if.end35
    i32 10011, label %if.end35
    i32 7008, label %if.end35
    i32 7007, label %if.end35
    i32 5002, label %if.end35
  ]
```
which is compiled into a balanced binary tree like this on AArch64 (similar on X86)

```
.LBB853_9:                              // %lor.lhs.false2
        mov     w8, #10012
        cmp             w19, w8
        b.gt    .LBB853_14
// BB#10:                               // %lor.lhs.false2
        mov     w8, #5001
        cmp             w19, w8
        b.gt    .LBB853_18
// BB#11:                               // %lor.lhs.false2
        mov     w8, #-10016
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#12:                               // %lor.lhs.false2
        mov     w8, #-10008
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#13:                               // %lor.lhs.false2
        mov     w8, #-7012
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_14:                             // %lor.lhs.false2
        mov     w8, #14012
        cmp             w19, w8
        b.gt    .LBB853_21
// BB#15:                               // %lor.lhs.false2
        mov     w8, #-10105
        add             w8, w19, w8
        cmp             w8, #9          // =9
        b.hi    .LBB853_17
// BB#16:                               // %lor.lhs.false2
        orr     w9, wzr, #0x1
        lsl     w8, w9, w8
        mov     w9, #517
        and             w8, w8, w9
        cbnz    w8, .LBB853_23
.LBB853_17:                             // %lor.lhs.false2
        mov     w8, #10013
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_18:                             // %lor.lhs.false2
        mov     w8, #-7007
        add             w8, w19, w8
        cmp             w8, #2          // =2
        b.lo    .LBB853_23
// BB#19:                               // %lor.lhs.false2
        mov     w8, #5002
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#20:                               // %lor.lhs.false2
        mov     w8, #10011
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_21:                             // %lor.lhs.false2
        mov     w8, #14013
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#22:                               // %lor.lhs.false2
        mov     w8, #15000
        cmp             w19, w8
        b.ne    .LBB853_3
```
However, the inline cost model estimates the cost to be linear with the number
of distinct targets and the cost of the above switch is just 2 InstrCosts.
The function containing this switch is then inlined about 900 times.

This change use the general way of switch lowering for the inline heuristic. It
etimate the number of case clusters with the suitability check for a jump table
or bit test. Considering the binary search tree built for the clusters, this
change modifies the model to be linear with the size of the balanced binary
tree. The model is off by default for now :
  -inline-generic-switch-cost=false

This change was originally proposed by Haicheng in D29870.

Reviewers: hans, bmakam, chandlerc, eraman, haicheng, mcrosier

Reviewed By: hans

Subscribers: joerg, aemerson, llvm-commits, rengolin

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

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

7 years agoMove variable local to where ita used. NFCI.
Simon Pilgrim [Fri, 28 Apr 2017 14:42:15 +0000 (14:42 +0000)]
Move variable local to where ita used. NFCI.

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

7 years agoMemory intrinsic value profile optimization: Avoid divide by 0
Teresa Johnson [Fri, 28 Apr 2017 14:30:54 +0000 (14:30 +0000)]
Memory intrinsic value profile optimization: Avoid divide by 0

Summary:
Skip memops if the total value profiled count is 0, we can't correctly
scale up the counts and there is no point anyway.

Reviewers: davidxl

Subscribers: llvm-commits

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

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

7 years ago[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and...
Simon Pilgrim [Fri, 28 Apr 2017 13:21:18 +0000 (13:21 +0000)]
[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and INSERT_VECTOR_ELT (reapplied)

Reapplied r299221 after fix for nondeterminism in ThinLTO builder (rL301599), with extra check for implicit truncation of inserted element.

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

7 years ago[X86][SSE] Added new tests from D32416 to show codegen delta
Simon Pilgrim [Fri, 28 Apr 2017 11:53:08 +0000 (11:53 +0000)]
[X86][SSE] Added new tests from D32416 to show codegen delta

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

7 years ago[X86][SSE] Renames all ones test to better match type.
Simon Pilgrim [Fri, 28 Apr 2017 11:12:30 +0000 (11:12 +0000)]
[X86][SSE] Renames all ones test to better match type.

Added 8f32/4f64 optsize tests discussed on D32416

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

7 years ago[X86][SSE] Add codegen test for _mm_set_pd1 (PR32827)
Simon Pilgrim [Fri, 28 Apr 2017 10:31:42 +0000 (10:31 +0000)]
[X86][SSE] Add codegen test for _mm_set_pd1 (PR32827)

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

7 years ago[ARM] GlobalISel: fixup r301632
Diana Picus [Fri, 28 Apr 2017 09:20:31 +0000 (09:20 +0000)]
[ARM] GlobalISel: fixup r301632

Actually remove ARMInstructionSelector.h... Forgot to stage the removal
in the previous commit.

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

7 years ago[ARM] GlobalISel: Get rid of ARMInstructionSelector.h. NFC.
Diana Picus [Fri, 28 Apr 2017 09:10:38 +0000 (09:10 +0000)]
[ARM] GlobalISel: Get rid of ARMInstructionSelector.h. NFC.

Declare the ARMInstructionSelector in an anonymous namespace, to make it
more in line with the other targets which were migrated to this in
r299637 in order to avoid TableGen'erated headers being included in
non-GlobalISel builds.

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

7 years ago[DWARF] - Fix mistype in dump output of pub* tables. NFC.
George Rimar [Fri, 28 Apr 2017 08:54:10 +0000 (08:54 +0000)]
[DWARF] - Fix mistype in dump output of pub* tables. NFC.

There was a garbage character in output introduced by myself in
r290040 "[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections."

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

7 years ago[DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.
Andrew Ng [Fri, 28 Apr 2017 08:44:30 +0000 (08:44 +0000)]
[DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.

This is a follow up to the fix in r298360 to improve the handling of debug
values when redundant LEAs are removed. The fix in r298360 effectively
discarded the debug values. This patch now attempts to preserve the debug
values by using the DWARF DW_OP_stack_value operation via prependDIExpr.

Moved functions appendOffset and prependDIExpr from Local.cpp to
DebugInfoMetadata.cpp and made them available as static member functions of
DIExpression.

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

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

7 years ago[WebAssembly] Update calls to computeKnownBits after the changes from r301620.
Craig Topper [Fri, 28 Apr 2017 08:15:33 +0000 (08:15 +0000)]
[WebAssembly] Update calls to computeKnownBits after the changes from r301620.

I didn't realize WebAssembly wasn't a default build target so I missed that changes were needed.

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

7 years ago[X86][NFC] Refactor RepMovsRepeats in preparation for D32481.
Clement Courbet [Fri, 28 Apr 2017 07:56:31 +0000 (07:56 +0000)]
[X86][NFC] Refactor RepMovsRepeats in preparation for D32481.

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

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

7 years ago[ARM] GlobalISel: Tighten test. NFC
Diana Picus [Fri, 28 Apr 2017 07:50:47 +0000 (07:50 +0000)]
[ARM] GlobalISel: Tighten test. NFC

Explicitly check types and load sizes in the IRTranslator test.

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

7 years ago[ValueTracking] Convert computeKnownBitsFromRangeMetadata to use KnownBits struct.
Craig Topper [Fri, 28 Apr 2017 06:28:56 +0000 (06:28 +0000)]
[ValueTracking] Convert computeKnownBitsFromRangeMetadata to use KnownBits struct.

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

7 years ago[EarlyCSE] Mark the condition of assume intrinsic as true
Max Kazantsev [Fri, 28 Apr 2017 06:25:39 +0000 (06:25 +0000)]
[EarlyCSE] Mark the condition of assume intrinsic as true

EarlyCSE should not just ignore assumes. It should use the fact that its condition is true for all dominated instructions.

Reviewers: sanjoy, reames, apilipenko, anna, skatkov

Reviewed By: reames, sanjoy

Subscribers: llvm-commits

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

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

7 years ago[EarlyCSE] Remove guards with conditions known to be true
Max Kazantsev [Fri, 28 Apr 2017 06:05:48 +0000 (06:05 +0000)]
[EarlyCSE] Remove guards with conditions known to be true

If a condition is calculated only once, and there are multiple guards on this condition, we should be able
to remove all guards dominated by the first of them. This patch allows EarlyCSE to try to find the condition
of a guard among the known values, and if it is true, remove the guard. Otherwise we keep the guard and
mark its condition as 'true' for future consideration.

Reviewers: sanjoy, reames, apilipenko, skatkov, anna, dberlin

Reviewed By: reames, sanjoy

Subscribers: llvm-commits

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

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

7 years ago[SelectionDAG] Use KnownBits struct in DAG's computeKnownBits and simplifyDemandedBits
Craig Topper [Fri, 28 Apr 2017 05:31:46 +0000 (05:31 +0000)]
[SelectionDAG] Use KnownBits struct in DAG's computeKnownBits and simplifyDemandedBits

This patch replaces the separate APInts for KnownZero/KnownOne with a single KnownBits struct. This is similar to what was done to ValueTracking's version recently.

This is largely a mechanical transformation from KnownZero to Known.Zero.

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

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

7 years ago[SelectionDAG] Use various APInt methods to reduce temporary APInt creation
Craig Topper [Fri, 28 Apr 2017 04:57:59 +0000 (04:57 +0000)]
[SelectionDAG] Use various APInt methods to reduce temporary APInt creation

This patch uses various APInt methods to reduce the number of temporary APInts. These were all found while working through converting SelectionDAG's computeKnownBits to also use the KnownBits struct recently added to the ValueTracking version.

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

7 years agoRemove unnecessary semicolon
Sanjoy Das [Fri, 28 Apr 2017 04:49:32 +0000 (04:49 +0000)]
Remove unnecessary semicolon

This shows up as a -Wpendatic error on GCC.

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

7 years ago[StackMaps] Increase the size of the "location size" field
Sanjoy Das [Fri, 28 Apr 2017 04:48:42 +0000 (04:48 +0000)]
[StackMaps] Increase the size of the "location size" field

Summary:
In some cases LLVM (especially the SLP vectorizer) will create vectors
that are 256 bytes (or larger).  Given that this is intentional[0] is
likely to get more common, this patch updates the StackMap binary
format to deal with the spill locations for said vectors.

This change also bumps the stack map version from 2 to 3.

[0]: https://reviews.llvm.org/D32533#738350

Reviewers: reames, kavon, skatkov, javed.absar

Subscribers: mcrosier, nemanjai, llvm-commits

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

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

7 years agoCOFF Import: expose both symbols
Saleem Abdulrasool [Fri, 28 Apr 2017 04:29:43 +0000 (04:29 +0000)]
COFF Import: expose both symbols

COFF Import libraries which use the obsolete CONSTANT export are
supposed to get two symbols, one with the `_imp_` prefix and one
without.  Ensure that we expose both for iteration.  This is necessary
to fix the librarian with COFF CONSTANT exports.

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

7 years ago[APInt] Use inplace shift methods where possible. NFCI
Craig Topper [Fri, 28 Apr 2017 03:36:24 +0000 (03:36 +0000)]
[APInt] Use inplace shift methods where possible. NFCI

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

7 years ago[llvm-pdbdump] Allow printing only a portion of a stream.
Zachary Turner [Fri, 28 Apr 2017 00:43:38 +0000 (00:43 +0000)]
[llvm-pdbdump] Allow printing only a portion of a stream.

When dumping raw data from a stream, you might know the offset
of a certain record you're interested in, as well as how long
that record is.  Previously, you had to dump the entire stream
and wade through the bytes to find the interesting record.

This patch allows you to specify an offset and length on the
command line, and it will only dump the requested range.

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

7 years ago[WebAssembly] Add some tests for wasm MC layer
Sam Clegg [Fri, 28 Apr 2017 00:36:36 +0000 (00:36 +0000)]
[WebAssembly] Add some tests for wasm MC layer

Subscribers: jfb, dschuff

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

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

7 years ago[SROA] Fix nondeterminism exposed by Simon's r299221.
Davide Italiano [Thu, 27 Apr 2017 23:09:01 +0000 (23:09 +0000)]
[SROA] Fix nondeterminism exposed by Simon's r299221.

Use a SmallSetSetVector instead of a SmallPtrSet as iterating
over the latter is not stable ('<' relies on addresses).

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

7 years agoFix a few pedantic warnings.
Frederich Munch [Thu, 27 Apr 2017 22:10:57 +0000 (22:10 +0000)]
Fix a few pedantic warnings.

Reviewers: zturner, hansw, hans

Reviewed By: hans

Subscribers: hans, llvm-commits

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

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

7 years ago[InstCombine] fix matcher to bind to specific operand (PR32830)
Sanjay Patel [Thu, 27 Apr 2017 21:55:03 +0000 (21:55 +0000)]
[InstCombine] fix matcher to bind to specific operand (PR32830)

Matching any random value would be very wrong:
https://bugs.llvm.org/show_bug.cgi?id=32830

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

7 years agoSpecify something that's true in practice
Sanjoy Das [Thu, 27 Apr 2017 20:55:07 +0000 (20:55 +0000)]
Specify something that's true in practice

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

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:27 +0000 (20:27 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

This is a second re-land of r298158. This time, this feature is
limited to -fdata-sections builds.

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

7 years ago[asan] Put ctor/dtor in comdat.
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:23 +0000 (20:27 +0000)]
[asan] Put ctor/dtor in comdat.

When possible, put ASan ctor/dtor in comdat.

The only reason not to is global registration, which can be
TU-specific. This is not the case when there are no instrumented
globals. This is also limited to ELF targets, because MachO does
not have comdat, and COFF linkers may GC comdat constructors.

The benefit of this is a lot less __asan_init() calls: one per DSO
instead of one per TU. It's also necessary for the upcoming
gc-sections-for-globals change on Linux, where multiple references to
section start symbols trigger quadratic behaviour in gold linker.

This is a second re-land of r298756. This time with a flag to disable
the whole thing to avoid a bug in the gold linker:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

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

7 years ago[X86][SSE] Add tests for broadcast from larger vector loads
Simon Pilgrim [Thu, 27 Apr 2017 20:19:00 +0000 (20:19 +0000)]
[X86][SSE] Add tests for broadcast from larger vector loads

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

7 years ago[llvm-readobj] Dump COFF Resources section.
Zachary Turner [Thu, 27 Apr 2017 19:38:38 +0000 (19:38 +0000)]
[llvm-readobj] Dump COFF Resources section.

This patch dumps the raw bytes of the .rsrc sections that
are present in COFF object and executable files.  Subsequent
patches will parse this information and dump in a more human
readable format.

Differential Revision: https://reviews.llvm.org/D32463
Patch By: Eric Beckmann

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

7 years ago[PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.
Chandler Carruth [Thu, 27 Apr 2017 18:45:20 +0000 (18:45 +0000)]
[PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.

Currently, this pass only focuses on *trivial* loop unswitching. At that
reduced problem it remains significantly better than the current loop
unswitch:
- Old pass is worse than cubic complexity. New pass is (I think) linear.
- New pass is much simpler in its design by focusing on full unswitching. (See
  below for details on this).
- New pass doesn't carry state for thresholds between pass iterations.
- New pass doesn't carry state for correctness (both miscompile and
  infloop) between pass iterations.
- New pass produces substantially better code after unswitching.
- New pass can handle more trivial unswitch cases.
- New pass doesn't recompute the dominator tree for the entire function
  and instead incrementally updates it.

I've ported all of the trivial unswitching test cases from the old pass
to the new one to make sure that major functionality isn't lost in the
process. For several of the test cases I've worked to improve the
precision and rigor of the CHECKs, but for many I've just updated them
to handle the new IR produced.

My initial motivation was the fact that the old pass carried state in
very unreliable ways between pass iterations, and these mechansims were
incompatible with the new pass manager. However, I discovered many more
improvements to make along the way.

This pass makes two very significant assumptions that enable most of these
improvements:

1) Focus on *full* unswitching -- that is, completely removing whatever
   control flow construct is being unswitched from the loop. In the case
   of trivial unswitching, this means removing the trivial (exiting)
   edge. In non-trivial unswitching, this means removing the branch or
   switch itself. This is in opposition to *partial* unswitching where
   some part of the unswitched control flow remains in the loop. Partial
   unswitching only really applies to switches and to folded branches.
   These are very similar to full unrolling and partial unrolling. The
   full form is an effective canonicalization, the partial form needs
   a complex cost model, cannot be iterated, isn't canonicalizing, and
   should be a separate pass that runs very late (much like unrolling).

2) Leverage LLVM's Loop machinery to the fullest. The original unswitch
   dates from a time when a great deal of LLVM's loop infrastructure was
   missing, ineffective, and/or unreliable. As a consequence, a lot of
   complexity was added which we no longer need.

With these two overarching principles, I think we can build a fast and
effective unswitcher that fits in well in the new PM and in the
canonicalization pipeline. Some of the remaining functionality around
partial unswitching may not be relevant today (not many test cases or
benchmarks I can find) but if they are I'd like to add support for them
as a separate layer that runs very late in the pipeline.

Purely to make reviewing and introducing this code more manageable, I've
split this into first a trivial-unswitch-only pass and in the next patch
I'll add support for full non-trivial unswitching against a *fixed*
threshold, exactly like full unrolling. I even plan to re-use the
unrolling thresholds, as these are incredibly similar cost tradeoffs:
we're cloning a loop body in order to end up with simplified control
flow. We should only do that when the total growth is reasonably small.

One of the biggest changes with this pass compared to the previous one
is that previously, each individual trivial exiting edge from a switch
was unswitched separately as a branch. Now, we unswitch the entire
switch at once, with cases going to the various destinations. This lets
us unswitch multiple exiting edges in a single operation and also avoids
numerous extremely bad behaviors, where we would introduce 1000s of
branches to test for thousands of possible values, all of which would
take the exact same exit path bypassing the loop. Now we will use
a switch with 1000s of cases that can be efficiently lowered into
a jumptable. This avoids relying on somehow forming a switch out of the
branches or getting horrible code if that fails for any reason.

Another significant change is that this pass actively updates the CFG
based on unswitching. For trivial unswitching, this is actually very
easy because of the definition of loop simplified form. Doing this makes
the code coming out of loop unswitch dramatically more friendly. We
still should run loop-simplifycfg (at the least) after this to clean up,
but it will have to do a lot less work.

Finally, this pass makes much fewer attempts to simplify instructions
based on the unswitch. Something like loop-instsimplify, instcombine, or
GVN can be used to do increasingly powerful simplifications based on the
now dominating predicate. The old simplifications are things that
something like loop-instsimplify should get today or a very, very basic
loop-instcombine could get. Keeping that logic separate is a big
simplifying technique.

Most of the code in this pass that isn't in the old one has to do with
achieving specific goals:
- Updating the dominator tree as we go
- Unswitching all cases in a switch in a single step.

I think it is still shorter than just the trivial unswitching code in
the old pass despite having this functionality.

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

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

7 years ago[GlobalOpt] Correctly update metadata when localizing a global.
Eli Friedman [Thu, 27 Apr 2017 18:39:08 +0000 (18:39 +0000)]
[GlobalOpt] Correctly update metadata when localizing a global.

Just calling dropAllReferences leaves pointers to the ConstantExpr
behind, so we would eventually crash with a null pointer dereference.

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

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

7 years agoMemory intrinsic value profile optimization: Improve debug output (NFC)
Teresa Johnson [Thu, 27 Apr 2017 18:25:22 +0000 (18:25 +0000)]
Memory intrinsic value profile optimization: Improve debug output (NFC)

Summary:
Misc improvements to debug output. Fix a couple typos and also dump the
value profile before we make any profitability checks.

Reviewers: davidxl

Subscribers: llvm-commits

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

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

7 years agoLimit disabling of warnings emitted from r301571 by checking __GNUC__.
Frederich Munch [Thu, 27 Apr 2017 18:05:29 +0000 (18:05 +0000)]
Limit disabling of warnings emitted from r301571 by checking __GNUC__.

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

7 years agoFix warnings from test added in r301562 on Windows (when built without exceptions).
Frederich Munch [Thu, 27 Apr 2017 17:33:50 +0000 (17:33 +0000)]
Fix warnings from test added in r301562 on Windows (when built without exceptions).

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

7 years agoSync with changes from r300825 in clang.
Vassil Vassilev [Thu, 27 Apr 2017 17:23:53 +0000 (17:23 +0000)]
Sync with changes from r300825 in clang.

Generate the better include paths. Instead of #include <llvm_header.h> doxygen
produces #include "llvm/Folder/llvm_header.h"

Patch by Yuka Takahashi (D32342)!

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

7 years agoUse a pointer type for target frame indices during statepoint lowering
Sanjoy Das [Thu, 27 Apr 2017 17:17:16 +0000 (17:17 +0000)]
Use a pointer type for target frame indices during statepoint lowering

Summary:
The type of the target frame index is intptr, not the type of the value we're
going to store into it.  Without this change we crash in the attached test case
when trying to type-legalize a TargetFrameIndex.

Patchpoint lowering types the target frame index as intptr as well.

Reviewers: reames, bogner, arsenm

Subscribers: arsenm, mcrosier, llvm-commits

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

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

7 years agocmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.
Peter Collingbourne [Thu, 27 Apr 2017 17:04:05 +0000 (17:04 +0000)]
cmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.

Apparently some git tools (such as "repo") may not create this file.
Patch by Quentin Neill.

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

7 years agoRefactor DynamicLibrary so searching for a symbol will have a defined order and
Frederich Munch [Thu, 27 Apr 2017 16:55:24 +0000 (16:55 +0000)]
Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

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

7 years ago[PartialInlining]: Improve partial inlining to handle complex conditions
Xinliang David Li [Thu, 27 Apr 2017 16:34:00 +0000 (16:34 +0000)]
[PartialInlining]: Improve partial inlining to handle complex conditions

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

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

7 years ago[CodeView] Isolate Debug Info Fragments into standalone classes.
Zachary Turner [Thu, 27 Apr 2017 16:12:16 +0000 (16:12 +0000)]
[CodeView] Isolate Debug Info Fragments into standalone classes.

Previously parsing of these were all grouped together into a
single master class that could parse any type of debug info
fragment.

With writing forthcoming, the complexity of each individual
fragment is enough to warrant them having their own classes so
that reading and writing of each fragment type can be grouped
together, but isolated from the code for reading and writing
other fragment types.

In doing so, I found a place where parsing code was duplicated
for the FileChecksums fragment, across llvm-readobj and the
CodeView library, and one of the implementations had a bug.
Now that the codepaths are merged, the bug is resolved.

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

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

7 years ago[Support] Make BinaryStreamArray extractors stateless.
Zachary Turner [Thu, 27 Apr 2017 16:11:47 +0000 (16:11 +0000)]
[Support] Make BinaryStreamArray extractors stateless.

Instead, we now pass a context memeber through the extraction
process.

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

7 years agoRename some PDB classes.
Zachary Turner [Thu, 27 Apr 2017 16:11:19 +0000 (16:11 +0000)]
Rename some PDB classes.

We have a lot of very similarly named classes related to
dealing with module debug info.  This patch has NFC, it just
renames some classes to be more descriptive (albeit slightly
more to type).  The mapping from old to new class names is as
follows:

   Old          |        New
ModInfo         | DbiModuleDescriptor
ModuleSubstream | ModuleDebugFragment
ModStream       | ModuleDebugStream

With the corresponding Builder classes renamed accordingly.

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

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

7 years ago[x86] add minimal tests for potential size-changing vsel transforms; NFC
Sanjay Patel [Thu, 27 Apr 2017 16:10:20 +0000 (16:10 +0000)]
[x86] add minimal tests for potential size-changing vsel transforms; NFC

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

7 years ago[AMDGPU] DPP: add support for GFX9
Sam Kolton [Thu, 27 Apr 2017 15:42:38 +0000 (15:42 +0000)]
[AMDGPU] DPP: add support for GFX9

Reviewers: artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

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

7 years agoFix typo and place comment close to its target
Krzysztof Parzyszek [Thu, 27 Apr 2017 14:38:21 +0000 (14:38 +0000)]
Fix typo and place comment close to its target

Patch by Wei-Ren Chen.

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

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

7 years agoFixing a malformed RST table to get the documentation bot back to green.
Aaron Ballman [Thu, 27 Apr 2017 14:33:01 +0000 (14:33 +0000)]
Fixing a malformed RST table to get the documentation bot back to green.

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

7 years agoFixed assert message to correctly refer to MRMSrcReg4VOp3Frm/MRMSrcMeg4VOp3Frm.
Simon Pilgrim [Thu, 27 Apr 2017 14:25:04 +0000 (14:25 +0000)]
Fixed assert message to correctly refer to MRMSrcReg4VOp3Frm/MRMSrcMeg4VOp3Frm.

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

7 years ago[mips][microMIPS] Adding code size reduction pass for MicroMIPS
Zoran Jovanovic [Thu, 27 Apr 2017 13:10:48 +0000 (13:10 +0000)]
[mips][microMIPS] Adding code size reduction pass for MicroMIPS
Author: milena.vujosevic.janicic
Reviewers: sdardis
The code implements size reduction pass for MicroMIPS.
Load and store instructions are examined and transformed, if possible.
lw32 instruction is transformed into 16-bit instruction lwsp
sw32 instruction is transformed into 16-bit instruction swsp
Arithmetic instrcutions are examined and transformed, if possible.
addu32 instruction is transformed into 16-bit instruction addu16
subu32 instruction is transformed into 16-bit instruction subu16
Differential Revision: https://reviews.llvm.org/D15144

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

7 years ago[SystemZ] Remove incorrect assert in SystemZTTIImpl
Jonas Paulsson [Thu, 27 Apr 2017 11:01:18 +0000 (11:01 +0000)]
[SystemZ]  Remove incorrect assert in SystemZTTIImpl

In getCmpSelInstrCost(), CondTy may actually be scalar while ValTy is a
vector when LoopVectorizer is the caller. Therefore the assert that CondTy
must be a vector type if ValTy is was wrong and is now removed.

Review: Ulrich Weigand

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

7 years ago[ARM] GlobalISel: Fix extended stack operands
Diana Picus [Thu, 27 Apr 2017 10:23:30 +0000 (10:23 +0000)]
[ARM] GlobalISel: Fix extended stack operands

Fix a crash when trying to extend a value passed as a sign- or
zero-extended stack parameter. The cause of the crash was that we were
setting the size of the loaded value to 32 bits, and then tyring to
extend again to 32 bits.

This patch addresses the issue by also introducing a G_TRUNC after the
load. This will leave the unused bits to their original values set by
the caller, while being consistent about the types. For values that are
not extended, we just use a smaller load.

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