[PATCH] D147434: [LV] Improve register pressure estimation if MaxLocalUsers is zero
Yevgeny Rouban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 10 01:16:18 PDT 2023
yrouban updated this revision to Diff 520930.
yrouban added a comment.
just rebased over the updated D147588 <https://reviews.llvm.org/D147588>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147434/new/
https://reviews.llvm.org/D147434
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/interleave-count.ll
Index: llvm/test/Transforms/LoopVectorize/X86/interleave-count.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/X86/interleave-count.ll
+++ llvm/test/Transforms/LoopVectorize/X86/interleave-count.ll
@@ -5,15 +5,15 @@
; RUN: -force-target-max-vector-interleave=16 -force-target-num-vector-regs=16 \
; RUN: %s 2>&1 | FileCheck %s
-; Check that the interleave count is limited by 8 even if there is no
+; Check that the interleave count is not limited by 8 if there is no
; register use except one induction variable.
define void @test(ptr %dst, i64 %size) {
; CHECK-LABEL: LV: Checking a loop in 'test'
-; CHECK: LV: IC is 8
+; CHECK: LV: IC is 16
;
; CHECK-LABEL: define void @test
;
-; Number of @llvm.masked.scatter() calls is 8.
+; Number of @llvm.masked.scatter() calls is 16.
; CHECK: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
@@ -22,6 +22,14 @@
; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
+; CHECK-NEXT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
; CHECK-NOT: call void @llvm.masked.scatter.v4f64.v4p0(<4 x double>
;
entry:
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5814,15 +5814,17 @@
if (R.LoopInvariantRegs.find(pair.first) != R.LoopInvariantRegs.end())
LoopInvariantRegs = R.LoopInvariantRegs[pair.first];
- unsigned TmpIC = llvm::bit_floor((TargetNumRegisters - LoopInvariantRegs) /
- MaxLocalUsers);
- // Don't count the induction variable as interleaved.
if (EnableIndVarRegisterHeur) {
- TmpIC = llvm::bit_floor((TargetNumRegisters - LoopInvariantRegs - 1) /
- std::max(1U, (MaxLocalUsers - 1)));
+ // Treat the induction variable as a LoopInvariantReg.
+ assert(MaxLocalUsers);
+ --MaxLocalUsers;
+ ++LoopInvariantRegs;
+ }
+ if (MaxLocalUsers > 0) {
+ unsigned TmpIC = llvm::bit_floor(
+ (TargetNumRegisters - LoopInvariantRegs) / MaxLocalUsers);
+ IC = std::min(IC, TmpIC);
}
-
- IC = std::min(IC, TmpIC);
}
// Clamp the interleave ranges to reasonable counts.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147434.520930.patch
Type: text/x-patch
Size: 3189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/f3215f94/attachment.bin>
More information about the llvm-commits
mailing list