OSDN Git Service

android-x86/external-llvm.git
7 years ago[libFuzzer] Fix index error in SearchMemory() implementation for Windows.
Marcos Pividori [Fri, 16 Dec 2016 17:35:25 +0000 (17:35 +0000)]
[libFuzzer] Fix index error in SearchMemory() implementation for Windows.

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

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

7 years ago[libFuzzer] Remove unnecessary includes of posix headers.
Marcos Pividori [Fri, 16 Dec 2016 17:35:21 +0000 (17:35 +0000)]
[libFuzzer] Remove unnecessary includes of posix headers.

Remove includes of "unistd.h" header, which is missing in non posix
systems.

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

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

7 years ago[libFuzzer] Update tests to use more general functions instead of posix specific.
Marcos Pividori [Fri, 16 Dec 2016 17:35:13 +0000 (17:35 +0000)]
[libFuzzer] Update tests to use more general functions instead of posix specific.

Replace sleep() posix function by a more portable sleep_for() function
from std. Also, ignore memmem() and strcasestr() on Windows.

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

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

7 years agoFix -Wself-assign from r289955
Hans Wennborg [Fri, 16 Dec 2016 17:16:46 +0000 (17:16 +0000)]
Fix -Wself-assign from r289955

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

7 years agoRevert "dwarfdump: Support/process relocations on a CU's abbrev_off"
David Blaikie [Fri, 16 Dec 2016 17:10:17 +0000 (17:10 +0000)]
Revert "dwarfdump: Support/process relocations on a CU's abbrev_off"

Reverting because this breaks lld's gdb_index support - it's probably
double counting the abbrev relocation offset.

This reverts commit r289954.

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

7 years agoRevert "[CodeGenPrep] Skip merging empty case blocks"
Jun Bum Lim [Fri, 16 Dec 2016 17:06:14 +0000 (17:06 +0000)]
Revert "[CodeGenPrep] Skip merging empty case blocks"

This reverts commit r289951.

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

7 years ago[InstCombine] auto-generate checks; NFC
Sanjay Patel [Fri, 16 Dec 2016 16:58:54 +0000 (16:58 +0000)]
[InstCombine] auto-generate checks; NFC

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

7 years ago[LV] Don't attempt to type-shrink scalarized instructions
Matthew Simpson [Fri, 16 Dec 2016 16:52:35 +0000 (16:52 +0000)]
[LV] Don't attempt to type-shrink scalarized instructions

After r288909, instructions feeding predicated instructions may be scalarized
if profitable. Since these instructions will remain scalar, we shouldn't
attempt to type-shrink them. We should only truncate vector types to their
minimal bit widths. This bug was exposed by enabling the vectorization of loops
containing conditional stores by default.

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

7 years agoPass sample pgo flags to thinlto.
Dehao Chen [Fri, 16 Dec 2016 16:48:46 +0000 (16:48 +0000)]
Pass sample pgo flags to thinlto.

Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing.

Reviewers: davidxl, mehdi_amini, tejohnson

Subscribers: pcc, davide, llvm-commits, mehdi_amini

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

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

7 years ago[X86] Fold (setcc (cmp (atomic_load_add x, -C) C), COND) to (setcc (LADD x, -C),...
Hans Wennborg [Fri, 16 Dec 2016 16:34:59 +0000 (16:34 +0000)]
[X86] Fold (setcc (cmp (atomic_load_add x, -C) C), COND) to (setcc (LADD x, -C), COND) (PR31367)

atomic_load_add returns the value before addition, but sets EFLAGS based on the
result of the addition. That means it's setting the flags based on effectively
subtracting C from the value at x, which is also what the outer cmp does.

This targets a pattern that occurs frequently with reference counting pointers:

  void decrement(long volatile *ptr) {
    if (_InterlockedDecrement(ptr) == 0)
      release();
  }

Clang would previously compile it (for 32-bit at -Os) as:

00000000 <?decrement@@YAXPCJ@Z>:
   0:   8b 44 24 04             mov    0x4(%esp),%eax
   4:   31 c9                   xor    %ecx,%ecx
   6:   49                      dec    %ecx
   7:   f0 0f c1 08             lock xadd %ecx,(%eax)
   b:   83 f9 01                cmp    $0x1,%ecx
   e:   0f 84 00 00 00 00       je     14 <?decrement@@YAXPCJ@Z+0x14>
  14:   c3                      ret

and with this patch it becomes:

00000000 <?decrement@@YAXPCJ@Z>:
   0:   8b 44 24 04             mov    0x4(%esp),%eax
   4:   f0 ff 08                lock decl (%eax)
   7:   0f 84 00 00 00 00       je     d <?decrement@@YAXPCJ@Z+0xd>
   d:   c3                      ret

(Equivalent variants with _InterlockedExchangeAdd, std::atomic<>'s fetch_add
or pre-decrement operator generate the same code.)

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

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

7 years agodwarfdump: Support/process relocations on a CU's abbrev_off
David Blaikie [Fri, 16 Dec 2016 16:31:10 +0000 (16:31 +0000)]
dwarfdump: Support/process relocations on a CU's abbrev_off

Input can be produced by ld -r, for example (a normal LLVM workflow
never hits this - LLVM only ever produces a single abbrev table in an
object (shared by multiple CUs), so the reloc's always 0, and when it's
linked together the relocation's resolved so it doesn't need to be
handled)

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

7 years ago[CodeGenPrep] Skip merging empty case blocks
Jun Bum Lim [Fri, 16 Dec 2016 16:03:31 +0000 (16:03 +0000)]
[CodeGenPrep] Skip merging empty case blocks

This is recommit of r287553 after fixing the invalid loop info after eliminating an empty block:

Summary: Merging an empty case block into the header block of switch could cause ISel to add COPY instructions in the header of switch, instead of the case block, if the case block is used as an incoming block of a PHI. This could potentially increase dynamic instructions, especially when the switch is in a loop. I added a test case which was reduced from the benchmark I was targetting.

Reviewers: t.p.northover, mcrosier, manmanren, wmi, joerg, davidxl

Subscribers: joerg, qcolombet, danielcdh, hfinkel, mcrosier, llvm-commits

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

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

7 years ago[X86][AVX] Call lowerVectorShuffleWithSHUFPS directly instead of calling DAG.getVecto...
Simon Pilgrim [Fri, 16 Dec 2016 15:23:32 +0000 (15:23 +0000)]
[X86][AVX] Call lowerVectorShuffleWithSHUFPS directly instead of calling DAG.getVectorShuffle (PR27885)

We've already done the hardwork of ensuring the mask is safe for 'SHUFPS'.

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

7 years ago[X86][AVX512] use a single shufps for 512-bit vectors when it can save instructions
Simon Pilgrim [Fri, 16 Dec 2016 14:30:04 +0000 (14:30 +0000)]
[X86][AVX512] use a single shufps for 512-bit vectors when it can save instructions

This is the 512-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@289946 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX512] Add tests showing missed opportunity to efficiently lower v16i32 to...
Simon Pilgrim [Fri, 16 Dec 2016 14:21:57 +0000 (14:21 +0000)]
[X86][AVX512] Add tests showing missed opportunity to efficiently lower v16i32 to VSHUFPS (PR27885)

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

7 years agoSpeculatively revert r289925, see PR31407
Nico Weber [Fri, 16 Dec 2016 14:02:28 +0000 (14:02 +0000)]
Speculatively revert r289925, see PR31407

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

7 years ago[MIRParser] Add parsing hex literals of arbitrary size as unsigned integers
Krzysztof Parzyszek [Fri, 16 Dec 2016 13:58:01 +0000 (13:58 +0000)]
[MIRParser] Add parsing hex literals of arbitrary size as unsigned integers

The current code does not parse hex literals larger than 32-bit.

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

7 years agoMove VerifierSupport into namespace llvm.
Daniel Jasper [Fri, 16 Dec 2016 13:53:46 +0000 (13:53 +0000)]
Move VerifierSupport into namespace llvm.

It currently is in an unnamed namespace and then it shouldn't be used
from something in the header file. This actually triggers a warning with
GCC:
../include/llvm/IR/Verifier.h:39:7: warning: ‘llvm::TBAAVerifier’ has a field ‘llvm::TBAAVerifier::Diagnostic’ whose type uses the anonymous namespace [enabled by default]

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

7 years ago[GlobalISel] Silence unused variable warnings in Release builds.
Benjamin Kramer [Fri, 16 Dec 2016 13:13:03 +0000 (13:13 +0000)]
[GlobalISel] Silence unused variable warnings in Release builds.

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

7 years ago[ARM] GlobalISel: Select add i32, i32
Diana Picus [Fri, 16 Dec 2016 12:54:46 +0000 (12:54 +0000)]
[ARM] GlobalISel: Select add i32, i32

Add the minimal support necessary to select a function that returns the sum of
two i32 values.

This includes some support for argument/return lowering of i32 values through
registers, as well as the handling of copy and add instructions throughout the
GlobalISel pipeline.

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

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

7 years ago[X86][SSE] Combine shuffles to MOVSS/MOVSD whatever the domain.
Simon Pilgrim [Fri, 16 Dec 2016 11:48:51 +0000 (11:48 +0000)]
[X86][SSE] Combine shuffles to MOVSS/MOVSD whatever the domain.

We already do the same thing in shuffle lowering; but don't do it if we have SSE41 (PBLEND) instead.

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

7 years ago[AVR] Add a test for 64-bit left shifts
Dylan McKay [Fri, 16 Dec 2016 11:40:00 +0000 (11:40 +0000)]
[AVR] Add a test for 64-bit left shifts

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

7 years agoRevert r289863: [LV] Enable vectorization of loops with conditional
Chandler Carruth [Fri, 16 Dec 2016 11:31:39 +0000 (11:31 +0000)]
Revert r289863: [LV] Enable vectorization of loops with conditional
stores by default

This uncovers a crasher in the loop vectorizer on PPC when building the
Python runtime. I'll send the testcase to the review thread for the
original commit.

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

7 years ago [codegen] Add generic functions to skip debug values.
Florian Hahn [Fri, 16 Dec 2016 11:10:26 +0000 (11:10 +0000)]
 [codegen] Add generic functions to skip debug values.

Summary:
This commits moves skipDebugInstructionsForward and
skipDebugInstructionsBackward from lib/CodeGen/IfConversion.cpp
to include/llvm/CodeGen/MachineBasicBlock.h and updates
some codgen files to use them.

This refactoring was suggested in https://reviews.llvm.org/D27688
and I thought it's best to do the refactoring in a separate
review, but I could also put both changes in a single review
if that's preferred.

Also, the names for the functions aren't the snappiest and
I would be happy to rename them if anybody has suggestions.

Reviewers: eli.friedman, iteratee, aprantl, MatzeB

Subscribers: MatzeB, llvm-commits

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

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

7 years ago[ARM] Expose methods to get the CCAssignFn. NFCI
Diana Picus [Fri, 16 Dec 2016 10:35:20 +0000 (10:35 +0000)]
[ARM] Expose methods to get the CCAssignFn. NFCI

Add two public methods to ARMTargetLowering: CCAssignFnForCall and
CCAssignFnForReturn, which are just calling the already existing private method
CCAssignFnForNode. These will come in handy for GlobalISel on ARM.

We also replace all calls to CCAssignFnForNode in ARMISelLowering.cpp, because
the new methods are friendlier to the reader.

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

7 years agoExtra coverage tests to demonstrate fixes in D72618 and D26855
Andrew V. Tischenko [Fri, 16 Dec 2016 09:56:02 +0000 (09:56 +0000)]
Extra coverage tests to demonstrate fixes in D72618 and D26855

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

7 years agoRevert r289638: [PowerPC] Fix logic dealing with nop after calls (and tail-call eligi...
Chandler Carruth [Fri, 16 Dec 2016 07:31:20 +0000 (07:31 +0000)]
Revert r289638: [PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)

This patch appears to result in trampolines in vtables being miscompiled
when they in turn tail call a method.

I've posted some preliminary details about the failure on the thread for
this commit and talked to Hal. He was comfortable going ahead and
reverting until we sort out what is wrong.

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

7 years agoExtract a TBAAVerifier out of the verifier (NFC)
Mehdi Amini [Fri, 16 Dec 2016 06:29:14 +0000 (06:29 +0000)]
Extract a TBAAVerifier out of the verifier (NFC)

This is intended to be used (in a later patch) by the BitcodeReader
to detect invalid TBAA and drop them when loading bitcode, so that
we don't break client that have legacy bitcode with possible invalid
TBAA.

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

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

7 years agoattempt to fix windows build
Nico Weber [Fri, 16 Dec 2016 05:13:02 +0000 (05:13 +0000)]
attempt to fix windows build

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

7 years agoUpdate .debug_line section version information to match DWARF version.
Ekaterina Romanova [Fri, 16 Dec 2016 05:10:11 +0000 (05:10 +0000)]
Update .debug_line section version information to match DWARF version.

One more attempt to re-commit the patch r285355, which I had to revert in r285362, because some tests were failing (the reason is because the size of the line_table varied depending on the full file name).

In the past the compiler always emitted .debug_line version 2, though some opcodes from DWARF 3 (e.g. DW_LNS_set_prologue_end, DW_LNS_set_epilogue_begin or DW_LNS_set_isa) and from DWARF 4 could be emitted by the compiler.

This patch changes version information of .debug_line to exactly match the DWARF version. For .debug_line version 4, a new field maximum_operations_per_instruction is emitted.

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

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

7 years agoRevert 279703, it caused PR31404.
Nico Weber [Fri, 16 Dec 2016 04:51:25 +0000 (04:51 +0000)]
Revert 279703, it caused PR31404.

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

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Fri, 16 Dec 2016 04:25:54 +0000 (04:25 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

This reapplies r289902 with additional testcase upgrades.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

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

7 years ago[ThinLTO] Thin link efficiency: More efficient export list computation
Teresa Johnson [Fri, 16 Dec 2016 04:11:51 +0000 (04:11 +0000)]
[ThinLTO] Thin link efficiency: More efficient export list computation

Summary:
Instead of checking whether a global referenced by a function being
imported is defined in the same module, speculatively always add the
referenced globals to the module's export list. After all imports are
computed, for each module prune any not in its defined set from its
export list.

For a huge C++ app with aggressive importing thresholds, even with
D27687 we spent a lot of time invoking modulePath() from
exportGlobalInModule (modulePath() was still the 2nd hottest routine in
profile). The reason is that with comdat/linkonce the summary lists for
each GUID can be long. For the app in question, for example, we were
invoking exportGlobalInModule almost 2 million times, and we traversed
an average of 63 entries in the summary list each time.

This patch reduced the thin link time for the app by about 10% (on top
of D27687) when using aggressive importing thresholds, and about 3.5% on
average with default importing thresholds.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

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

7 years agoAdd extra headers that got deleted by my revert in r289916 but for which
Chandler Carruth [Fri, 16 Dec 2016 04:08:31 +0000 (04:08 +0000)]
Add extra headers that got deleted by my revert in r289916 but for which
new usage had already grown in the file.

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

7 years agoRevert patch series introducing the DAG combine to match a load-by-bytes
Chandler Carruth [Fri, 16 Dec 2016 04:05:22 +0000 (04:05 +0000)]
Revert patch series introducing the DAG combine to match a load-by-bytes
idiom.

r289538: Match load by bytes idiom and fold it into a single load
r289540: Fix a buildbot failure introduced by r289538
r289545: Use more detailed assertion messages in the code ...
r289646: Add a couple of assertions to the load combine code ...

This DAG combine has a bad crash in it that is quite hard to trigger
sadly -- it relies on sneaking code with UB through the SDAG build and
into this particular combine. I've responded to the original commit with
a test case that reproduces it.

However, the code also has other problems that will require substantial
changes to address and so I'm going ahead and reverting it for now. This
should unblock us and perhaps others that are hitting the crash in the
wild and will let a fresh patch with updated approach come in cleanly
afterward.

Sorry for any trouble or disruption!

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

7 years ago[SimplifyLibCalls] Use a lambda. NFCI.
Davide Italiano [Fri, 16 Dec 2016 02:28:38 +0000 (02:28 +0000)]
[SimplifyLibCalls] Use a lambda. NFCI.

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

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Dec 2016 01:00:40 +0000 (01:00 +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@289907 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[IR] Remove the DIExpression field from DIGlobalVariable."
Adrian Prantl [Fri, 16 Dec 2016 01:00:30 +0000 (01:00 +0000)]
Revert "[IR] Remove the DIExpression field from DIGlobalVariable."

This reverts commit 289902 while investigating bot berakage.

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

7 years ago[APFloatTest] Log when test fails. NFC
Tim Shen [Fri, 16 Dec 2016 00:47:17 +0000 (00:47 +0000)]
[APFloatTest] Log when test fails. NFC

Reviewers: iteratee

Subscribers: llvm-commits

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

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

7 years agoAdd missing library dep.
Peter Collingbourne [Fri, 16 Dec 2016 00:43:00 +0000 (00:43 +0000)]
Add missing library dep.

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

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Fri, 16 Dec 2016 00:36:43 +0000 (00:36 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

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

7 years ago[PPC] corrections in two testcases
Ehsan Amiri [Fri, 16 Dec 2016 00:33:07 +0000 (00:33 +0000)]
[PPC] corrections in two testcases

Removing sensitivity to scheduling (by using CHECK-DAG instead of CHECK) and
some other minor corrections.

In preparation to commit Power9 processor model.

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

7 years agoIPO: Introduce ThinLTOBitcodeWriter pass.
Peter Collingbourne [Fri, 16 Dec 2016 00:26:30 +0000 (00:26 +0000)]
IPO: Introduce ThinLTOBitcodeWriter pass.

This pass prepares a module containing type metadata for ThinLTO by splitting
it into regular and thin LTO parts if possible, and writing both parts to
a multi-module bitcode file. Modules that do not contain type metadata are
written unmodified as a single module.

All globals with type metadata are added to the regular LTO module, and
the rest are added to the thin LTO module.

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

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

7 years ago[AArch64] Add FeatureSlowMisaligned128Store to Exynos M1 and M2
Evandro Menezes [Fri, 16 Dec 2016 00:18:00 +0000 (00:18 +0000)]
[AArch64] Add FeatureSlowMisaligned128Store to Exynos M1 and M2

This feature now gates such stores after r289845.  Thus the Exynos
processors now need this feature.

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

7 years ago[ThinLTO] Thin link efficiency improvement: don't re-export globals (NFC)
Teresa Johnson [Thu, 15 Dec 2016 23:50:06 +0000 (23:50 +0000)]
[ThinLTO] Thin link efficiency improvement: don't re-export globals (NFC)

Summary:
We were reinvoking exportGlobalInModule numerous times redundantly.
No need to re-export globals referenced by a global that was already
imported from its module. This resulted in a large speedup in the thin
link for a big application, particularly when importing aggressiveness
was cranked up.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

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

7 years ago[SimplifyLibCalls] Add a test to make sure we lower fls(0) correctly.
Davide Italiano [Thu, 15 Dec 2016 23:48:07 +0000 (23:48 +0000)]
[SimplifyLibCalls] Add a test to make sure we lower fls(0) correctly.

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

7 years ago[SimplifyLibCalls] Lower fls() to llvm.ctlz().
Davide Italiano [Thu, 15 Dec 2016 23:45:11 +0000 (23:45 +0000)]
[SimplifyLibCalls] Lower fls() to llvm.ctlz().

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

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

7 years agoDebugInfo: Make a Generic test case actually generic (remove datalayout/triple)
David Blaikie [Thu, 15 Dec 2016 23:39:25 +0000 (23:39 +0000)]
DebugInfo: Make a Generic test case actually generic (remove datalayout/triple)

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

7 years agoDebugInfo: Address non-deterministic output (iterating a SmallPtrSet) in 289697
David Blaikie [Thu, 15 Dec 2016 23:37:38 +0000 (23:37 +0000)]
DebugInfo: Address non-deterministic output (iterating a SmallPtrSet) in 289697

Post-commit review feedback from Adrian Prantl.

Hopefully this fixes that up :)

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

7 years ago[IRTranslator] Merge the entry and ABI lowering blocks.
Quentin Colombet [Thu, 15 Dec 2016 23:32:25 +0000 (23:32 +0000)]
[IRTranslator] Merge the entry and ABI lowering blocks.

The IRTranslator uses an additional block before the LLVM-IR entry block
to perform all the ABI lowering and the constant hoisting. Thus, this
block is the actual entry block and it falls through the LLVM-IR entry
block. However, with such representation, we end up with two basic
blocks that are not maximal.

Therefore, this patch adds a bit of canonicalization by merging both the
LLVM-IR entry block and the ABI lowering/constants hoisting into one
block, making the resulting block more likely to be maximal (indeed the
LLVM-IR entry block might not have been maximal).

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

7 years agoDebugInfo: Emit ranges for functions with DISubprograms but lacking locations on...
David Blaikie [Thu, 15 Dec 2016 23:17:52 +0000 (23:17 +0000)]
DebugInfo: Emit ranges for functions with DISubprograms but lacking locations on any instructions

This seems more consistent, and helps tidy up/simplify some other code
in this change.

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

7 years ago[SimplifyLibCalls] Remove redundant folding logic for ffs().
Davide Italiano [Thu, 15 Dec 2016 23:11:00 +0000 (23:11 +0000)]
[SimplifyLibCalls] Remove redundant folding logic for ffs().

Lowering to llvm.cttz() will result in constant folding anyway
if the argument to ffs is a constant. Pointed out by Eli for
fls() in D14590.

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

7 years agoDon't combine splats with other shuffles.
Eli Friedman [Thu, 15 Dec 2016 22:41:40 +0000 (22:41 +0000)]
Don't combine splats with other shuffles.

We sometimes end up creating shuffles which are worse than the obvious
translation of the IR.

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

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

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

7 years agoFix R_AARCH64_MOVW_UABS_G3 relocation
Yichao Yu [Thu, 15 Dec 2016 22:36:53 +0000 (22:36 +0000)]
Fix R_AARCH64_MOVW_UABS_G3 relocation

Summary: The relocation is missing mask so an address that has non-zero bits in 47:43 may overwrite the register number. (Frequently shows up as target register changed to `xzr`....)

Reviewers: t.p.northover, lhames

Subscribers: davide, aemerson, rengolin, llvm-commits

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

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

7 years agoAMDGPU: Select branch on undef to uniform scc branch
Matt Arsenault [Thu, 15 Dec 2016 21:57:11 +0000 (21:57 +0000)]
AMDGPU: Select branch on undef to uniform scc branch

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

7 years ago[gold] Add datalayout to test where it was missing
Teresa Johnson [Thu, 15 Dec 2016 21:42:56 +0000 (21:42 +0000)]
[gold] Add datalayout to test where it was missing

Needed due to change to require datalayout (r289719).

Found this in my own testing, maybe there aren't any bots using a v1.12
gold yet.

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

7 years ago[ThinLTO] Revert part of r289843 that belonged to another patch.
Teresa Johnson [Thu, 15 Dec 2016 21:39:42 +0000 (21:39 +0000)]
[ThinLTO] Revert part of r289843 that belonged to another patch.

The code change for D27687 accidentally got committed along with the
main change in r289843. Revert it temporarily, so that I can recommit it
along with its test as intended.

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

7 years agoDon't combine a shuffle of two BUILD_VECTORs with duplicate elements.
Eli Friedman [Thu, 15 Dec 2016 21:36:59 +0000 (21:36 +0000)]
Don't combine a shuffle of two BUILD_VECTORs with duplicate elements.

Targets can't handle this case well in general; we often transform
a shuffle of two cheap BUILD_VECTORs to element-by-element insertion,
which is very inefficient.

Fixes https://llvm.org/bugs/show_bug.cgi?id=31364 . Partially
fixes https://llvm.org/bugs/show_bug.cgi?id=31301.

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

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

7 years ago[Verifier] Allow TBAA metadata on atomicrmw and atomiccmpxchg
Sanjoy Das [Thu, 15 Dec 2016 21:23:44 +0000 (21:23 +0000)]
[Verifier] Allow TBAA metadata on atomicrmw and atomiccmpxchg

This used to be allowed before r289402 by default (before r289402 you
could have TBAA metadata on any instruction), and while I'm not sure
that it helps, it does sound reasonable enough to not fail the verifier
and we have out-of-tree users who use this.

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

7 years ago[ThinLTO] Remove stale comment (NFC)
Teresa Johnson [Thu, 15 Dec 2016 20:53:31 +0000 (20:53 +0000)]
[ThinLTO] Remove stale comment (NFC)

This should have been removed with r288446.

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

7 years ago[PPC] Use CHECK-DAG instead of CHECK in the testcase
Ehsan Amiri [Thu, 15 Dec 2016 20:51:09 +0000 (20:51 +0000)]
[PPC] Use CHECK-DAG instead of CHECK in the testcase

This test is currently sensitive to scheduling. Using CHECK-DAG allows us to
preserve the main purpose of the test and remove this sensivity.

In preparation to commit Power9 processor model.

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

7 years agoAMDGPU: Fix asserting on returned tail calls
Matt Arsenault [Thu, 15 Dec 2016 20:50:12 +0000 (20:50 +0000)]
AMDGPU: Fix asserting on returned tail calls

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

7 years ago[ThinLTO] Thin link efficiency: skip candidate added later with higher threshold...
Teresa Johnson [Thu, 15 Dec 2016 20:48:19 +0000 (20:48 +0000)]
[ThinLTO] Thin link efficiency: skip candidate added later with higher threshold (NFC)

Summary:
Thin link efficiency improvement. After adding an importing candidate to
the worklist we might have later added it again with a higher threshold.
Skip it when popped from the worklist if we recorded a higher threshold
than the current worklist entry, it will get processed again at the
higher threshold when that entry is popped.

This required adding the summary's GUID to the worklist, so that it can
be used to query the recorded highest threshold for it when we pop from the
worklist.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

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

7 years agoAMDGPU: Assembler support for vintrp instructions
Matt Arsenault [Thu, 15 Dec 2016 20:40:20 +0000 (20:40 +0000)]
AMDGPU: Assembler support for vintrp instructions

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

7 years ago[LV] Enable vectorization of loops with conditional stores by default
Matthew Simpson [Thu, 15 Dec 2016 20:11:05 +0000 (20:11 +0000)]
[LV] Enable vectorization of loops with conditional stores by default

This patch sets the default value of the "-enable-cond-stores-vec" command line
option to "true".

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

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

7 years ago[SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else...
Andrea Di Biagio [Thu, 15 Dec 2016 20:01:26 +0000 (20:01 +0000)]
[SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else branch. NFC.

Now that a new API to merge debug locations has been committed at r289661 (see
review D26256 for more details), we can use it to "improve" the code added by
revision r280995.

Instead of nulling the debugloc of a commoned instruction, we use the 'merged'
debug location. At the moment, this is just a no functional change since
function `DILocation::getMergedLocation()` is just a stub and would always
return a null location.

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

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

7 years ago[LiveRangeEdit] Change eliminateDeadDef assert to if condition.
Geoff Berry [Thu, 15 Dec 2016 19:55:19 +0000 (19:55 +0000)]
[LiveRangeEdit] Change eliminateDeadDef assert to if condition.

The assert could potentially fire (though no cases have been
encountered), so just check that the instruction we're handling
specially for rematerialization only has one def to begin with.

Reviewed by Wei Mi over email.

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

7 years agoLibDriver: Allow resource files to be archive members.
Peter Collingbourne [Thu, 15 Dec 2016 19:37:46 +0000 (19:37 +0000)]
LibDriver: Allow resource files to be archive members.

It seems pointless to add a resource to an archive because it won't have
any symbols to link against (and link.exe doesn't have an equivalent of
--whole-archive), but lib.exe allows it for some reason.

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

7 years agoRe-add the check for __has_attribute in StringLiteral.
Zachary Turner [Thu, 15 Dec 2016 19:33:31 +0000 (19:33 +0000)]
Re-add the check for __has_attribute in StringLiteral.

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

7 years agoBrainF example: fixing segfault caused by outdated code with missing MCJIT dependency
Boris Ulasevich [Thu, 15 Dec 2016 19:29:42 +0000 (19:29 +0000)]
BrainF example: fixing segfault caused by outdated code with missing MCJIT dependency
Differential Revision: https://reviews.llvm.org/D26280

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

7 years agoIgnore -Wgcc-compat diagnostic in StringLiteral.
Zachary Turner [Thu, 15 Dec 2016 19:22:58 +0000 (19:22 +0000)]
Ignore -Wgcc-compat diagnostic in StringLiteral.

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

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