This reverts commit 4562a953db.
The recommit adjusts processLaneForReplicateRegion to first remap all
operands, then update the new operands. This fixes a VPlan verification
failure when running LV tests with expensive checks.
Original message:
This patch adds a new replicateReplicateRegionsByVF transform to unroll
replicate=regions by VF, dissolving them. The transform creates VF
copies of the replicate-region's content, connects them and converts
recipes to single-scalar variants for the corresponding lanes.
The initial version skips regions with live-outs (VPPredInstPHIRecipe),
which will be added in follow-up patches.
Depends on https://github.com/llvm/llvm-project/pull/170053
PR: https://github.com/llvm/llvm-project/pull/170212
41 lines
1.3 KiB
LLVM
41 lines
1.3 KiB
LLVM
; RUN: opt -passes=loop-vectorize %s -force-vector-width=1 -force-vector-interleave=2 -S -o - | FileCheck %s
|
|
|
|
define void @foo(ptr addrspace(1) %in) {
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%iter = phi i64 [ %next, %loop ], [ 0, %entry ]
|
|
%ascast = addrspacecast ptr addrspace(1) %in to ptr
|
|
%next = add i64 %iter, 1
|
|
%arrayidx = getelementptr inbounds i64, ptr %ascast, i64 %next
|
|
store i64 %next, ptr %arrayidx, align 4
|
|
|
|
; check that we find the two interleaved blocks with ascast, gep and store:
|
|
; CHECK: pred.store.if:
|
|
; CHECK: [[ID1:%.*]] = add i64 %{{.*}}, 1
|
|
; CHECK: [[AS1:%.*]] = addrspacecast ptr addrspace(1) %{{.*}} to ptr
|
|
; CHECK: [[GEP1:%.*]] = getelementptr inbounds i64, ptr [[AS1]], i64 [[ID1]]
|
|
; CHECK: store i64 [[ID1]], ptr [[GEP1]]
|
|
|
|
; CHECK: pred.store.if1:
|
|
; CHECK: [[ID2:%.*]] = add i64 %{{.*}}, 1
|
|
; CHECK: [[AS2:%.*]] = addrspacecast ptr addrspace(1) %in to ptr
|
|
; CHECK: [[GEP2:%.*]] = getelementptr inbounds i64, ptr [[AS2]], i64 [[ID2]]
|
|
; CHECK: store i64 [[ID2]], ptr [[GEP2]], align 4
|
|
|
|
%cmp = icmp eq i64 %next, 7
|
|
br i1 %cmp, label %exit, label %loop
|
|
|
|
; check that we branch to the exit block
|
|
; CHECK: middle.block:
|
|
; CHECK: br label %exit
|
|
|
|
exit:
|
|
ret void
|
|
; CHECK: exit:
|
|
; CHECK: ret void
|
|
}
|
|
|
|
; CHECK: !{{[0-9]*}} = !{!"llvm.loop.isvectorized", i32 1}
|