mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[LSV] Insert stores at the right point.
Summary: Previously, the insertion point for stores was the last instruction in Chain *before calling getVectorizablePrefixEndIdx*. Thus if getVectorizablePrefixEndIdx didn't return Chain.size(), we still would insert at the last instruction in Chain. This patch changes our internal API a bit in an attempt to make it less prone to this sort of error. As a result, we end up recalculating the Chain's boundary instructions, but I think worrying about the speed hit of this is a premature optimization right now. Reviewers: asbirlea, tstellarAMD Subscribers: mzolotukhin, arsenm, llvm-commits Differential Revision: https://reviews.llvm.org/D22534 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276056 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
|
||||
target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
|
||||
|
||||
; Check relative position of the inserted vector load relative to the existing
|
||||
; adds. Vectorized loads should be inserted at the position of the first load.
|
||||
; Check position of the inserted vector load/store. Vectorized loads should be
|
||||
; inserted at the position of the first load in the chain, and stores should be
|
||||
; inserted at the position of the last store.
|
||||
|
||||
; CHECK-LABEL: @insert_load_point(
|
||||
; CHECK: %z = add i32 %x, 4
|
||||
@@ -59,4 +60,30 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Here we have four stores, with an aliasing load before the last one. We can
|
||||
; vectorize the first two stores as <2 x float>, but this vectorized store must
|
||||
; be inserted at the location of the second scalar store, not the fourth one.
|
||||
;
|
||||
; CHECK-LABEL: @insert_store_point_alias
|
||||
; CHECK: store <2 x float>
|
||||
; CHECK: store float
|
||||
; CHECK-SAME: %a.idx.2
|
||||
; CHECK: load float, float addrspace(1)* %a.idx.2
|
||||
; CHECK: store float
|
||||
; CHECK-SAME: %a.idx.3
|
||||
define float @insert_store_point_alias(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, 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.3, align 4
|
||||
|
||||
ret float %x
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind }
|
||||
|
||||
Reference in New Issue
Block a user