[llvm] b223229 - [VPlan] Re-use existing step again after 34accad1feae.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 13:43:13 PDT 2023


Author: Florian Hahn
Date: 2023-08-08T21:42:56+01:00
New Revision: b223229e2ca3335605f94d13e09e7723ae859609

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

LOG: [VPlan] Re-use existing step again after 34accad1feae.

This fixes a failing RISCV test case that was missed originally.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 26e638aef4db45..0d8ae0eebb6d86 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -503,12 +503,11 @@ void VPlanTransforms::removeDeadRecipes(VPlan &Plan) {
 
 static VPValue *createScalarIVSteps(VPlan &Plan, const InductionDescriptor &ID,
                                     ScalarEvolution &SE, Instruction *TruncI,
-                                    Type *IVTy, VPValue *StartV) {
+                                    Type *IVTy, VPValue *StartV,
+                                    VPValue *Step) {
   VPBasicBlock *HeaderVPBB = Plan.getVectorLoopRegion()->getEntryBasicBlock();
   auto IP = HeaderVPBB->getFirstNonPhi();
   VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
-  VPValue *Step =
-      vputils::getOrCreateVPValueForSCEVExpr(Plan, ID.getStep(), SE);
   Type *TruncTy = TruncI ? TruncI->getType() : IVTy;
   VPValue *BaseIV = CanonicalIV;
   if (!CanonicalIV->isCanonical(ID.getKind(), StartV, Step, TruncTy)) {
@@ -535,9 +534,9 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan, ScalarEvolution &SE) {
       continue;
 
     const InductionDescriptor &ID = WideIV->getInductionDescriptor();
-    VPValue *Steps = createScalarIVSteps(Plan, ID, SE, WideIV->getTruncInst(),
-                                         WideIV->getPHINode()->getType(),
-                                         WideIV->getStartValue());
+    VPValue *Steps = createScalarIVSteps(
+        Plan, ID, SE, WideIV->getTruncInst(), WideIV->getPHINode()->getType(),
+        WideIV->getStartValue(), WideIV->getStepValue());
 
     // Update scalar users of IV to use Step instead. Use SetVector to ensure
     // the list of users doesn't contain duplicates.


        


More information about the llvm-commits mailing list