[llvm] 3d422a9 - [VPlan] Implement mayHaveSideEffects/mayWriteToMemory for VPInterleav… (#71360)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 08:23:18 PST 2023
Author: Shih-Po Hung
Date: 2023-12-15T00:23:14+08:00
New Revision: 3d422a98595f0617e7a0b687fe9fd9f21cc25deb
URL: https://github.com/llvm/llvm-project/commit/3d422a98595f0617e7a0b687fe9fd9f21cc25deb
DIFF: https://github.com/llvm/llvm-project/commit/3d422a98595f0617e7a0b687fe9fd9f21cc25deb.diff
LOG: [VPlan] Implement mayHaveSideEffects/mayWriteToMemory for VPInterleav… (#71360)
…eRecipe
This helps VPlanTransforms::removeDeadRecipes to work on
VPInterleaveRecipe
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index c23428e2ba34e8..02e400d590bed4 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -44,6 +44,8 @@ extern cl::opt<bool> EnableVPlanNativePath;
bool VPRecipeBase::mayWriteToMemory() const {
switch (getVPDefID()) {
+ case VPInterleaveSC:
+ return cast<VPInterleaveRecipe>(this)->getNumStoreOperands() > 0;
case VPWidenMemoryInstructionSC: {
return cast<VPWidenMemoryInstructionRecipe>(this)->isStore();
}
@@ -146,6 +148,8 @@ bool VPRecipeBase::mayHaveSideEffects() const {
"underlying instruction has side-effects");
return false;
}
+ case VPInterleaveSC:
+ return mayWriteToMemory();
case VPWidenMemoryInstructionSC:
assert(cast<VPWidenMemoryInstructionRecipe>(this)
->getIngredient()
diff --git a/llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll b/llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
index 63be3eabb4d193..5ea27994b356da 100644
--- a/llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
+++ b/llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
@@ -18,14 +18,9 @@ define void @test_unused_interleave(ptr %src, i32 %length) {
; CHECK-EMPTY:
; CHECK-NEXT: <x1> vector loop: {
; CHECK-NEXT: vector.body:
-; CHECK-NEXT: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%7>
-; CHECK-NEXT: vp<%3> = SCALAR-STEPS vp<%2>, ir<1>
-; CHECK-NEXT: CLONE ir<%next19.i.i> = getelementptr inbounds ir<%src>, vp<%3>, ir<0>
-; CHECK-NEXT: INTERLEAVE-GROUP with factor 2 at %load_p1, ir<%next19.i.i>
-; CHECK-NEXT: ir<%load_p1> = load from index 0
-; CHECK-NEXT: ir<%load_p2> = load from index 1
-; CHECK-NEXT: EMIT vp<%7> = add nuw vp<%2>, vp<%0>
-; CHECK-NEXT: EMIT branch-on-count vp<%7>, vp<%1>
+; CHECK-NEXT: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%3>
+; CHECK-NEXT: EMIT vp<%3> = add nuw vp<%2>, vp<%0>
+; CHECK-NEXT: EMIT branch-on-count vp<%3>, vp<%1>
; CHECK-NEXT: No successors
; CHECK-NEXT: }
entry:
More information about the llvm-commits
mailing list