Commit Graph

437 Commits

Author SHA1 Message Date
Matthew Simpson a7fd2c3c2a [AArch64] Implement getArithmeticReductionCost
This patch provides an implementation of getArithmeticReductionCost for
AArch64. We can specialize the cost of add reductions since they are computed
using the 'addv' instruction.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327702 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16 11:34:15 +00:00
Alexey Bataev 7c6f31a848 [SLP] Additional tests for stores vectorization, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326740 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-05 20:20:12 +00:00
Mohammad Shahid 820fd02e9a [SLP] Added new tests and updated existing for jumbled load, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326303 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-28 04:19:34 +00:00
Sanjay Patel dcf9b1dd5e [AArch64] add SLP test based on TSVC; NFC
This is a slight reduction of one of the benchmarks
that suffered with D43079. Cost model changes should
not cause this test to remain scalarized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326217 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-27 18:06:15 +00:00
Simon Pilgrim 0eea35a6ef [X86][SSE] Reduce FADD/FSUB/FMUL costs on later targets (PR36280)
Agner's tables indicate that for SSE42+ targets (Core2 and later) we can reduce the FADD/FSUB/FMUL costs down to 1, which should fix the Himeno benchmark.

Note: the AVX512 FDIV costs look rather dodgy, but this isn't part of this patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326133 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-26 22:10:17 +00:00
Alexey Bataev b4efe59b69 [SLP] Added new test + fixed some checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326117 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-26 20:01:24 +00:00
Simon Pilgrim b891e74e20 [SLPVectorizer][X86] Add load extend tests (PR36091)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325772 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-22 12:19:34 +00:00
Sanjay Patel 5c377f610d [AArch64] fix IR names to not be 'tmp' because that gives the CHECK script problems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325718 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 20:48:14 +00:00
Sanjay Patel b0c13268b8 [AArch64] add SLP test for matmul (PR36280); NFC
This is a slight reduction of one of the benchmarks
that suffered with D43079. Cost model changes should
not cause this test to remain scalarized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325717 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 20:34:16 +00:00
Alexey Bataev 27e6b3dc3f [SLP] Fix test checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325689 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 15:32:58 +00:00
Sanjay Patel 1c629279f1 revert r325515: [TTI CostModel] change default cost of FP ops to 1 (PR36280)
There are too many perf regressions resulting from this, so we need to 
investigate (and add tests for) targets like ARM and AArch64 before 
trying to reinstate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325658 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-21 01:42:52 +00:00
Alexey Bataev 771994be2d [SLP] Fix tests checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325605 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20 18:11:50 +00:00
Sanjay Patel 1fceaab028 [TTI CostModel] change default cost of FP ops to 1 (PR36280)
This change was mentioned at least as far back as:
https://bugs.llvm.org/show_bug.cgi?id=26837#c26
...and I found a real program that is harmed by this: 
Himeno running on AMD Jaguar gets 6% slower with SLP vectorization:
https://bugs.llvm.org/show_bug.cgi?id=36280
...but the change here appears to solve that bug only accidentally.

The div/rem costs for x86 look very wrong in some cases, but that's already true, 
so we can fix those in follow-up patches. There's also evidence that more cost model
changes are needed to solve SLP problems as shown in D42981, but that's an independent 
problem (though the solution may be adjusted after this change is made).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325515 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-19 16:11:44 +00:00
Alexey Bataev 90f3933650 [SLP] Fix the test for the reversed stores, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325268 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 17:11:50 +00:00
Alexey Bataev 0b720faa05 [SLP] Added test for reversed stores, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325265 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15 16:56:49 +00:00
Alexey Bataev acdbc6f43e [SLP] Allow vectorization of reversed loads.
Summary:
Reversed loads are handled as gathering. But we can just reshuffle
these values. Patch adds support for vectorization of reversed loads.

Reviewers: RKSimon, spatel, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325134 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 15:29:15 +00:00
Alexey Bataev c7432f53e0 [SLP] Take user instructions cost into consideration in insertelement vectorization.
Summary:
For better vectorization result we should take into consideration the
cost of the user insertelement instructions when we try to
vectorize sequences that build the whole vector. I.e. if we have the
following scalar code:
```
<Scalar code>
insertelement <ScalarCode>, ...
```
we should consider the cost of the last `insertelement ` instructions as
the cost of the scalar code.

Reviewers: RKSimon, spatel, hfinkel, mkuper

Subscribers: javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324893 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 14:54:48 +00:00
Sanjay Patel 86517c4a08 [SLPVectorizer] auto-generate complete checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324616 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 15:32:28 +00:00
Sanjay Patel 6412c3723b [SLPVectorizer] auto-generate complete checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324615 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 15:30:39 +00:00
Sanjay Patel 306ada1fe0 [SLPVectorizer] move RUN line to top-of-file; NFC
I was confused what we were checking because the RUN line was
in the middle of the file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324614 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 15:28:49 +00:00
Sanjay Patel 24f7956b08 [SLPVectorizer] auto-generate complete checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324612 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-08 15:16:26 +00:00
Alexey Bataev 3750e6f0a3 [SLP] Add a tests for PR36280, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324510 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-07 20:11:37 +00:00
Alexey Bataev 35f84d8666 [SLP] Update test checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324387 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 20:00:05 +00:00
Alexey Bataev 45adc55a27 [SLP] Add extra test for extractelement shuffle, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323815 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 21:06:06 +00:00
Alexey Bataev 3f3f6a1251 [SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323662 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-29 16:08:52 +00:00
Alexey Bataev 2d5d897622 [SLP] Add a test with extract for PR32086, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-29 15:56:52 +00:00
Alexey Bataev 1cd5ead0a5 Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."
This reverts commit r323530 to fix possible problems in users code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323581 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-27 02:42:21 +00:00
Alexey Bataev b5e54f8455 [SLP] Test for trunc vectorization, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323556 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 20:07:55 +00:00
Alexey Bataev 320b80d34b [SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323530 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 14:31:09 +00:00
Alexey Bataev 974e2fc5fb Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."
This reverts commit r323441 to fix buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323447 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 17:28:12 +00:00
Alexey Bataev 80e5ea7e4f [SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323441 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 16:45:18 +00:00
Alexey Bataev d80d8d29ed Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."
This reverts commit r323430 to fix buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323432 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 15:20:29 +00:00
Alexey Bataev edd25896b5 [SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323430 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-25 15:01:36 +00:00
Alexey Bataev fca705a118 Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."
This reverts commit r323348 because of the broken buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323359 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 18:36:51 +00:00
Alexey Bataev d9c395b630 [SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323348 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 17:50:53 +00:00
Sanjay Patel bf4a8b9bd6 [SLPVectorizer] add test for PR13837; NFC
This was probably fixed long ago, but I don't see a test
that lines up with the example and target in the bug report:
https://bugs.llvm.org/show_bug.cgi?id=13837
...so adding it here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323269 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 22:04:17 +00:00
Alexey Bataev 67a08f2331 Revert "[SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle."
This reverts commit r323246 because of the broken buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323252 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 20:11:27 +00:00
Alexey Bataev eac7ece1f7 [SLP] Fix for PR32086: Count InsertElementInstr of the same elements as shuffle.
Summary:
If the same value is going to be vectorized several times in the same
tree entry, this entry is considered to be a gather entry and cost of
this gather is counter as cost of InsertElementInstrs for each gathered
value. But we can consider these elements as ShuffleInstr with
SK_PermuteSingle shuffle kind.

Reviewers: spatel, RKSimon, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323246 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 19:30:26 +00:00
Alexey Bataev 0d23c0467f [SLP] Fix vectorization for tree with trunc to minimum required bit width.
Summary:
If the vectorized tree has truncate to minimum required bit width and
the vector type of the cast operation after the truncation is the same
as the vector type of the cast operands, count cost of the vector cast
operation as 0, because this cast will be later removed.
Also, if the vectorization tree root operations are integer cast operations, do not consider them as candidates for truncation. It will just create extra number of the same vector/scalar operations, which will be removed by instcombiner.

Reviewers: RKSimon, spatel, mkuper, hfinkel, mssimpso

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322946 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-19 14:40:13 +00:00
Alexey Bataev fb4e566d08 [SLP] Fix test checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322865 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-18 17:34:27 +00:00
Alexey Bataev 559e93a4df [SLP] Fix for PR32164: Improve vectorization of reverse order of extract operations.
Summary: Sometimes vectorization of insertelement instructions with extractelement operands may produce an extra shuffle operation, if these operands are in the reverse order. Patch tries to improve this situation by the reordering of the operands to remove this extra shuffle operation.

Reviewers: mkuper, hfinkel, RKSimon, spatel

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322579 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-16 18:17:01 +00:00
Alexey Bataev 5cf8c80669 [SLP] Add/update tests for SLP vectorizer, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322225 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10 21:29:18 +00:00
Alexey Bataev c719b31f2b [COST]Fix PR35865: Fix cost model evaluation for shuffle on X86.
Summary:
If the vector type is transformed to non-vector single type, the compile
may crash trying to get vector information about non-vector type.

Reviewers: RKSimon, spatel, mkuper, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322106 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-09 19:08:22 +00:00
Alexey Bataev 7c83c156f0 [SLP] Fix PR35777: Incorrect handling of aggregate values.
Summary:
Fixes the bug with incorrect handling of InsertValue|InsertElement
instrucions in SLP vectorizer. Currently, we may use incorrect
ExtractElement instructions as the operands of the original
InsertValue|InsertElement instructions.

Reviewers: mkuper, hfinkel, RKSimon, spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321994 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 14:43:06 +00:00
Alexey Bataev ef7f9d0c03 [SLP] Fix PR35628: Count external uses on extra reduction arguments.
Summary:
If the vectorized value is marked as extra reduction argument, its users
are not considered as external users. Patch fixes this.

Reviewers: mkuper, hfinkel, RKSimon, spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321993 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 14:33:11 +00:00
Davide Italiano 16819e6bda [SLPVectorizer] Reintroduce std::stable_sort(properlyDominates()).
The approach was never discussed, I wasn't able to reproduce this
non-determinism, and the original author went AWOL.
After a discussion on the ML, Philip suggested to revert this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321974 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 22:06:24 +00:00
Alexey Bataev 3b86f03288 [SLP] Update more test checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321872 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 16:15:17 +00:00
Alexey Bataev 1c740fb886 [SLP] Update test checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321870 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 15:20:40 +00:00
Alexey Bataev 2021bac78d [SLP] Update tests checks, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321869 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 14:40:04 +00:00
Mohammad Shahid d73abb30a4 Revert r320548:[SLP] Vectorize jumbled memory loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321181 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 15:26:59 +00:00