Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -671,6 +671,10 @@ if (IsThinLTO) CmdArgs.push_back(Args.MakeArgString(Twine(PluginOptPrefix) + "thinlto")); + // Matrix intrinsic lowering happens at link time with thinLTO. + if (IsThinLTO && Args.hasArg(options::OPT_fenable_matrix)) + CmdArgs.push_back(Args.MakeArgString(Twine(PluginOptPrefix) + "-enable-matrix")); + StringRef Parallelism = getLTOParallelism(Args, D); if (!Parallelism.empty()) CmdArgs.push_back( Index: clang/test/Driver/clang_f_opts.c =================================================================== --- clang/test/Driver/clang_f_opts.c +++ clang/test/Driver/clang_f_opts.c @@ -611,3 +611,10 @@ // CHECK-INT-OBJEMITTER-NOT: unsupported option '-fintegrated-objemitter' for target // RUN: %clang -### -fno-integrated-objemitter -target x86_64 %s 2>&1 | FileCheck -check-prefix=CHECK-NOINT-OBJEMITTER %s // CHECK-NOINT-OBJEMITTER: unsupported option '-fno-integrated-objemitter' for target + +// RUN: %clang -flto=thin -fenable-matrix %t.o -### --target=powerpc64-ibm-aix-xcoff 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX-AIX +// CHECK-THINLTO-MATRIX-AIX: -bplugin_opt:-enable-matrix +// RUN: %clang -flto=thin -fenable-matrix %t.o -### --target=x86_64-unknown-linux 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO-MATRIX +// CHECK-THINLTO-MATRIX: -plugin-opt=-enable-matrix