[PATCH] D136368: [VPlan] Use onlyFirstLaneUsed in sinkScalarOperands.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 29 11:46:09 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG43f0f1a66ff0: [VPlan] Use onlyFirstLaneUsed in sinkScalarOperands. (authored by fhahn).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136368/new/
https://reviews.llvm.org/D136368
Files:
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
llvm/test/Transforms/LoopVectorize/interleaved-accesses-pred-stores.ll
Index: llvm/test/Transforms/LoopVectorize/interleaved-accesses-pred-stores.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/interleaved-accesses-pred-stores.ll
+++ llvm/test/Transforms/LoopVectorize/interleaved-accesses-pred-stores.ll
@@ -38,8 +38,9 @@
; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x i1> [[TMP4]], i64 0
; CHECK-NEXT: br i1 [[TMP5]], label [[PRED_STORE_IF:%.*]], label [[PRED_STORE_CONTINUE:%.*]]
; CHECK: pred.store.if:
+; CHECK-NEXT: [[TMP2_1:%.*]] = getelementptr inbounds [[PAIR:%.*]], %pair* [[P:%.*]], i64 [[INDEX]], i32 1
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <4 x i64> [[WIDE_VEC]], i64 0
-; CHECK-NEXT: store i64 [[TMP6]], i64* [[TMP2]], align 8
+; CHECK-NEXT: store i64 [[TMP6]], i64* [[TMP2_1]], align 8
; CHECK-NEXT: br label [[PRED_STORE_CONTINUE]]
; CHECK: pred.store.continue:
; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x i1> [[TMP4]], i64 1
@@ -136,8 +137,9 @@
; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i1> [[TMP7]], i64 0
; CHECK-NEXT: br i1 [[TMP8]], label [[PRED_STORE_IF:%.*]], label [[PRED_STORE_CONTINUE:%.*]]
; CHECK: pred.store.if:
+; CHECK-NEXT: [[PTR0:%.*]] = getelementptr inbounds [[PAIR:%.*]], %pair* [[P:%.*]], i64 [[INDEX]], i32 0
; CHECK-NEXT: [[TMP9:%.*]] = extractelement <4 x i64> [[WIDE_VEC]], i64 0
-; CHECK-NEXT: store i64 [[TMP9]], i64* [[TMP3]], align 8
+; CHECK-NEXT: store i64 [[TMP9]], i64* [[PTR0]], align 8
; CHECK-NEXT: br label [[PRED_STORE_CONTINUE]]
; CHECK: pred.store.continue:
; CHECK-NEXT: [[TMP10:%.*]] = extractelement <2 x i1> [[TMP7]], i64 1
@@ -246,8 +248,9 @@
; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i1> [[TMP7]], i64 0
; CHECK-NEXT: br i1 [[TMP8]], label [[PRED_STORE_IF:%.*]], label [[PRED_STORE_CONTINUE:%.*]]
; CHECK: pred.store.if:
+; CHECK-NEXT: [[PTR1:%.*]] = getelementptr inbounds [[PAIR]], %pair* [[P]], i64 [[INDEX]], i32 1
; CHECK-NEXT: [[TMP9:%.*]] = extractelement <4 x i64> [[WIDE_VEC]], i64 0
-; CHECK-NEXT: store i64 [[TMP9]], i64* [[TMP5]], align 8
+; CHECK-NEXT: store i64 [[TMP9]], i64* [[PTR1]], align 8
; CHECK-NEXT: br label [[PRED_STORE_CONTINUE]]
; CHECK: pred.store.continue:
; CHECK-NEXT: [[TMP10:%.*]] = extractelement <2 x i1> [[TMP7]], i64 1
Index: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -138,8 +138,7 @@
// All recipe users of the sink candidate must be in the same block SinkTo
// or all users outside of SinkTo must be uniform-after-vectorization (
// i.e., only first lane is used) . In the latter case, we need to duplicate
- // SinkCandidate. At the moment, we identify such UAV's by looking for the
- // address operands of widened memory recipes.
+ // SinkCandidate.
auto CanSinkWithUser = [SinkTo, &NeedsDuplicating,
SinkCandidate](VPUser *U) {
auto *UI = dyn_cast<VPRecipeBase>(U);
@@ -147,12 +146,8 @@
return false;
if (UI->getParent() == SinkTo)
return true;
- auto *WidenI = dyn_cast<VPWidenMemoryInstructionRecipe>(UI);
- if (WidenI && WidenI->getAddr() == SinkCandidate) {
- NeedsDuplicating = true;
- return true;
- }
- return false;
+ NeedsDuplicating = UI->onlyFirstLaneUsed(SinkCandidate);
+ return NeedsDuplicating;
};
if (!all_of(SinkCandidate->users(), CanSinkWithUser))
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136368.471770.patch
Type: text/x-patch
Size: 3667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221029/6f66c121/attachment.bin>
More information about the llvm-commits
mailing list