OSDN Git Service

android-x86/external-llvm.git
7 years ago[InstCombine] add folds for icmp (smin X, Y), X
Sanjay Patel [Thu, 15 Dec 2016 19:13:37 +0000 (19:13 +0000)]
[InstCombine] add folds for icmp (smin X, Y), X

Min/max canonicalization (r287585) exposes the fact that we're missing combines for min/max patterns.
This patch won't solve the example that was attached to that thread, so something else still needs fixing.

The line between InstCombine and InstSimplify gets blurry here because sometimes the icmp instruction that
we want to fold to already exists, but sometimes it's the swapped form of what we want.

Corresponding changes for smax/umin/umax to follow.

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

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

7 years agoFix some remaining documentation references to MSVC 2013
Reid Kleckner [Thu, 15 Dec 2016 19:08:02 +0000 (19:08 +0000)]
Fix some remaining documentation references to MSVC 2013

MSVC 2015 has been the minimum supported version of VS since October.

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

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

7 years ago[StringRef] Add enable-if to StringLiteral.
Zachary Turner [Thu, 15 Dec 2016 19:02:43 +0000 (19:02 +0000)]
[StringRef] Add enable-if to StringLiteral.

to prevent StringLiteral from being created with a non-literal
char array, clang has a macro enable_if() that can be used
in such a way as to guarantee that the constructor is disabled
unless the length fo the string can be computed at compile time.

This only works on clang, but at least it should allow bots
to catch abuse of StringLiteral.

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

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

7 years ago[libFuzzer] doc update
Kostya Serebryany [Thu, 15 Dec 2016 18:47:22 +0000 (18:47 +0000)]
[libFuzzer] doc update

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

7 years ago[GlobalISel] Drop workaround for Legalizer member/class sharing a name. NFC.
Ahmed Bougacha [Thu, 15 Dec 2016 18:45:30 +0000 (18:45 +0000)]
[GlobalISel] Drop workaround for Legalizer member/class sharing a name. NFC.

MachineLegalizer used to be the name of both the class and the member,
causing GCC errors. r276522 fixed that by renaming the member to just
'Legalizer'.  The 'class' workaround isn't necessary anymore; drop it.

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

7 years ago[x86] use a single shufps for 256-bit vectors when it can save instructions
Sanjay Patel [Thu, 15 Dec 2016 18:43:46 +0000 (18:43 +0000)]
[x86] use a single shufps for 256-bit vectors when it can save instructions

This is the 256-bit counterpart to the 128-bit transform checked in here:
https://reviews.llvm.org/rL289837

This patch is based on the draft by @sroland (Roland Scheidegger) that is
attached to PR27885:
https://llvm.org/bugs/show_bug.cgi?id=27885

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

7 years ago[AArch64] Guard Misaligned 128-bit store penalty by subtarget feature
Matthew Simpson [Thu, 15 Dec 2016 18:36:59 +0000 (18:36 +0000)]
[AArch64] Guard Misaligned 128-bit store penalty by subtarget feature

This patch checks that the SlowMisaligned128Store subtarget feature is set
when penalizing such stores in getMemoryOpCost.

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

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

7 years ago[AArch64][GlobalISel] Remove redundant RBI comments. NFC.
Ahmed Bougacha [Thu, 15 Dec 2016 18:22:15 +0000 (18:22 +0000)]
[AArch64][GlobalISel] Remove redundant RBI comments. NFC.

It's brittle, and Doxygen already picks the overriden method's comment
anyway.

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

7 years ago[ThinLTO] Ensure callees get hot threshold when first seen on cold path
Teresa Johnson [Thu, 15 Dec 2016 18:21:01 +0000 (18:21 +0000)]
[ThinLTO] Ensure callees get hot threshold when first seen on cold path

This is split out from D27696, since it turned out to be a bug fix and
not part of the NFC efficiency change.

Keep the same adjusted (possibly decayed) threshold in both the worklist
and the ImportList. Otherwise if we encountered it first along a cold
path, the callee would be added to the worklist with a lower decayed
threshold than when it is later encountered along a hot path. But the
logic uses the threshold recorded in the ImportList entry to check if
we should re-add it, and without this patch the threshold recorded there
is the same along both paths so we don't re-add it. Using the
same possibly decayed threshold in the ImportList ensures we re-add it
later with the higher non-decayed hot path threshold.

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

7 years ago[CMake] Minor change to symlink generation for LLDB
Chris Bieneman [Thu, 15 Dec 2016 18:17:07 +0000 (18:17 +0000)]
[CMake] Minor change to symlink generation for LLDB

If OUTPUT_DIR is not specified we can assume the symlink is linking to a file in the same directory, so we can use $<TARGET_FILE_NAME:${target}> to create a relative symlink.

In the case of LLDB, when we build a framework, we are creating symlinks in a different directory than the file we're pointing to, and we don't install those links. To make this work in the build directory we can use $<TARGET_FILE:${target}> instead, which uses the full path to the target.

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

7 years ago[x86] use a single shufps when it can save instructions
Sanjay Patel [Thu, 15 Dec 2016 18:03:38 +0000 (18:03 +0000)]
[x86] use a single shufps when it can save instructions

This is a tiny patch with a big pile of test changes.
This partially fixes PR27885:
https://llvm.org/bugs/show_bug.cgi?id=27885

My motivating case looks like this:

  - vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,2]
  - vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
  - vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]

  + vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]

And this happens several times in the diffs. For chips with domain-crossing penalties,
the instruction count and size reduction should usually overcome any potential
domain-crossing penalty due to using an FP op in a sequence of int ops. For chips such
as recent Intel big cores and Atom, there is no domain-crossing penalty for shufps, so
using shufps is a pure win.

So the test case diffs all appear to be improvements except one test in
vector-shuffle-combining.ll where we miss an opportunity to use a shift to generate
zero elements and one test in combine-sra.ll where multiple uses prevent the expected
shuffle combining.

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

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

7 years ago[X86][SSE] Fix domains for scalar store instructions
Simon Pilgrim [Thu, 15 Dec 2016 17:09:24 +0000 (17:09 +0000)]
[X86][SSE] Fix domains for scalar store instructions

As discussed on D27692

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

7 years agoRevert "[SimplifyCFG] In sinkLastInstruction correctly set debugloc of common inst"
Robert Lougher [Thu, 15 Dec 2016 16:59:13 +0000 (16:59 +0000)]
Revert "[SimplifyCFG] In sinkLastInstruction correctly set debugloc of common inst"

Reverting as it is causing buildbot failures (address sanitizer).

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

7 years ago[lanai] Simplify small section check in LowerGlobalAddress and treat ldata sections...
Jacques Pienaar [Thu, 15 Dec 2016 16:56:16 +0000 (16:56 +0000)]
[lanai] Simplify small section check in LowerGlobalAddress and treat ldata sections specially.

Move the check for the code model into isGlobalInSmallSectionImpl and return false (not in small section) for variables placed in sections prefixed with .ldata (workaround for a tool limitation).

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

7 years ago[X86][AVX512] Moved instruction domain lookups to the right table. NFCI.
Simon Pilgrim [Thu, 15 Dec 2016 16:38:51 +0000 (16:38 +0000)]
[X86][AVX512] Moved instruction domain lookups to the right table. NFCI.

Avoid duplicating instructions in the int32/int64 domains.

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

7 years ago[SimplifyCFG] In sinkLastInstruction correctly set debugloc of "common" inst
Robert Lougher [Thu, 15 Dec 2016 16:17:53 +0000 (16:17 +0000)]
[SimplifyCFG] In sinkLastInstruction correctly set debugloc of "common" inst

Simplify CFG will try to sink the last instruction in a series of basic blocks,
creating a "common" instruction in the successor block (sinkLastInstruction).
When it does this, the debug location of the single instruction should be the
merged debug locations of the commoned instructions.

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

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

7 years agoFix ubsan failures in lane mask shifts
Krzysztof Parzyszek [Thu, 15 Dec 2016 16:08:49 +0000 (16:08 +0000)]
Fix ubsan failures in lane mask shifts

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

7 years ago[X86][SSE] Fix domains for VZEXT_LOAD type instructions
Simon Pilgrim [Thu, 15 Dec 2016 16:05:29 +0000 (16:05 +0000)]
[X86][SSE] Fix domains for VZEXT_LOAD type instructions

Add the missing domain equivalences for movss, movsd, movd and movq zero extending loading instructions.

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

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

7 years agoFix for regression after Global Load Scalarization patch
Alexander Timofeev [Thu, 15 Dec 2016 15:17:19 +0000 (15:17 +0000)]
Fix for regression after Global Load Scalarization patch

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

7 years agoExtract LaneBitmask into a separate type
Krzysztof Parzyszek [Thu, 15 Dec 2016 14:36:06 +0000 (14:36 +0000)]
Extract LaneBitmask into a separate type

Specifically avoid implicit conversions from/to integral types to
avoid potential errors when changing the underlying type. For example,
a typical initialization of a "full" mask was "LaneMask = ~0u", which
would result in a value of 0x00000000FFFFFFFF if the type was extended
to uint64_t.

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

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

7 years ago[CostModel][X86] Updated reverse shuffle costs
Simon Pilgrim [Thu, 15 Dec 2016 14:24:07 +0000 (14:24 +0000)]
[CostModel][X86] Updated reverse shuffle costs

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

7 years ago[TEST] Initial commit of tests for minmax horizontal reductions.
Alexey Bataev [Thu, 15 Dec 2016 13:21:29 +0000 (13:21 +0000)]
[TEST] Initial commit of tests for minmax horizontal reductions.

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

7 years agoRevert "[TESTS] Initial commit of tests, by Andrew Tischenko"
Alexey Bataev [Thu, 15 Dec 2016 12:26:18 +0000 (12:26 +0000)]
Revert "[TESTS] Initial commit of tests, by Andrew Tischenko"

This reverts commit ee709f8988653a0334fbf100cdbbdd83a3933347.

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

7 years ago[InstCombine] New opportunities for FoldAndOfICmp and FoldXorOfICmp
Ehsan Amiri [Thu, 15 Dec 2016 12:25:13 +0000 (12:25 +0000)]
[InstCombine] New opportunities for FoldAndOfICmp and FoldXorOfICmp

A number of new patterns for simplifying and/xor of icmp:

(icmp ne %x, 0) ^ (icmp ne %y, 0) => icmp ne %x, %y if the following is true:
1- (%x = and %a, %mask) and (%y = and %b, %mask)
2- %mask is a power of 2.

(icmp eq %x, 0) & (icmp ne %y, 0) => icmp ult %x, %y if the following is true:
1- (%x = and %a, %mask1) and (%y = and %b, %mask2)
2- Let %t be the smallest power of 2 where %mask1 & %t != 0. Then for any
   %s that is a power of 2 and %s & %mask2 != 0, we must have %s <= %t.
For example if %mask1 = 24 and %mask2 = 16, setting %s = 16 and %t = 8
violates condition (2) above. So this optimization cannot be applied.

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

7 years ago[CostModel] Fix long standing bug with reverse shuffle mask detection
Simon Pilgrim [Thu, 15 Dec 2016 12:12:45 +0000 (12:12 +0000)]
[CostModel] Fix long standing bug with reverse shuffle mask detection

Incorrect 'undef' mask index matching meant that broadcast shuffles could be detected as reverse shuffles

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

7 years ago[TESTS] Initial commit of tests, by Andrew Tischenko
Alexey Bataev [Thu, 15 Dec 2016 11:48:24 +0000 (11:48 +0000)]
[TESTS] Initial commit of tests, by Andrew Tischenko

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

7 years ago[Power9] Allow AnyExt immediates for XXSPLTIB
Nemanja Ivanovic [Thu, 15 Dec 2016 11:16:20 +0000 (11:16 +0000)]
[Power9] Allow AnyExt immediates for XXSPLTIB

In some situations, the BUILD_VECTOR node that builds a v18i8 vector by
a splat of an i8 constant will end up with signed 8-bit values and other
situations, it'll end up with unsigned ones. Handle both situations.

Fixes PR31340.

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

7 years ago[AVR] Support floats in the instrumention pass
Dylan McKay [Thu, 15 Dec 2016 11:02:41 +0000 (11:02 +0000)]
[AVR] Support floats in the instrumention pass

This also refactors some common code into the 'GetTypeName' method.

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

7 years ago[CostModel][X86] Add tests for reverse shuffle costs
Simon Pilgrim [Thu, 15 Dec 2016 10:45:53 +0000 (10:45 +0000)]
[CostModel][X86] Add tests for reverse shuffle costs

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

7 years agoAdd missing triple target for numeric section flag test
Prakhar Bahuguna [Thu, 15 Dec 2016 10:20:48 +0000 (10:20 +0000)]
Add missing triple target for numeric section flag test

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

7 years agoSimplify format member detection in FormatVariadic
Pavel Labath [Thu, 15 Dec 2016 09:40:27 +0000 (09:40 +0000)]
Simplify format member detection in FormatVariadic

Summary:
This replaces the format member search, which was quite complicated, with a more
direct approach to detecting whether a class should be formatted using the
format-member method. Instead we use a special type llvm::format_adapter, which
every adapter must inherit from. Then the search can be simply implemented with
the is_base_of type trait.

Aside from the simplification, I like this way more because it makes it more
explicit that you are supposed to use this type only for adapter-like
formattings, and the other approach (format_provider overloads) should be used
as a default (a mistake I made when first trying to use this library).

The only slight change in behaviour here is that now choose the format-adapter
branch even if the format member invocation will fail to compile (e.g. because it is a
non-const member function and we are passing a const adapter), whereas
previously we would have gone on to search for format_providers for the type.
However, I think that is actually a good thing, as it probably means the
programmer did something wrong.

Reviewers: zturner, inglorion

Subscribers: llvm-commits

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

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

7 years ago[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
Sjoerd Meijer [Thu, 15 Dec 2016 09:38:59 +0000 (09:38 +0000)]
[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently

This is essentially a recommit of r285893, but with a correctness fix. The
problem of the original commit was that this:

bic r5, r7, #31
cbz r5, .LBB2_10

got rewritten into:

lsrs  r5, r7, #5
beq .LBB2_10

The result in destination register r5 is not the same and this is incorrect
when r5 is not dead. So this fix includes checking the uses of the AND
destination register. And also, compared to the original commit, some regression
tests didn't need changing anymore because of this extra check.

For completeness, this was the original commit message:

For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more
efficient instruction selection if the bitmask is one consecutive sequence of
set bits (32 - clz(bm) - ctz(bm) == popcount(bm)).

1) If the bitmask touches the LSB, then we can remove all the upper bits and
set the flags by doing one LSLS.
2) If the bitmask touches the MSB, then we can remove all the lower bits and
set the flags with one LSRS.
3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit
into the sign bit with one LSLS and change the condition query from NE/EQ to
MI/PL (we could also implement this by shifting into the carry bit and
branching on BCC/BCS).
4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower
zero bits of the mask.

1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two
16-bit instructions but can elide the CMP and doesn't require materializing a
complex immediate, so is also a win.

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

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

7 years ago[AVR] Add argument indices to the instrumention hook functions
Dylan McKay [Thu, 15 Dec 2016 09:38:09 +0000 (09:38 +0000)]
[AVR] Add argument indices to the instrumention hook functions

This allows the instrumention hook functions to do better
pretty-printing.

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

7 years agoFix for build warning in execute-only support
Prakhar Bahuguna [Thu, 15 Dec 2016 08:42:04 +0000 (08:42 +0000)]
Fix for build warning in execute-only support

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

7 years agoAllow ELF section flags to be specified numerically
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:15 +0000 (07:59 +0000)]
Allow ELF section flags to be specified numerically

Summary:
GAS already allows flags for sections to be specified directly as a
numeric value. This functionality is particularly useful for setting
processor or application-specific values that may not be directly
supported or understood by LLVM. This patch allows LLVM to use numeric
section flag values verbatim if specified by the assembly file.

Reviewers: grosbach, rafael, t.p.northover, rengolin

Subscribers: llvm-commits

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

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

7 years ago[ARM] Implement execute-only support in CodeGen
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:08 +0000 (07:59 +0000)]
[ARM] Implement execute-only support in CodeGen

This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:

* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
  alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
  with VMOV used in addition for floating-point literals. As the MOVT
  instruction is required, execute-only support is only available in
  Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
  marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
  This also overrides selection of ELF sections for globals.

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

7 years agoAdd missing -mtriple to MIR test case
Sanjoy Das [Thu, 15 Dec 2016 07:13:50 +0000 (07:13 +0000)]
Add missing -mtriple to MIR test case

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

7 years agoAttempt to fix llvm-readobj crash on ppc64 due to r289674
Yaxun Liu [Thu, 15 Dec 2016 06:59:23 +0000 (06:59 +0000)]
Attempt to fix llvm-readobj crash on ppc64 due to r289674

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

7 years agoFix go bindings after r289702 (hopefully, don't really know how to build
Daniel Jasper [Thu, 15 Dec 2016 06:54:29 +0000 (06:54 +0000)]
Fix go bindings after r289702 (hopefully, don't really know how to build
them, build.sh seems to be broken).

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

7 years ago[libFuzzer] enable the failure-resistant merge by default (with trace-pc-guard only)
Kostya Serebryany [Thu, 15 Dec 2016 06:21:21 +0000 (06:21 +0000)]
[libFuzzer] enable the failure-resistant merge by default (with trace-pc-guard only)

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

7 years ago[AVR] Whitelist the avrlit config environment variables
Dylan McKay [Thu, 15 Dec 2016 06:04:53 +0000 (06:04 +0000)]
[AVR] Whitelist the avrlit config environment variables

This allows us to use `lit` to run on-target execution tests.

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

7 years agoRevert part of r289765 that is not necessary
Hal Finkel [Thu, 15 Dec 2016 05:50:45 +0000 (05:50 +0000)]
Revert part of r289765 that is not necessary

CS.doesNotAccessMemory(ArgNo) and CS.onlyReadsMemory(ArgNo) calls
dataOperandHasImpliedAttr, so revert this part of r289765 because
it should not be necessary.

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

7 years agoTrying to fix NDEBUG build after r289764
Hal Finkel [Thu, 15 Dec 2016 05:33:19 +0000 (05:33 +0000)]
Trying to fix NDEBUG build after r289764

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

7 years agoFix argument attribute queries with bundle operands
Hal Finkel [Thu, 15 Dec 2016 05:09:15 +0000 (05:09 +0000)]
Fix argument attribute queries with bundle operands

When iterating over data operands in AA, don't make argument-attribute-specific
queries on bundle operands. Trying to fix self hosting...

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

7 years ago[MachineBlockPlacement] Don't make blocks "uneditable"
Sanjoy Das [Thu, 15 Dec 2016 05:08:57 +0000 (05:08 +0000)]
[MachineBlockPlacement] Don't make blocks "uneditable"

Summary:
This fixes an issue with MachineBlockPlacement due to a badly timed call
to `analyzeBranch` with `AllowModify` set to true.  The timeline is as
follows:

 1. `MachineBlockPlacement::maybeTailDuplicateBlock` calls
    `TailDup.shouldTailDuplicate` on its argument, which in turn calls
    `analyzeBranch` with `AllowModify` set to true.

 2. This `analyzeBranch` call edits the terminator sequence of the block
    based on the physical layout of the machine function, turning an
    unanalyzable non-fallthrough block to a unanalyzable fallthrough
    block.  Normally MBP bails out of rearranging such blocks, but this
    block was unanalyzable non-fallthrough (and thus rearrangeable) the
    first time MBP looked at it, and so it goes ahead and decides where
    it should be placed in the function.

 3. When placing this block MBP fails to analyze and thus update the
    block in keeping with the new physical layout.

Concretely, before (1) we have something like:

```
LBL0:
  < unknown terminator op that may branch to LBL1 >
  jmp LBL1

LBL1:
  ... A

LBL2:
  ... B
```

In (2), analyze branch simplifies this to

```
LBL0:
  < unknown terminator op that may branch to LBL2 >
  ;; jmp LBL1 <- redundant jump removed

LBL1:
  ... A

LBL2:
  ... B
```

In (3), MachineBlockPlacement goes ahead with its plan of putting LBL2
after the first block since that is profitable.

```
LBL0:
  < unknown terminator op that may branch to LBL2 >
  ;; jmp LBL1 <- redundant jump

LBL2:
  ... B

LBL1:
  ... A
```

and the program now has incorrect behavior (we no longer fall-through
from `LBL0` to `LBL1`) because MBP can no longer edit LBL0.

There are several possible solutions, but I went with removing the teeth
off of the `analyzeBranch` calls in TailDuplicator.  That makes thinking
about the result of these calls easier, and breaks nothing in the lit
test suite.

I've also added some bookkeeping to the MachineBlockPlacement pass and
used that to write an assert that would have caught this.

Reviewers: chandlerc, gberry, MatzeB, iteratee

Subscribers: mcrosier, llvm-commits

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

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

7 years ago[AVX-512][InstCombine] Add masked scalar FMA intrinsics to SimplifyDemandedVectorElts.
Craig Topper [Thu, 15 Dec 2016 03:49:45 +0000 (03:49 +0000)]
[AVX-512][InstCombine] Add masked scalar FMA intrinsics to SimplifyDemandedVectorElts.

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

7 years agoFix iterator-invalidation issue
Hal Finkel [Thu, 15 Dec 2016 03:30:40 +0000 (03:30 +0000)]
Fix iterator-invalidation issue

Inserting a new key into a DenseMap potentially invalidates iterators into that
map. Trying to fix an issue from r289755 triggering this assertion:

  Assertion `isHandleInSync() && "invalid iterator access!"' failed.

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

7 years agoRemove the AssumptionCache
Hal Finkel [Thu, 15 Dec 2016 03:02:15 +0000 (03:02 +0000)]
Remove the AssumptionCache

After r289755, the AssumptionCache is no longer needed. Variables affected by
assumptions are now found by using the new operand-bundle-based scheme. This
new scheme is more computationally efficient, and also we need much less
code...

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

7 years agoMake processing @llvm.assume more efficient by using operand bundles
Hal Finkel [Thu, 15 Dec 2016 02:53:42 +0000 (02:53 +0000)]
Make processing @llvm.assume more efficient by using operand bundles

There was an efficiency problem with how we processed @llvm.assume in
ValueTracking (and other places). The AssumptionCache tracked all of the
assumptions in a given function. In order to find assumptions relevant to
computing known bits, etc. we searched every assumption in the function. For
ValueTracking, that means that we did O(#assumes * #values) work in InstCombine
and other passes (with a constant factor that can be quite large because we'd
repeat this search at every level of recursion of the analysis).

Several of us discussed this situation at the last developers' meeting, and
this implements the discussed solution: Make the values that an assume might
affect operands of the assume itself. To avoid exposing this detail to
frontends and passes that need not worry about it, I've used the new
operand-bundle feature to add these extra call "operands" in a way that does
not affect the intrinsic's signature. I think this solution is relatively
clean. InstCombine adds these extra operands based on what ValueTracking, LVI,
etc. will need and then those passes need only search the users of the values
under consideration. This should fix the computational-complexity problem.

At this point, no passes depend on the AssumptionCache, and so I'll remove
that as a follow-up change.

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

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

7 years agoAdd testcases for some shuffle bugs.
Eli Friedman [Thu, 15 Dec 2016 01:47:15 +0000 (01:47 +0000)]
Add testcases for some shuffle bugs.

See https://llvm.org/bugs/show_bug.cgi?id=31301 and
https://llvm.org/bugs/show_bug.cgi?id=31364 .

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

7 years agoFix test/tools/lto/hide-linkonce-odr.ll after r289719
Nico Weber [Thu, 15 Dec 2016 01:31:38 +0000 (01:31 +0000)]
Fix test/tools/lto/hide-linkonce-odr.ll after r289719

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

7 years ago[NVPTX] Remove dead #defines from NVPTXUtilities.h.
Justin Lebar [Thu, 15 Dec 2016 00:45:06 +0000 (00:45 +0000)]
[NVPTX] Remove dead #defines from NVPTXUtilities.h.

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

7 years agoUse PIC relocation model as default for PowerPC64 ELF.
Joerg Sonnenberger [Thu, 15 Dec 2016 00:01:53 +0000 (00:01 +0000)]
Use PIC relocation model as default for PowerPC64 ELF.

Most of the PowerPC64 code generation for the ELF ABI is already PIC.
There are four main exceptions:
(1) Constant pointer arrays etc. should in writeable sections.
(2) The TOC restoration NOP after a call is needed for all global
symbols. While GNU ld has a workaround for questionable GCC self-calls,
we trigger the checks for calls from COMDAT sections as they cross input
sections and are therefore not considered self-calls. The current
decision is questionable and suboptimal, but outside the scope of the
change.
(3) TLS access can not use the initial-exec model.
(4) Jump tables should use relative addresses. Note that the current
encoding doesn't work for the large code model, but it is more compact
than the default for any non-trivial jump table. Improving this is again
beyond the scope of this change.

At least (1) and (3) are assumptions made in target-independent code and
introducing additional hooks is a bit messy. Testing with clang shows
that a -fPIC binary is 600KB smaller than the corresponding -fno-pic
build. Separate testing from improved jump table encodings would explain
only about 100KB or so. The rest is expected to be a result of more
aggressive immediate forming for -fno-pic, where the -fPIC binary just
uses TOC entries.

This change brings the LLVM output in line with the GCC output, other
PPC64 compilers like XLC on AIX are known to produce PIC by default
as well. The relocation model can still be provided explicitly, i.e.
when using MCJIT.

One test case for case (1) is included, other test cases with relocation
mode sensitive behavior are wired to static for now. They will be
reviewed and adjusted separately.

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

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

7 years ago[AMDGPU] Fix runtime-metadata.ll test so it doesn't leave an object file in the sourc...
Justin Lebar [Wed, 14 Dec 2016 23:24:43 +0000 (23:24 +0000)]
[AMDGPU] Fix runtime-metadata.ll test so it doesn't leave an object file in the source tree.

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

7 years ago[NVPTX] Remove dead code.
Justin Lebar [Wed, 14 Dec 2016 23:20:40 +0000 (23:20 +0000)]
[NVPTX] Remove dead code.

I've chosen to remove NVPTXInstrInfo::CanTailMerge but not
NVPTXInstrInfo::isLoadInstr and isStoreInstr (which are also dead)
because while the latter two are reasonably useful utilities, the former
cannot be used safely: It relies on successful address space inference
to identify writes to shared memory, but addrspace inference is a
best-effort thing.

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

7 years ago[DAG] allow more select folding for targets that have 'and not' (PR31175)
Sanjay Patel [Wed, 14 Dec 2016 22:59:14 +0000 (22:59 +0000)]
[DAG] allow more select folding for targets that have 'and not' (PR31175)

The original motivation for this patch comes from wanting to canonicalize
more IR to selects and also canonicalizing min/max.

If we're going to do that, we need more backend fixups to undo select codegen
when simpler ops will do. I chose AArch64 for the tests because that shows the
difference in the simplest way. This should fix:
https://llvm.org/bugs/show_bug.cgi?id=31175

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

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

7 years ago[gold] Add datalayout to two tests where it was missing.
Davide Italiano [Wed, 14 Dec 2016 22:53:43 +0000 (22:53 +0000)]
[gold] Add datalayout to two tests where it was missing.

Reported by: thakis via chromium bots.

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

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 14 Dec 2016 22:50:46 +0000 (22:50 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoAdd the ability to get attribute values as Optional<T>
Greg Clayton [Wed, 14 Dec 2016 22:38:08 +0000 (22:38 +0000)]
Add the ability to get attribute values as Optional<T>

When getting attributes it is sometimes nicer to use Optional<T> some of the time instead of magic values. I tried to cut over to only using the Optional values but it made many of the call sites very messy, so it makes sense the leave in the calls that can return a default value. Otherwise code that looks like this:

uint64_t CallColumn = Die.getAttributeValueAsAddress(DW_AT_call_line, 0);

Has to be turned into:

uint64_t CallColumn = 0;
if (auto CallColumnValue = Die.getAttributeValueAsAddress(DW_AT_call_line))
    CallColumn = *CallColumnValue;

The first snippet of code looks much better. But in cases where you want an offset that may or may not be there, the following code looks better:

if (auto StmtOffset = Die.getAttributeValueAsSectionOffset(DW_AT_stmt_list)) {
  // Use StmtOffset
}

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

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

7 years agoWhitespace cleanup in test/CodeGen/NVPTX/annotations.ll.
Justin Lebar [Wed, 14 Dec 2016 22:32:55 +0000 (22:32 +0000)]
Whitespace cleanup in test/CodeGen/NVPTX/annotations.ll.

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

7 years ago[NVPTX] Support .maxnreg annotation.
Justin Lebar [Wed, 14 Dec 2016 22:32:50 +0000 (22:32 +0000)]
[NVPTX] Support .maxnreg annotation.

Reviewers: tra

Subscribers: llvm-commits, jholewinski

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

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

7 years ago[NVPTX] Remove string constants from NVPTXBaseInfo.h.
Justin Lebar [Wed, 14 Dec 2016 22:32:44 +0000 (22:32 +0000)]
[NVPTX] Remove string constants from NVPTXBaseInfo.h.

Summary:
Previously they were defined as a 2D char array in a header file.  This
is kind of overkill -- we can let the linker lay out these strings
however it pleases.  While we're at it, we might as well just inline
these constants where they're used, as each of them is used only once.

Also move NVPTXUtilities.{h,cpp} into namespace llvm.

Reviewers: tra

Subscribers: jholewinski, mgorny, llvm-commits

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

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

7 years agoLibDriver: Reject inputs that are not COFF objects or bitcode files.
Peter Collingbourne [Wed, 14 Dec 2016 22:19:22 +0000 (22:19 +0000)]
LibDriver: Reject inputs that are not COFF objects or bitcode files.

Fixes PR31372.

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

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

7 years agoOnly sets profile summary when it was not preset.
Dehao Chen [Wed, 14 Dec 2016 22:06:49 +0000 (22:06 +0000)]
Only sets profile summary when it was not preset.

Summary: SampleProfileLoader pass may be invoked twice by LTO. The 2nd pass should not append more summary info as it is already preset by the 1st pass.

Reviewers: eraman, davidxl

Subscribers: mehdi_amini, llvm-commits

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

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

7 years agoFix the bug in r289714 (NFC).
Dehao Chen [Wed, 14 Dec 2016 22:03:08 +0000 (22:03 +0000)]
Fix the bug in r289714 (NFC).

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

7 years agoRevert revision 289721.
Jan Sjodin [Wed, 14 Dec 2016 21:58:42 +0000 (21:58 +0000)]
Revert revision 289721.

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

7 years agoDummy commit.
Jan Sjodin [Wed, 14 Dec 2016 21:57:18 +0000 (21:57 +0000)]
Dummy commit.

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

7 years ago[LTO] Add the missing datalayout in a test.
Davide Italiano [Wed, 14 Dec 2016 21:57:14 +0000 (21:57 +0000)]
[LTO] Add the missing datalayout in a test.

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

7 years ago[LTO] Reject modules without datalayout.
Davide Italiano [Wed, 14 Dec 2016 21:57:04 +0000 (21:57 +0000)]
[LTO] Reject modules without datalayout.

Also, udpate the ~60 failing tests in the tree which did
not contain a valid datalayout.
This fixes PR31123. lld will be updated in a following patch,
immediately after this is committed.

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

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

7 years ago[asan] Don't skip instrumentation of masked load/store unless we've seen a full load...
Filipe Cabecinhas [Wed, 14 Dec 2016 21:57:04 +0000 (21:57 +0000)]
[asan] Don't skip instrumentation of masked load/store unless we've seen a full load/store on that pointer.

Reviewers: kcc, RKSimon

Subscribers: llvm-commits

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

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

7 years ago[asan] Hook ClInstrumentWrites and ClInstrumentReads to masked operation instrumentation.
Filipe Cabecinhas [Wed, 14 Dec 2016 21:56:59 +0000 (21:56 +0000)]
[asan] Hook ClInstrumentWrites and ClInstrumentReads to masked operation instrumentation.

Reviewers: kcc

Subscribers: llvm-commits

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

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

7 years agoCreate SampleProfileLoader pass in llvm instead of clang
Dehao Chen [Wed, 14 Dec 2016 21:40:47 +0000 (21:40 +0000)]
Create SampleProfileLoader pass in llvm instead of clang

Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: llvm-commits, mehdi_amini

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

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

7 years ago[ARM] Split 128-bit vectors in BUILD_VECTOR lowering
Eli Friedman [Wed, 14 Dec 2016 20:44:38 +0000 (20:44 +0000)]
[ARM] Split 128-bit vectors in BUILD_VECTOR lowering

Given that INSERT_VECTOR_ELT operates on D registers anyway, combining
64-bit vectors into a 128-bit vector is basically free. Therefore, try
to split BUILD_VECTOR nodes before giving up and lowering them to a series
of INSERT_VECTOR_ELT instructions. Sometimes this allows dramatically
better lowerings; see testcases for examples. Inspired by similar code
in the x86 backend for AVX.

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

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

7 years agofix gcc warning about a superfluous ;
Nico Weber [Wed, 14 Dec 2016 20:33:54 +0000 (20:33 +0000)]
fix gcc warning about a superfluous ;

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

7 years ago[InstCombine] Folding of a compare with RHS const should merge debug locations
Robert Lougher [Wed, 14 Dec 2016 20:27:22 +0000 (20:27 +0000)]
[InstCombine] Folding of a compare with RHS const should merge debug locations

If all the operands to a phi node are compares that have a RHS constant,
instcombine will try to pull them through the phi node, combining them into
a single operation. When it does this, the debug location of the new op
should be the merged debug locations of the phi node arguments.

Patch 8 of 8 for D26256.  Folding of a compare that has a RHS constant.

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

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

7 years ago[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.
Eli Friedman [Wed, 14 Dec 2016 20:25:26 +0000 (20:25 +0000)]
[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.

Currently, there are substantial problems forming vld1_dup even if the
VDUP survives legalization. The lack of an actual node
leads to terrible results: not only can we not form post-increment vld1_dup
instructions, but we form scalar pre-increment and post-increment
loads which force the loaded value into a GPR. This patch fixes that
by combining the vdup+load into an ARMISD node before DAGCombine
messes it up.

Also includes a crash fix for vld2_dup (see testcase @vld2dupi8_postinc_variable).

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

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

7 years ago[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName...
Amjad Aboud [Wed, 14 Dec 2016 20:24:54 +0000 (20:24 +0000)]
[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory.
This way it will be easier to expand DIFile (e.g., to contain checksum) without the need to modify the createCompileUnit() API.

Reviewers: llvm-commits, rnk

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

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

7 years agoFix build failure due to r289674 on certain systems
Yaxun Liu [Wed, 14 Dec 2016 20:17:47 +0000 (20:17 +0000)]
Fix build failure due to r289674 on certain systems

Removed a useless include which caused conflict.

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

7 years ago[InstCombine] Folding of a binop with RHS const should merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 20:07:49 +0000 (20:07 +0000)]
[InstCombine] Folding of a binop with RHS const should merge the debug locations

If all the operands to a phi node are a binop with a RHS constant, instcombine
will try to pull them through the phi node, combining them into a single
operation. When it does this, the debug location of the new op should be the
merged debug locations of the phi node arguments.

Patch 7 of 8 for D26256.  Folding of a binop with RHS constant.

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

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

7 years agoDebugInfo: Improve type safety and simplify some subprogram finalization code
David Blaikie [Wed, 14 Dec 2016 19:38:39 +0000 (19:38 +0000)]
DebugInfo: Improve type safety and simplify some subprogram finalization code

This probably ended up this way aften the subprogram<>function link
inversion and debug info metadata schema changes.

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

7 years ago[GVNHoist] Move GVNHoist to function simplification part of pipeline.
Geoff Berry [Wed, 14 Dec 2016 19:38:22 +0000 (19:38 +0000)]
[GVNHoist] Move GVNHoist to function simplification part of pipeline.

Summary:
Move GVNHoist to later in the optimization pipeline, specifically, to
the function simplification part of the pipeline.  The new pipeline
location allows GVNHoist to run on a function after its callees have
been inlined but before the function has been considered for inlining
into its callers, exposing more opportunities for hoisting.

Performance results on AArch64 kryo:
Improvements:
  Benchmarks/CoyoteBench/fftbench  -24.952%
  spec2006/bzip2                    -4.071%
  internal bmark                    -3.177%
  Benchmarks/PAQ8p/paq8p            -1.754%
  spec2000/perlbmk                  -1.328%
  spec2006/h264ref                  -1.140%

Regressions:
  internal bmark                    +1.818%
  Benchmarks/mafft/pairlocalalign   +1.084%

Reviewers: sebpop, dberlin, hiraditya

Subscribers: aemerson, mehdi_amini, mcrosier, llvm-commits

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

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

7 years ago[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting...
Andrew Kaylor [Wed, 14 Dec 2016 19:30:18 +0000 (19:30 +0000)]
[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting new elements

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

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

7 years ago[InstCombine] When folding casts through a phi node merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 19:24:01 +0000 (19:24 +0000)]
[InstCombine] When folding casts through a phi node merge the debug locations

If all the operands to a phi node are a cast, instcombine will try to pull
them through the phi node, combining them into a single cast. When it does
this, the debug location of the new cast should be the merged debug locations
of the phi node arguments.

Patch 6 of 8 for D26256.  Folding of a cast operation.

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

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

7 years agoInclude <cstdarg> in PrettyStackTrace.cpp, fixing the bots.
Sean Callanan [Wed, 14 Dec 2016 19:19:53 +0000 (19:19 +0000)]
Include <cstdarg> in PrettyStackTrace.cpp, fixing the bots.

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

7 years agoPrepare PrettyStackTrace for LLDB adoption
Sean Callanan [Wed, 14 Dec 2016 19:09:43 +0000 (19:09 +0000)]
Prepare PrettyStackTrace for LLDB adoption

This patch fixes the linkage for __crashtracer_info__, making it have the proper mangling (extern "C") and linkage (private extern).
It also adds a new PrettyStackTrace type, allowing LLDB to adopt this instead of Host::SetCrashDescriptionWithFormat().

Without this patch, CrashTracer on macOS won't pick up pretty stack traces from any LLVM client.
An LLDB commit adopting this API will follow shortly.

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

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

7 years ago[InstCombine] Folding loads through a phi node should merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 19:02:14 +0000 (19:02 +0000)]
[InstCombine] Folding loads through a phi node should merge the debug locations

If all the operands to a phi node are a load, instcombine will try to pull
them through the phi node, combining them into a single load. When it does
this, the debug location of the new load should be the merged debug locations
of the phi node arguments.

Patch 5 of 8 for D26256.  Folding of a load operation.

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

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

7 years ago[InstCombine] When folding GEP through a phi node merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 18:37:50 +0000 (18:37 +0000)]
[InstCombine] When folding GEP through a phi node merge the debug locations

If all the operands to a phi node are getelementptr, instcombine
will try to pull them through the phi node, combining them into a single
operation.  When it does this, the debug location of the new getelementptr
should be the merged debug locations of the phi node arguments.

Patch 4 of 8 for D26256.  Folding of a getelementptr operation.

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

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

7 years agoThis change does two things:
Eric Christopher [Wed, 14 Dec 2016 18:29:39 +0000 (18:29 +0000)]
This change does two things:

Adds a "Discriminator" field to struct DILineInfo, which defaults to 0.
Fills out the "Discriminator" field in DILineInfo in DWARFDebugLine::LineTable::getFileLineInfoForAddress().

in order to have a slightly nicer interface in getFileLineInfoForAddress.

Patch by Simon Que!

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

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

7 years ago[InstCombine] Merge debug locations when folding through a phi node
Robert Lougher [Wed, 14 Dec 2016 18:14:57 +0000 (18:14 +0000)]
[InstCombine] Merge debug locations when folding through a phi node

If all the operands to a phi node are of the same operation, instcombine
will try to pull them through the phi node, combining them into a single
operation.  When it does this, the debug location of the operation should
be the merged debug locations of the phi node arguments.

Patch 3 of 8 for D26256.  Folding of a compare operation.

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

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

7 years ago[libFuzzer] disable msan for one more hook that reads target's data that might be...
Kostya Serebryany [Wed, 14 Dec 2016 18:13:02 +0000 (18:13 +0000)]
[libFuzzer] disable msan for one more hook that reads target's data that might be uninitialized

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

7 years ago[InstCombine] Merge debug locations when folding through a phi node
Robert Lougher [Wed, 14 Dec 2016 17:49:19 +0000 (17:49 +0000)]
[InstCombine] Merge debug locations when folding through a phi node

If all the operands to a phi node are of the same operation, instcombine
will try to pull them through the phi node, combining them into a single
operation.  When it does this, the debug location of the operation should
be the merged debug locations of the phi node arguments.

Patch 2 of 8 for D26256.  Folding of a binary operation.

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

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

7 years agorevert r289669 which breaks bots
Dehao Chen [Wed, 14 Dec 2016 17:23:16 +0000 (17:23 +0000)]
revert r289669 which breaks bots

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

7 years agoAMDGPU: Emit runtime metadata version 2 as YAML
Yaxun Liu [Wed, 14 Dec 2016 17:16:52 +0000 (17:16 +0000)]
AMDGPU: Emit runtime metadata version 2 as YAML

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

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

7 years agolit.cfg: Check value of build config rather than converting to boolean
Derek Schuff [Wed, 14 Dec 2016 17:05:34 +0000 (17:05 +0000)]
lit.cfg: Check value of build config rather than converting to boolean

This is a CMake var which never evaluates to false.

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

7 years agoAMDGPU: Make AllocationPriority of SGPRs higher than VGPRs
Matt Arsenault [Wed, 14 Dec 2016 16:52:06 +0000 (16:52 +0000)]
AMDGPU: Make AllocationPriority of SGPRs higher than VGPRs

Since SGPRs should spill to VGPRs, they should be allocated first.
I don't think this is sufficient for SGPRs to always spill to
VGPRs though.

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

7 years agoCreate SampleProfileLoader pass in llvm instead of clang
Dehao Chen [Wed, 14 Dec 2016 16:49:28 +0000 (16:49 +0000)]
Create SampleProfileLoader pass in llvm instead of clang

Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: llvm-commits, mehdi_amini

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

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

7 years agoRevert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is...
Nirav Dave [Wed, 14 Dec 2016 16:43:44 +0000 (16:43 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."

Reverting due to ARM MCJIT and MIPS LLD error.

This reverts commit r289659.

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

7 years agoAMDGPU: Change vintrp printing
Matt Arsenault [Wed, 14 Dec 2016 16:36:12 +0000 (16:36 +0000)]
AMDGPU: Change vintrp printing

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

7 years agoRevert gold part of change, just liblto
Derek Schuff [Wed, 14 Dec 2016 16:20:25 +0000 (16:20 +0000)]
Revert gold part of change, just liblto

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

7 years agoDisable libLTO tests when libLTO is not built
Derek Schuff [Wed, 14 Dec 2016 16:20:22 +0000 (16:20 +0000)]
Disable libLTO tests when libLTO is not built

Summary:
The current test only checks whether ld64 is available, causing tests
to fail when ld64 is avilable but libLTO is not built.

Reviewers: beanz, mehdi_amini

Subscribers: mehdi_amini, llvm-commits

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

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