[llvm] 5368536 - [VPlan] VPPredInstPHIRecipes does not write to memory.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 02:29:48 PST 2023


Author: Florian Hahn
Date: 2023-01-30T10:29:27Z
New Revision: 5368536cf1db183790461c9d9ab9fa96bfa536eb

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

LOG: [VPlan] VPPredInstPHIRecipes does not write to 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 4e9be35001adf..8c09b2fa9d15e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -50,6 +50,7 @@ bool VPRecipeBase::mayWriteToMemory() const {
         ->mayWriteToMemory();
   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 377d607835e12..015f1f98f2eff 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -1166,7 +1166,7 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
     VPPredInstPHIRecipe Recipe(&Op1);
     EXPECT_FALSE(Recipe.mayHaveSideEffects());
     EXPECT_TRUE(Recipe.mayReadFromMemory());
-    EXPECT_TRUE(Recipe.mayWriteToMemory());
+    EXPECT_FALSE(Recipe.mayWriteToMemory());
     EXPECT_TRUE(Recipe.mayReadOrWriteMemory());
   }
 }


        


More information about the llvm-commits mailing list