[llvm] 098e48a - [PassManager] restore early-cse to vector cleanup

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 07:05:04 PDT 2020


Author: Sanjay Patel
Date: 2020-06-14T10:04:53-04:00
New Revision: 098e48a6a1555549eed38b9dd1bb5aa0355560ae

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

LOG: [PassManager] restore early-cse to vector cleanup

As noted in D80236 - the early-cse pass was included here before:
D75145 / rG71a316883d50
But it got moved outside of the "extra" option there, then it
got dropped while adjusting -vector-combine:
rG6438ea45e053
rG57bb4787d72f

So this is restoring the behavior and adding a test to prevent
accidental changes again. I don't see an equivalent option for
the new pass manager.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
    llvm/test/Other/opt-pipeline-vector-passes.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index fcdefcce510a..9534fb874107 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -759,6 +759,7 @@ void PassManagerBuilder::populateModulePassManager(
     // common computations, hoist loop-invariant aspects out of any outer loop,
     // and unswitch the runtime checks if possible. Once hoisted, we may have
     // dead (or speculatable) control flows or more combining opportunities.
+    MPM.add(createEarlyCSEPass());
     MPM.add(createCorrelatedValuePropagationPass());
     MPM.add(createInstructionCombiningPass());
     MPM.add(createLICMPass(LicmMssaOptCap, LicmMssaNoAccForPromotionCap));

diff  --git a/llvm/test/Other/opt-pipeline-vector-passes.ll b/llvm/test/Other/opt-pipeline-vector-passes.ll
index ae4620950e44..c9966d43e491 100644
--- a/llvm/test/Other/opt-pipeline-vector-passes.ll
+++ b/llvm/test/Other/opt-pipeline-vector-passes.ll
@@ -1,7 +1,8 @@
-; RUN: opt -O1                    -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O1
-; RUN: opt -O2                    -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2
-; RUN: opt -O1 -vectorize-loops=0 -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O1_FORCE_OFF
-; RUN: opt -O2 -vectorize-loops=0 -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2_FORCE_OFF
+; RUN: opt -O1                          -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O1
+; RUN: opt -O2                          -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2
+; RUN: opt -O2 -extra-vectorizer-passes -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2_EXTRA
+; RUN: opt -O1 -vectorize-loops=0       -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O1_FORCE_OFF
+; RUN: opt -O2 -vectorize-loops=0       -debug-pass=Structure  < %s -o /dev/null 2>&1 | FileCheck %s --check-prefixes=OLDPM_O2_FORCE_OFF
 ; RUN: opt -disable-verify -debug-pass-manager -passes='default<O1>' -S %s 2>&1 | FileCheck %s --check-prefixes=NEWPM_O1
 ; RUN: opt -disable-verify -debug-pass-manager -passes='default<O2>' -S %s 2>&1 | FileCheck %s --check-prefixes=NEWPM_O2
 
@@ -22,6 +23,22 @@
 ; OLDPM_O2:        SLP Vectorizer
 ; OLDPM_O2:        Optimize scalar/vector ops
 
+; Optionally run cleanup passes.
+
+; OLDPM_O2_EXTRA-LABEL:  Pass Arguments:
+; OLDPM_O2_EXTRA:        Loop Vectorization
+; OLDPM_O2_EXTRA:        Early CSE
+; OLDPM_O2_EXTRA:        Value Propagation
+; OLDPM_O2_EXTRA:        Combine redundant instructions
+; OLDPM_O2_EXTRA:        Loop Invariant Code Motion
+; OLDPM_O2_EXTRA:        Unswitch loops
+; OLDPM_O2_EXTRA:        Simplify the CFG
+; OLDPM_O2_EXTRA:        Combine redundant instructions
+; OLDPM_O2_EXTRA:        SLP Vectorizer
+; OLDPM_O2_EXTRA:        Early CSE
+; OLDPM_O2_EXTRA:        Optimize scalar/vector ops
+
+
 ; The loop vectorizer still runs at both -O1/-O2 even with the
 ; debug flag, but it only works on loops explicitly annotated
 ; with pragmas.


        


More information about the llvm-commits mailing list