[llvm] c963092 - [VPlan] Mark VPCanonicalIVPHI as not reading memory (NFCI). (#190338)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 06:12:26 PDT 2026


Author: Florian Hahn
Date: 2026-04-03T13:12:20Z
New Revision: c963092b0c67318f6e18a6e955f293f96aa38f46

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

LOG: [VPlan] Mark VPCanonicalIVPHI as not reading memory (NFCI). (#190338)

The canonical IV does not access any memory. Mark accordingly. This
should be NFC end-to-end.

PR: https://github.com/llvm/llvm-project/pull/190338

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 05a47273b799a..8323d0d8562a4 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -126,6 +126,7 @@ bool VPRecipeBase::mayReadFromMemory() const {
                 ->onlyWritesMemory();
   case VPWidenIntrinsicSC:
     return cast<VPWidenIntrinsicRecipe>(this)->mayReadFromMemory();
+  case VPCanonicalIVPHISC:
   case VPBranchOnMaskSC:
   case VPDerivedIVSC:
   case VPCurrentIterationPHISC:

diff  --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index c28631a5a3ddb..ec9c904a08b2c 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -1449,6 +1449,13 @@ TEST_F(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) {
     EXPECT_FALSE(Recipe.mayWriteToMemory());
     EXPECT_FALSE(Recipe.mayReadOrWriteMemory());
   }
+  {
+    VPIRValue *StartV = Plan.getZero(Int32);
+    VPCanonicalIVPHIRecipe Recipe(StartV, {});
+    EXPECT_FALSE(Recipe.mayReadFromMemory());
+    EXPECT_FALSE(Recipe.mayWriteToMemory());
+    EXPECT_FALSE(Recipe.mayReadOrWriteMemory());
+  }
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)


        


More information about the llvm-commits mailing list