[llvm] cf2d436 - [VPlan] VPPredInstPHIRecipe does not read from memory.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 13:51:12 PST 2023


Author: Florian Hahn
Date: 2023-01-31T21:51:03Z
New Revision: cf2d436b31af3c5eb33cfb708b0f5eeb30e57070

URL: https://github.com/llvm/llvm-project/commit/cf2d436b31af3c5eb33cfb708b0f5eeb30e57070
DIFF: https://github.com/llvm/llvm-project/commit/cf2d436b31af3c5eb33cfb708b0f5eeb30e57070.diff

LOG: [VPlan] VPPredInstPHIRecipe does not read from memory.

VPPredInstPHIRecipe just merges the incoming values and does not write
to memory.

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 8c09b2fa9d15e..34981111c85e5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -83,6 +83,7 @@ bool VPRecipeBase::mayReadFromMemory() const {
         ->mayReadFromMemory();
   case VPBranchOnMaskSC:
   case VPScalarIVStepsSC:
+  case VPPredInstPHISC:
     return false;
   case VPWidenIntOrFpInductionSC:
   case VPWidenCanonicalIVSC:

diff  --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index 015f1f98f2eff..a8797994bc93b 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -1165,9 +1165,9 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
     VPValue Op1;
     VPPredInstPHIRecipe Recipe(&Op1);
     EXPECT_FALSE(Recipe.mayHaveSideEffects());
-    EXPECT_TRUE(Recipe.mayReadFromMemory());
+    EXPECT_FALSE(Recipe.mayReadFromMemory());
     EXPECT_FALSE(Recipe.mayWriteToMemory());
-    EXPECT_TRUE(Recipe.mayReadOrWriteMemory());
+    EXPECT_FALSE(Recipe.mayReadOrWriteMemory());
   }
 }
 


        


More information about the llvm-commits mailing list