[llvm] 32efff5 - [VPlan] Mark load VPWidenMemoryInstruction as not having side-effects.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 14:03:00 PST 2023
Author: Florian Hahn
Date: 2023-02-07T22:02:50Z
New Revision: 32efff591abb159ca18d6c8c974d3ca45d444864
URL: https://github.com/llvm/llvm-project/commit/32efff591abb159ca18d6c8c974d3ca45d444864
DIFF: https://github.com/llvm/llvm-project/commit/32efff591abb159ca18d6c8c974d3ca45d444864.diff
LOG: [VPlan] Mark load VPWidenMemoryInstruction as not having side-effects.
Also add an assert using the underlying instruction to catch any
potential violations.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 34981111c85e5..ff0b1df57ce4a 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -127,6 +127,13 @@ bool VPRecipeBase::mayHaveSideEffects() const {
"underlying instruction has side-effects");
return false;
}
+ case VPWidenMemoryInstructionSC:
+ assert(cast<VPWidenMemoryInstructionRecipe>(this)
+ ->getIngredient()
+ .mayHaveSideEffects() == mayWriteToMemory() &&
+ "mayHaveSideffects result for ingredient
diff ers from this "
+ "implementation");
+ return mayWriteToMemory();
case VPReplicateSC: {
auto *R = cast<VPReplicateRecipe>(this);
return R->getUnderlyingInstr()->mayHaveSideEffects();
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index a8797994bc93b..ff7ee53bfbcf0 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -1100,7 +1100,7 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
VPValue Addr;
VPValue Mask;
VPWidenMemoryInstructionRecipe Recipe(*Load, &Addr, &Mask, true, false);
- EXPECT_TRUE(Recipe.mayHaveSideEffects());
+ EXPECT_FALSE(Recipe.mayHaveSideEffects());
EXPECT_TRUE(Recipe.mayReadFromMemory());
EXPECT_FALSE(Recipe.mayWriteToMemory());
EXPECT_TRUE(Recipe.mayReadOrWriteMemory());
More information about the llvm-commits
mailing list