diff options
author | Justin Lebar <jlebar@google.com> | 2016-07-20 00:55:12 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-07-20 00:55:12 +0000 |
commit | 6114b378380904423cf7dd5abc94b11dfe5f59f9 (patch) | |
tree | 0ebc3ccf63f12bf04a13c979bdc230699b6f9a08 /llvm/test/Transforms/LoadStoreVectorizer/AMDGPU | |
parent | 58dda5a7169a8f1921f179842febd21fba48d624 (diff) | |
download | bcm5719-llvm-6114b378380904423cf7dd5abc94b11dfe5f59f9.tar.gz bcm5719-llvm-6114b378380904423cf7dd5abc94b11dfe5f59f9.zip |
[LSV] Don't assume that loads/stores appear in address order in the BB.
Summary:
getVectorizablePrefix previously didn't work properly in the face of
aliasing loads/stores. It unwittingly assumed that the loads/stores
appeared in the BB in address order. If they didn't, it would do the
wrong thing.
Reviewers: asbirlea, tstellarAMD
Subscribers: arsenm, llvm-commits, mzolotukhin
Differential Revision: https://reviews.llvm.org/D22535
llvm-svn: 276072
Diffstat (limited to 'llvm/test/Transforms/LoadStoreVectorizer/AMDGPU')
-rw-r--r-- | llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/insertion-point.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/insertion-point.ll b/llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/insertion-point.ll index 4672224672f..7078a9b5c49 100644 --- a/llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/insertion-point.ll +++ b/llvm/test/Transforms/LoadStoreVectorizer/AMDGPU/insertion-point.ll @@ -86,4 +86,34 @@ define float @insert_store_point_alias(float addrspace(1)* nocapture %a, i64 %id ret float %x } +; Here we have four stores, with an aliasing load before the last one. We +; could vectorize two of the stores before the load (although we currently +; don't), but the important thing is that we *don't* sink the store to +; a[idx + 1] below the load. +; +; CHECK-LABEL: @insert_store_point_alias_ooo +; CHECK: store float +; CHECK-SAME: %a.idx.3 +; CHECK: store float +; CHECK-SAME: %a.idx.1 +; CHECK: store float +; CHECK-SAME: %a.idx.2 +; CHECK: load float, float addrspace(1)* %a.idx.2 +; CHECK: store float +; CHECK-SAME: %a.idx +define float @insert_store_point_alias_ooo(float addrspace(1)* nocapture %a, i64 %idx) { + %a.idx = getelementptr inbounds float, float addrspace(1)* %a, i64 %idx + %a.idx.1 = getelementptr inbounds float, float addrspace(1)* %a.idx, i64 1 + %a.idx.2 = getelementptr inbounds float, float addrspace(1)* %a.idx.1, i64 1 + %a.idx.3 = getelementptr inbounds float, float addrspace(1)* %a.idx.2, i64 1 + + store float 0.0, float addrspace(1)* %a.idx.3, align 4 + store float 0.0, float addrspace(1)* %a.idx.1, align 4 + store float 0.0, float addrspace(1)* %a.idx.2, align 4 + %x = load float, float addrspace(1)* %a.idx.2, align 4 + store float 0.0, float addrspace(1)* %a.idx, align 4 + + ret float %x +} + attributes #0 = { nounwind } |