diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -595,12 +595,13 @@ Path)); } - // Need this flag to turn on new pass manager via Gold plugin. + // Pass an option to enable/disable the new pass manager. if (Args.hasFlag(options::OPT_fnew_pass_manager, options::OPT_fno_new_pass_manager, - /* Default */ LLVM_ENABLE_NEW_PASS_MANAGER)) { + LLVM_ENABLE_NEW_PASS_MANAGER)) CmdArgs.push_back("-plugin-opt=new-pass-manager"); - } + else + CmdArgs.push_back("-plugin-opt=no-new-pass-manager"); // Setup statistics file output. SmallString<128> StatsFile = getStatsFileName(Args, Output, Input, D); diff --git a/clang/test/Driver/fnew-pass-manager.c b/clang/test/Driver/fnew-pass-manager.c --- a/clang/test/Driver/fnew-pass-manager.c +++ b/clang/test/Driver/fnew-pass-manager.c @@ -19,7 +19,7 @@ // NEW_LINK: "-plugin-opt=new-pass-manager" -/// TODO Add the negative option and pass it to the linker. -// RUN: %clang -### -target x86_64 -flto -fno-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=LEGACY_LINK %s +// RUN: %clang -### -target x86_64-linux -flto -fno-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=LEGACY_LINK %s +// RUN: %clang -### -target x86_64-linux -flto=thin -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=LEGACY_LINK %s -// LEGACY_LINK-NOT: "-plugin-opt=new-pass-manager" +// LEGACY_LINK: "-plugin-opt=no-new-pass-manager"