[llvm] c21cceb - [VPlan] Use usesScalars in shouldPack.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 06:12:32 PST 2023


Author: Florian Hahn
Date: 2023-02-20T14:11:40Z
New Revision: c21ccebe6f5293fc1359456b31d188edc9c5ac66

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

LOG: [VPlan] Use usesScalars in shouldPack.

Suggested by @Ayal as follow-up improvement in D143864.

I was unable to find a case where this actually changes generated code,
but it is a unifying code to use common infrastructure.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 0e5dee7b89ac..951ea8a346b1 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -926,8 +926,9 @@ bool VPReplicateRecipe::shouldPack() const {
   // VPPredInstPHIRecipe. In this case, also pack the scalar values in a vector.
   return any_of(users(), [](const VPUser *U) {
     if (auto *PredR = dyn_cast<VPPredInstPHIRecipe>(U))
-      return any_of(PredR->users(),
-                    [](const VPUser *U) { return !isa<VPReplicateRecipe>(U); });
+      return any_of(PredR->users(), [PredR](const VPUser *U) {
+        return !U->usesScalars(PredR);
+      });
     return false;
   });
 }


        


More information about the llvm-commits mailing list