18 Commits

Author SHA1 Message Date
Justin Lebar
7e9ef3abf7 [LSV] Nix two global (ish) variables in the LoadStoreVectorizer. NFC
Reviewers: asbirlea

Subscribers: mzolotukhin, llvm-commits, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 23:19:16 +00:00
Alina Sbirlea
2c9bd4fc5e Extended LoadStoreVectorizer to vectorize subchains.
Summary:
LSV used to abort vectorizing a chain for interleaved load/store accesses that alias.
Allow a valid prefix of the chain to be vectorized, mark just the prefix and retry vectorizing the remaining chain.

Reviewers: llvm-commits, jlebar, arsenm

Subscribers: mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:20:01 +00:00
Alina Sbirlea
334778a70b Correct ordering of loads/stores.
Summary:
Aiming to correct the ordering of loads/stores. This patch changes the
insert point for loads to the position of the first load.
It updates the ordering method for loads to insert before, rather than after.

Before this patch the following sequence:
"load a[1], store a[1], store a[0], load a[2]"
Would incorrectly vectorize to "store a[0,1], load a[1,2]".
The correctness check was assuming the insertion point for loads is at
the position of the first load, when in practice it was at the last
load. An alternative fix would have been to invert the correctness check.
The current fix changes insert position but also requires reordering of
instructions before the vectorized load.

Updated testcases to reflect the changes.

Reviewers: tstellarAMD, llvm-commits, jlebar, arsenm

Subscribers: mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275117 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 22:34:29 +00:00
Alina Sbirlea
87c883dc04 Add TLI.allowsMisalignedMemoryAccesses to LoadStoreVectorizer
Summary: Extend TTI to access TLI.allowsMisalignedMemoryAccesses(). Check condition when vectorizing load and store chains.
Add additional parameters: AddressSpace, Alignment, Fast.

Reviewers: llvm-commits, jlebar

Subscribers: arsenm, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275100 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 20:46:17 +00:00
Rui Ueyama
adafb27fcb Add a missing semicolon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07 20:21:50 +00:00
Alina Sbirlea
a159545362 Clang-format LoadStoreVectorizer
Reviewers: llvm-commits, jlebar, arsenm

Subscribers: mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274792 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07 20:10:35 +00:00
Matt Arsenault
c1be1f5883 LoadStoreVectorizer: Fix warning about extra semicolon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 23:26:54 +00:00
Alina Sbirlea
1e53a5fcec Address two correctness issues in LoadStoreVectorizer
Summary:
GetBoundryInstruction returns the last instruction as the instruction which follows or end(). Otherwise the last instruction in the boundry set is not being tested by isVectorizable().
Partially solve reordering of instructions. More extensive solution to follow.

Reviewers: tstellarAMD, llvm-commits, jlebar

Subscribers: escha, arsenm, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 21:44:12 +00:00
Matt Arsenault
af386368d0 LoadStoreVectorizer: improvements: better pointer analysis
If OpB has an ADD NSW/NUW, we can use that to prove that adding 1
to OpA won't wrap if OpA + 1 == OpB.

Patch by Fiona Glaser

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274324 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 02:16:24 +00:00
Matt Arsenault
2623a06878 LoadStoreVectorizer: Don't increase alignment with no align set
If no alignment was set on the load/stores, it would vectorize
to the new type even though this increases the default alignment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 02:09:38 +00:00
Matt Arsenault
d8f310cdf9 LoadStoreVectorizer: Check TTI for vec reg bit width
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 02:07:22 +00:00
Matt Arsenault
0b5646a61a LoadStoreVectorizer: Fix assert when merging pointer ops
This needs to use inttoptr/ptrtoint if combining an int and pointer
load. If a pointer is used always do an integer load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 01:55:52 +00:00
Matt Arsenault
7e961b6fb8 LoadStoreVectorizer: Use AA metadata
This was not passing the full instruction with metadata
to the alias query.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 01:47:46 +00:00
Matt Arsenault
378e1693a1 LoadStoreVectorizer: if one element of a vector is integer, default to
integer.

Fixes issues on some architectures where we use arithmetic ops to build
vectors, which can cause bad things to happen for loads/stores of mixed
types.

Patch by Fiona Glaser

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274307 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 00:37:01 +00:00
Matt Arsenault
9de35f8460 LoadStoreVectorizer: Fix crashes on sub-byte types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 00:36:54 +00:00
Matt Arsenault
531c987fec LoadStoreVectorizer: Check skipFunction first.
Also add test I forgot to add to r274296.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274299 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 23:50:18 +00:00
Matt Arsenault
34f70b6118 LoadStoreVectorizer: Skip optnone functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 23:30:29 +00:00
Matt Arsenault
8b86030deb Add LoadStoreVectorizer pass
This was contributed by Apple, and I've been working on
minimal cleanups and generalizing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 23:11:38 +00:00