[ConstraintElimination] Tweak placement in pipeline.
authorFlorian Hahn <flo@fhahn.com>
Mon, 7 Dec 2020 18:14:57 +0000 (18:14 +0000)
committerFlorian Hahn <flo@fhahn.com>
Mon, 7 Dec 2020 19:08:40 +0000 (19:08 +0000)
This patch adds the ConstraintElimination pass to the LTO pipeline and
also runs it after SCCP in the function simplification pipeline.

This increases the number of cases we can elimination. Pending further
tuning.

llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

index e03015f..e823a56 100644 (file)
@@ -470,6 +470,9 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
   MPM.add(createMemCpyOptPass());             // Remove memcpy / form memset
   MPM.add(createSCCPPass());                  // Constant prop with SCCP
 
+  if (EnableConstraintElimination)
+    MPM.add(createConstraintEliminationPass());
+
   // Delete dead bit computations (instcombine runs after to fold away the dead
   // computations, and then ADCE will run later to exploit any new DCE
   // opportunities that creates).
@@ -1056,6 +1059,9 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
   if (EnableLoopInterchange)
     PM.add(createLoopInterchangePass());
 
+  if (EnableConstraintElimination)
+    PM.add(createConstraintEliminationPass());
+
   // Unroll small loops
   PM.add(createSimpleLoopUnrollPass(OptLevel, DisableUnrollLoops,
                                     ForgetAllSCEVInLoopUnroll));