-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LoopVectorize] Take vscale into account when deciding to create epil…
…ogues In LoopVectorizationCostModel::isEpilogueVectorizationProfitable we check to see if the chosen main vector loop VF >= 16. If so, we decide to create a vector epilogue loop. However, this doesn't take VScaleForTuning into account because we could be targeting a CPU where vscale > 1, and hence the runtime VF would be a multiple of the known minimum value. This patch multiplies scalable VFs by VScaleForTuning and several tests have been updated that now produce vector epilogues. Differential Revision: https://reviews.llvm.org/D147522
- Loading branch information
Showing
5 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
llvm/test/Transforms/LoopVectorize/AArch64/runtime-check-size-based-threshold.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-vscale-tune.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
; RUN: opt -S -passes=loop-vectorize,instsimplify -force-vector-interleave=1 \ | ||
; RUN: -mcpu=neoverse-v1 < %s | FileCheck %s --check-prefix=CHECK-EPILOG | ||
; RUN: opt -S -passes=loop-vectorize,instsimplify -force-vector-interleave=1 \ | ||
; RUN: -mcpu=neoverse-v1 < %s | FileCheck %s --check-prefix=CHECK-EPILOG | ||
; RUN: opt -S -passes=loop-vectorize,instsimplify -force-vector-interleave=1 \ | ||
; RUN: -mcpu=neoverse-v2 < %s | FileCheck %s --check-prefix=CHECK-NO-EPILOG | ||
; RUN: opt -S -passes=loop-vectorize,instsimplify -force-vector-interleave=1 \ | ||
; RUN: -mcpu=cortex-x2 < %s | FileCheck %s --check-prefix=CHECK-NO-EPILOG | ||
|
||
target triple = "aarch64-unknown-linux-gnu" | ||
|
||
define void @foo(ptr noalias nocapture readonly %p, ptr noalias nocapture %q, i64 %len) #0 { | ||
; CHECK-EPILOG: vec.epilog.ph: | ||
; CHECK-EPILOG: vec.epilog.vector.body: | ||
; CHECK-EPILOG: load <vscale x 4 x i16> | ||
|
||
; CHECK-NO-EPILOG-NOT: vec.epilog.vector.ph: | ||
; CHECK-NO-EPILOG-NOT: vec.epilog.vector.body: | ||
entry: | ||
br label %for.body | ||
|
||
for.body: ; preds = %entry, %for.body | ||
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] | ||
%arrayidx = getelementptr inbounds i16, ptr %p, i64 %indvars.iv | ||
%0 = load i16, ptr %arrayidx | ||
%add = add nuw nsw i16 %0, 2 | ||
%arrayidx3 = getelementptr inbounds i16, ptr %q, i64 %indvars.iv | ||
store i16 %add, ptr %arrayidx3 | ||
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 | ||
%exitcond = icmp eq i64 %indvars.iv.next, %len | ||
br i1 %exitcond, label %exit, label %for.body | ||
|
||
exit: ; preds = %for.body | ||
ret void | ||
} | ||
|
||
attributes #0 = { "target-features"="+sve" vscale_range(1,16) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters