[Matrix] Also run lowering during -O0.
authorFlorian Hahn <flo@fhahn.com>
Thu, 16 Jul 2020 08:55:34 +0000 (09:55 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 16 Jul 2020 09:51:31 +0000 (10:51 +0100)
Currently the backends cannot lower the matrix intrinsics directly and
rely on the lowering to vector instructions happening in the middle-end.
At the moment, this means the backend crashes when matrix types
extension code is compiled with -O0, e.g.
http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-aarch64-O0-g/7902/

This patch enables also runs the lowering with -O0 in the middle-end as
a temporary solution. Long term, a lightweight version of the lowering
should run in the backend, on demand.

llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

index d73d42c..2481437 100644 (file)
@@ -294,6 +294,13 @@ void PassManagerBuilder::populateFunctionPassManager(
   if (LibraryInfo)
     FPM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo));
 
+  // The backends do not handle matrix intrinsics currently.
+  // Make sure they are also lowered in O0.
+  // FIXME: A lightweight version of the pass should run in the backend
+  //        pipeline on demand.
+  if (EnableMatrix)
+    FPM.add(createLowerMatrixIntrinsicsPass());
+
   if (OptLevel == 0) return;
 
   addInitialAliasAnalysisPasses(FPM);