Commit Graph

149087 Commits

Author SHA1 Message Date
Ayal Zaks
7a3330e101 [LV] Refactor ILV.vectorize{Loop}() by introducing LVP.executePlan(); NFC
Introduce LoopVectorizationPlanner.executePlan(), replacing ILV.vectorize() and
refactoring ILV.vectorizeLoop(). Method collectDeadInstructions() is moved from
ILV to LVP. These changes facilitate building VPlans and using them to generate
code, following https://reviews.llvm.org/D28975 and its tentative breakdown.

Method ILV.createEmptyLoop() is renamed ILV.createVectorizedLoopSkeleton() to
improve clarity; it's contents remain intact.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302790 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 11:36:33 +00:00
Alexander Potapenko
a0d77192f6 [msan] Fix PR32842
It turned out that MSan was incorrectly calculating the shadow for int comparisons: it was done by truncating the result of (Shadow1 OR Shadow2) to i1, effectively rendering all bits except LSB useless.
This approach doesn't work e.g. in the case where the values being compared are even (i.e. have the LSB of the shadow equal to zero).
Instead, if CreateShadowCast() has to cast a bigger int to i1, we replace the truncation with an ICMP to 0.

This patch doesn't affect the code generated for SPEC 2006 binaries, i.e. there's no performance impact.

For the test case reported in PR32842 MSan with the patch generates a slightly more efficient code:

  orq     %rcx, %rax
  jne     .LBB0_6
, instead of:

  orl     %ecx, %eax
  testb   $1, %al
  jne     .LBB0_6




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 11:07:48 +00:00
Chandler Carruth
c4b356568b [x86] Fix a failure to select with AVX-512 when the type legalizer
manages to form a VSELECT with a non-i1 element type condition. Those
are technically allowed in SDAG (at least, the generic type legalization
logic will form them and I wouldn't want to try to audit everything te
preclude forming them) so we need to be able to lower them.

This isn't too hard to implement. We mark VSELECT as custom so we get
a chance in C++, add a fast path for i1 conditions to get directly
handled by the patterns, and a fallback when we need to manually force
the condition to be an i1 that uses the vptestm instruction to turn
a non-mask into a mask.

This, unsurprisingly, generates awful code. But it at least doesn't
crash. This was actually impacting open source packages built with LLVM
for AVX-512 in the wild, so quickly landing a patch that at least stops
the immediate bleeding.

I think I've found where to fix the codegen quality issue, but less
confident of that change so separating it out from the thing that
doesn't change the result of any existing test case but causes mine to
not crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302785 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 10:52:16 +00:00
Simon Pilgrim
7d572e564a Strip trailing whitespace. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 10:03:05 +00:00
Diana Picus
c978c0ff91 [ARM][GlobalISel] Legalize narrow scalar ops by widening
This is the same as r292827 for AArch64: we widen 8- and 16-bit ADD, SUB
and MUL to 32 bits since we only have TableGen patterns for 32 bits.
See the commit message for r292827 for more details.

At this point we could just remove some of the tests for regbankselect
and instruction-select, since we're not going to see any narrow
operations at those levels anymore. Instead I decided to update them
with G_ANYEXT/G_TRUNC operations, so we can validate the full sequences
generated by the legalizer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302782 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 09:45:57 +00:00
Serge Guelton
cee7471c11 Remove spurious cast of nullptr. NFC.
Conversion rules allow automatic casting of nullptr to any pointer type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302780 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 08:53:00 +00:00
Serge Guelton
fd3c18701d Remove now useless trailing nullptr in StructType::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302779 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 08:46:02 +00:00
Diana Picus
62bc4f0ac3 [ARM][GlobalISel] Support for G_ANYEXT
G_ANYEXT can be introduced by the legalizer when widening scalars. Add
support for it in the register bank info (same mapping as everything
else) and in the instruction selector.

When selecting it, we treat it as a COPY, just like G_TRUNC. On this
occasion we get rid of some assertions in selectCopy so we can reuse it.
This shouldn't be a problem at the moment since we're not supporting any
complicated cases (e.g. FPR, different register banks). We might want to
separate the paths when we do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302778 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 08:28:31 +00:00
Igor Breger
e637084b4f [GlobalISel][X86] G_ICMP support.
Summary: support G_ICMP for scalar types i8/i16/i64.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, kristof.beyls, llvm-commits, krytarowski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302774 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 07:17:40 +00:00
Craig Topper
5c7bb0a38a [APInt] Remove an unneeded extra temporary APInt from toString.
Turns out udivrem can write its output to the same location as one of its inputs so the extra temporary isn't needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302772 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 07:10:43 +00:00
Craig Topper
e74359195a [APInt] Use negate() instead of copying an APInt to negate it and then writing back over the original value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302770 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 07:02:04 +00:00
Craig Topper
ada33d729b [SCEV] Reduce possible APInt allocations a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 06:48:54 +00:00
Craig Topper
4f3a92f37f [SCEV] Remove unneeded 'using namespace APIntOps'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302768 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 06:48:51 +00:00
Igor Breger
be8fe1635c [X86] Move getX86ConditionCode() from X86FastISel.cpp to X86InstrInfo.cpp. NFC
Summary:
Move getX86ConditionCode() from X86FastISel.cpp to X86InstrInfo.cpp so it can be used by GloabalIsel instruction selector.
This is a pre-commit for a patch I'm working on to support G_ICMP. NFC.

Reviewers: zvi, guyblank, delena

Reviewed By: guyblank, delena

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302767 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 06:36:37 +00:00
NAKAMURA Takumi
4638198b51 SupportTests: Suppress ParallelTests on mingw for now. Investigating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302766 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 06:35:51 +00:00
Paul Robinson
668926aef6 Remove redundant initialization. NFC
Post-commit review of r301940 by David Blaikie.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302756 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 02:07:08 +00:00
Eric Fiselier
895dd41413 Add temporary workaround to allow in-tree libc++ builds on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302753 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 01:44:30 +00:00
Zachary Turner
3e0a9ecbab Final (hopefully) fix for the build bots.
This time it actually occurred to me to change the #defines
to actually test the pre-processed out codepath.  Hopefully
this time it works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302752 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 00:22:18 +00:00
Zachary Turner
9525cd9ea7 Try again to fix the buildbots.
TaskGroup and Latch need to be in llvm::parallel::detail, not
in llvm::detail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302751 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 00:18:52 +00:00
Zachary Turner
7c964ef14c Fix build errors with Parallel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302749 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 00:09:30 +00:00
Zachary Turner
3c1ec57f40 [Support] Move Parallel algorithms from LLD to LLVM.
Differential Revision: https://reviews.llvm.org/D33024

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302748 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 00:03:52 +00:00
Kostya Serebryany
0b84d77114 [libFuzzer] fix a compiler warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302747 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 23:59:03 +00:00
David L. Jones
538282cc5e Revert "[SDAG] Relax conditions under stores of loaded values can be merged"
This reverts r302712.

The change fails with ASAN enabled:

ERROR: AddressSanitizer: use-after-poison on address ... at ...
READ of size 2 at ... thread T0
  #0 ... in llvm::SDNode::getNumValues() const <snip>/include/llvm/CodeGen/SelectionDAGNodes.h:855:42
  #1 ... in llvm::SDNode::hasAnyUseOfValue(unsigned int) const <snip>/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:7270:3
  #2 ... in llvm::SDValue::use_empty() const <snip> include/llvm/CodeGen/SelectionDAGNodes.h:1042:17
  #3 ... in (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*) <snip>/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12944:7

Reviewers: niravd

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 23:56:21 +00:00
Eugene Zelenko
335809335c [IR] Rollback changes in r302744 which caused buildbots failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302745 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 23:53:40 +00:00
Eugene Zelenko
dc6cb6019c [IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 23:41:30 +00:00
Davide Italiano
78f7d49428 [PHIElimination] Use the same name for DEBUG_TYPE and pass name.
In an attempt to reduce the confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 23:13:26 +00:00
Sanjay Patel
3ba25d2222 [InstCombine] remove fold that swaps xor/or with constants; NFCI
// (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)

This canonicalization was added at:
https://reviews.llvm.org/rL7264 

By moving xors out/down, we can more easily combine constants. I'm adding
tests that do not change with this patch, so we can verify that those kinds
of transforms are still happening.

This is no-functional-change-intended because there's a later fold:
// (X^C)|Y -> (X|Y)^C iff Y&C == 0
...and demanded-bits appears to guarantee that any fold that would have
hit the fold we're removing here would be caught by that 2nd fold.

Similar reasoning was used in:
https://reviews.llvm.org/rL299384

The larger motivation for removing this code is that it could interfere with 
the fix for PR32706:
https://bugs.llvm.org/show_bug.cgi?id=32706

Ie, we're not checking if the 'xor' is actually a 'not', so we could reverse
a 'not' optimization and cause an infinite loop by altering an 'xor X, -1'. 

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302733 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 21:33:55 +00:00
Matt Arsenault
c11234753f AMDGPU: Make some packed shuffles free
VOP3P instructions can encode access to either
half of the register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 21:29:33 +00:00
Matt Arsenault
0fad9cb52e AMDGPU: Add new subtarget features for gfx9 flat instructions
Flat instructions gain an immediate offset, and 2 new
sets of segment specific flat instructions are added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302729 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 21:19:05 +00:00
Craig Topper
b97a02c7d3 [ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers to really do what the comment says
r271020 added an early out to skip the signed multiply portion of ConstantRange::multiply. The comment says we don't need to do signed multiply if the range is only positive numbers, but the implemented check only ensures that the start of the range is positive. It doesn't look at the end of the range.

This patch checks the end of the range instead. Because Upper is one more than the end we have to see if its positive or if its one past the last positive number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 20:01:48 +00:00
Craig Topper
d53f653e9b [APInt] Add negate helper method to implement twos complement. Use it to shorten code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302716 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 20:01:38 +00:00
Davide Italiano
3750feec55 [NewGVN] Introduce a definesNoMemory() helper and use it.
This is nice as is, but it will be used in my next patch to
fix a bug. Suggested by Daniel Berlin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302714 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 19:57:43 +00:00
Nirav Dave
a7aa63a594 [SDAG] Relax conditions under stores of loaded values can be merged
Summary:

Allow consecutive stores whose values come from consecutive loads to
merged in the presense of other uses of the loads. Previously this was
disallowed as in general the merged load cannot be shared with the
other uses. Merging N stores into 1 may cause as many as N redundant
loads. However in the context of caching this should have neglible
affect on memory pressure and reduce instruction count making it
almost always a win.

Fixes PR32086.

Reviewers: spatel, jyknight, andreadb, hfinkel, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302712 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 19:53:41 +00:00
Teresa Johnson
63eb7ab316 Ensure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builder
This fixes a ubsan bot failure after r302597, which made getProfileCount
non-static, but ended up invoking it on a null ProfileSummaryInfo object
in some cases from buildModuleSummaryIndex.

Most testing passed because the non-static getProfileCount currently
doesn't access any member variables, but I found this when testing a
follow on patch (D32877) that adds a member variable access.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:52:16 +00:00
Craig Topper
66571bbb0a [APInt] Make toString use udivrem instead of calling the divide helper method directly. Do a better job of reusing allocations while looping. NFCI
This lets toString take advantage of the degenerate case checks in udivrem and is just generally cleaner.

One minor downside of this is that the divisor APInt now needs to be the same size as Tmp which requires an additional allocation. But we were doing a poor job of reusing allocations before so the new code should still be an improvement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302704 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:15:24 +00:00
Craig Topper
439700ccdd [APInt] Use uint32_t instead of unsigned for the storage type throughout the divide code. Use Lo_32/Hi_32/Make_64 helpers instead of casts and shifts. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:15:20 +00:00
Craig Topper
223d23f311 [APInt] Use getRawData to slightly simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302702 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:15:17 +00:00
Craig Topper
b97c98e5dc [APInt] Remove check for single word since single word was handled earlier in the function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302701 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:15:14 +00:00
Craig Topper
21adc2deca [ConstantRange] Add test case showing a case where we pick too large of a range for multiply after r271020.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302700 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:15:06 +00:00
Amaury Sechet
8648143a02 Small refactoring in DAGCombine. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302699 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 17:58:28 +00:00
Sanjay Patel
947cc8fc26 [InstSimplify, InstCombine] move 'or' simplification tests; NFC
Surprisingly, I don't think these are redundant for InstSimplify. 
They were just misplaced as InstCombine tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 15:57:47 +00:00
Simon Pilgrim
22b377c4f5 [X86][SSE] Check vec_set BUILD_VECTOR tests on both 32 and 64-bit targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302683 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 15:52:59 +00:00
Quentin Colombet
e518f7a661 [AArch64][RegisterBankInfo] Change the default mapping of fp stores.
For stores, check if the stored value is defined by a floating point
instruction and if yes, we return a default mapping with FPR instead
of GPR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302679 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 15:19:41 +00:00
Amara Emerson
7c631c8afc [AArch64] Enable use of reduction intrinsics.
The new experimental reduction intrinsics can now be used, so I'm enabling this
for AArch64. We will need this for SVE anyway, so it makes sense to do this for
NEON reductions as well.

The existing code to match shufflevector patterns are replaced with a direct
lowering of the reductions to AArch64-specific nodes. Tests updated with the
new, simpler, representation.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302678 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 15:15:38 +00:00
Sanjay Patel
2b63eecefe [InstCombine] remove redundant tests
The first test in this file is duplicated exactly in and.ll -> test33.
We have commuted and vector variants there too.

The second test is a composite of 2 folds. The first fold is tested
independently in add.ll -> flip_and_mask (including vector variant).
After that transform fires, the IR is identical to the first transform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302676 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:54:49 +00:00
Sanjay Patel
be27149182 [InstCombine] fix auto-generated FileCheck-captured variable refs
The script at utils/update_test_checks.py has (had?) a bug when variables
start with the same sequence of letters (clearly, not all of the time).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302674 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:40:04 +00:00
Sanjay Patel
fa879b87eb [InstCombine] fix typo in test comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302669 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:25:23 +00:00
Ulrich Weigand
81fa691fd6 [SystemZ] Add miscellaneous instructions
This adds a few missing instructions for the assembler and
disassembler.  Those should be the last missing general-
purpose (Chapter 7) instructions for the z10 ISA.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302667 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:20:15 +00:00
Ulrich Weigand
c12fbb0eea [SystemZ] Add missing arithmetic instructions
This adds the remaining general arithmetic instructions
for assembler / disassembler use.  Most of these are not
useful for codegen; a few might be, and those are listed
in the README.txt for future improvements.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:18:47 +00:00
Sam Clegg
2436e4547c [llvm-readobj] Improve errors on invalid binary
The previous code was discarding the error message from
createBinary() by calling errorToErrorCode().
This meant that such error were always reported unhelpfully
as "Invalid data was encountered while parsing the file".

Other tools such as llvm-objdump already produce a more
the error message in this case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 14:18:11 +00:00