[mlir] Use the same pipeline tuning options as clang for execution engine
authorDenys Shabalin <shabalin@google.com>
Wed, 2 Nov 2022 13:04:37 +0000 (14:04 +0100)
committerDenys Shabalin <shabalin@google.com>
Wed, 2 Nov 2022 14:07:01 +0000 (15:07 +0100)
This change make sure that ExecutionEngine's pass pipeline is identical to one
used by clang. Previously, SLPVectorization was not enabled which caused
differences in code...

...generation.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D137248

mlir/lib/ExecutionEngine/OptUtils.cpp

index 403e54f..893a8a4 100644 (file)
@@ -68,7 +68,13 @@ mlir::makeOptimizingTransformer(unsigned optLevel, unsigned sizeLevel,
     CGSCCAnalysisManager cgam;
     ModuleAnalysisManager mam;
 
-    PassBuilder pb(targetMachine);
+    PipelineTuningOptions tuningOptions;
+    tuningOptions.LoopUnrolling = true;
+    tuningOptions.LoopInterleaving = true;
+    tuningOptions.LoopVectorization = true;
+    tuningOptions.SLPVectorization = true;
+
+    PassBuilder pb(targetMachine, tuningOptions);
 
     pb.registerModuleAnalyses(mam);
     pb.registerCGSCCAnalyses(cgam);