diff options
author | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2019-11-06 09:58:36 +0000 |
---|---|---|
committer | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2019-11-06 10:14:20 +0000 |
commit | 6c2a4f5ff93e16c3b86c18543e02a193ced2d956 (patch) | |
tree | d2cb3ef09bdcc0e963f75f4dd5cfa58705d450da /llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll | |
parent | 9577ee84e638530be7a310c9d50526a36e3c212e (diff) | |
download | bcm5719-llvm-6c2a4f5ff93e16c3b86c18543e02a193ced2d956.tar.gz bcm5719-llvm-6c2a4f5ff93e16c3b86c18543e02a193ced2d956.zip |
[TTI][LV] preferPredicateOverEpilogue
We have two ways to steer creating a predicated vector body over creating a
scalar epilogue. To force this, we have 1) a command line option and 2) a
pragma available. This adds a third: a target hook to TargetTransformInfo that
can be queried whether predication is preferred or not, which allows the
vectoriser to make the decision without forcing it.
While this change behaves as a non-functional change for now, it shows the
required TTI plumbing, usage of this new hook in the vectoriser, and the
beginning of an ARM MVE implementation. I will follow up on this with:
- a complete MVE implementation, see D69845.
- a patch to disable this, i.e. we should respect "vector_predicate(disable)"
and its corresponding loophint.
Differential Revision: https://reviews.llvm.org/D69040
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll')
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll b/llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll index fc9ef2b3b76..af755c88742 100644 --- a/llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll +++ b/llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll @@ -7,6 +7,37 @@ target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "thumbv8.1m.main-arm-unknown-eabihf" +define dso_local void @tail_folding(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) #0 { +; CHECK-LABEL: tail_folding( +; CHECK: vector.body: +; +; This needs implementation of TTI::preferPredicateOverEpilogue, +; then this will be tail-folded too: +; +; CHECK-NOT: call <4 x i32> @llvm.masked.load.v4i32.p0v4i32( +; CHECK-NOT: call void @llvm.masked.store.v4i32.p0v4i32( +; CHECK: br i1 %{{.*}}, label %{{.*}}, label %vector.body +entry: + br label %for.body + +for.cond.cleanup: + ret void + +for.body: + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] + %arrayidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv + %0 = load i32, i32* %arrayidx, align 4 + %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %indvars.iv + %1 = load i32, i32* %arrayidx2, align 4 + %add = add nsw i32 %1, %0 + %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv + store i32 %add, i32* %arrayidx4, align 4 + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 + %exitcond = icmp eq i64 %indvars.iv.next, 430 + br i1 %exitcond, label %for.cond.cleanup, label %for.body +} + + define dso_local void @tail_folding_enabled(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) local_unnamed_addr #0 { ; COMMON-LABEL: tail_folding_enabled( ; COMMON: vector.body: @@ -50,7 +81,7 @@ define dso_local void @tail_folding_disabled(i32* noalias nocapture %A, i32* noa ; PREDFLAG: call void @llvm.masked.store.v4i32.p0v4i32( ; PREDFLAG: %index.next = add i64 %index, 4 ; PREDFLAG: %12 = icmp eq i64 %index.next, 432 -; PREDFLAG: br i1 %12, label %middle.block, label %vector.body, !llvm.loop !4 +; PREDFLAG: br i1 %{{.*}}, label %middle.block, label %vector.body, !llvm.loop !6 entry: br label %for.body @@ -77,7 +108,7 @@ for.body: ; CHECK-NEXT: !3 = !{!"llvm.loop.unroll.runtime.disable"} ; CHECK-NEXT: !4 = distinct !{!4, !1} ; CHECK-NEXT: !5 = distinct !{!5, !3, !1} - +; CHECK-NEXT: !6 = distinct !{!6, !1} attributes #0 = { nofree norecurse nounwind "target-features"="+armv8.1-m.main,+mve.fp" } !6 = distinct !{!6, !7, !8} |