[RFC PATCH v1 19/43] helper-to-tcg: Pipeline, run optimization pass

Anton Johansson via posted 43 patches 2 days, 13 hours ago
[RFC PATCH v1 19/43] helper-to-tcg: Pipeline, run optimization pass
Posted by Anton Johansson via 2 days, 13 hours ago
Run a standard LLVM -Os optimization pass, which makes up the bulk of
optimizations in helper-to-tcg.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 subprojects/helper-to-tcg/pipeline/Pipeline.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/subprojects/helper-to-tcg/pipeline/Pipeline.cpp b/subprojects/helper-to-tcg/pipeline/Pipeline.cpp
index dde3641ab3..a26b7a7350 100644
--- a/subprojects/helper-to-tcg/pipeline/Pipeline.cpp
+++ b/subprojects/helper-to-tcg/pipeline/Pipeline.cpp
@@ -188,5 +188,17 @@ int main(int argc, char **argv)
         MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
     }
 
+    //
+    // Run a -Os optimization pass.  In general -Os will prefer loop
+    // vectorization over unrolling, as compared to -O3.  In TCG, this
+    // translates to more utilization of gvec and possibly smaller TBs.
+    //
+
+    // Optimization passes
+    MPM.addPass(PB.buildModuleSimplificationPipeline(
+        compat::OptimizationLevel::Os, compat::LTOPhase));
+    MPM.addPass(
+        PB.buildModuleOptimizationPipeline(compat::OptimizationLevel::Os));
+
     return 0;
 }
-- 
2.45.2