[llvm] 8f337f8 - [VectorCombine] generalize pass param name for early combines; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 10:58:04 PST 2022


Author: Sanjay Patel
Date: 2022-11-21T13:57:55-05:00
New Revision: 8f337f8ffe36fe85b2015f4765c4f0f9a59d46d1

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

LOG: [VectorCombine] generalize pass param name for early combines; NFC

The option was added with https://reviews.llvm.org/D102496,
and currently the name is accurate, but I am hoping to add
a load transform that is not a scalarization. See issue #17113.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
    llvm/lib/Passes/PassBuilderPipelines.cpp
    llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h b/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
index a32f9fba967f..935f739b7667 100644
--- a/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
+++ b/llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
@@ -21,13 +21,13 @@ namespace llvm {
 
 /// Optimize scalar/vector interactions in IR using target cost models.
 class VectorCombinePass : public PassInfoMixin<VectorCombinePass> {
-  /// If true only perform scalarization combines and do not introduce new
+  /// If true, only perform beneficial early IR transforms. Do not introduce new
   /// vector operations.
-  bool ScalarizationOnly;
+  bool TryEarlyFoldsOnly;
 
 public:
-  VectorCombinePass(bool ScalarizationOnly = false)
-      : ScalarizationOnly(ScalarizationOnly) {}
+  VectorCombinePass(bool TryEarlyFoldsOnly = false)
+      : TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };

diff  --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index d4e73bd8bfb3..21836817405f 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -618,7 +618,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
   // The matrix extension can introduce large vector operations early, which can
   // benefit from running vector-combine early on.
   if (EnableMatrix)
-    FPM.addPass(VectorCombinePass(/*ScalarizationOnly=*/true));
+    FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
 
   // Eliminate redundancies.
   FPM.addPass(MergedLoadStoreMotionPass());

diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index a43d205c34d1..7bd9ee90b9e8 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -65,9 +65,9 @@ class VectorCombine {
 public:
   VectorCombine(Function &F, const TargetTransformInfo &TTI,
                 const DominatorTree &DT, AAResults &AA, AssumptionCache &AC,
-                bool ScalarizationOnly)
+                bool TryEarlyFoldsOnly)
       : F(F), Builder(F.getContext()), TTI(TTI), DT(DT), AA(AA), AC(AC),
-        ScalarizationOnly(ScalarizationOnly) {}
+        TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
 
   bool run();
 
@@ -79,9 +79,9 @@ class VectorCombine {
   AAResults &AA;
   AssumptionCache &AC;
 
-  /// If true only perform scalarization combines and do not introduce new
+  /// If true, only perform beneficial early IR transforms. Do not introduce new
   /// vector operations.
-  bool ScalarizationOnly;
+  bool TryEarlyFoldsOnly;
 
   InstructionWorklist Worklist;
 
@@ -1698,7 +1698,7 @@ bool VectorCombine::run() {
   bool MadeChange = false;
   auto FoldInst = [this, &MadeChange](Instruction &I) {
     Builder.SetInsertPoint(&I);
-    if (!ScalarizationOnly) {
+    if (!TryEarlyFoldsOnly) {
       if (isa<FixedVectorType>(I.getType())) {
         MadeChange |= vectorizeLoadInsert(I);
         MadeChange |= widenSubvectorLoad(I);
@@ -1800,7 +1800,7 @@ PreservedAnalyses VectorCombinePass::run(Function &F,
   TargetTransformInfo &TTI = FAM.getResult<TargetIRAnalysis>(F);
   DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(F);
   AAResults &AA = FAM.getResult<AAManager>(F);
-  VectorCombine Combiner(F, TTI, DT, AA, AC, ScalarizationOnly);
+  VectorCombine Combiner(F, TTI, DT, AA, AC, TryEarlyFoldsOnly);
   if (!Combiner.run())
     return PreservedAnalyses::all();
   PreservedAnalyses PA;


        


More information about the llvm-commits mailing list