Index: test/Transforms/Util/libcalls-opt-remarks.ll =================================================================== --- test/Transforms/Util/libcalls-opt-remarks.ll +++ test/Transforms/Util/libcalls-opt-remarks.ll @@ -1,8 +1,9 @@ -; RUN: opt < %s -instcombine -o /dev/null -pass-remarks-output=%t -S -pass-remarks=instcombine \ -; RUN: 2>&1 | FileCheck %s +; RUN: opt < %s -instcombine -o /dev/null -pass-remarks-output=%t -S \ +; RUN: -pass-remarks=instcombine 2>&1 | FileCheck %s +; RUN: cat %t | FileCheck -check-prefix=YAML %s +; RUN: opt < %s -passes='require,instcombine' -o /dev/null \ +; RUN: -pass-remarks-output=%t -S -pass-remarks=instcombine 2>&1 | FileCheck %s ; RUN: cat %t | FileCheck -check-prefix=YAML %s -; RUN: opt < %s -passes='require,instcombine' -o /dev/null -S -pass-remarks=instcombine \ -; RUN: 2>&1 | FileCheck %s ; CHECK: remark: libcalls-opt-remarks.c:10:10: folded strlen(select) to select of constants{{$}} ; CHECK-NOT: remark: Index: tools/opt/NewPMDriver.h =================================================================== --- tools/opt/NewPMDriver.h +++ tools/opt/NewPMDriver.h @@ -53,8 +53,8 @@ /// nullptr. bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, tool_output_file *Out, tool_output_file *ThinLinkOut, - StringRef PassPipeline, opt_tool::OutputKind OK, - opt_tool::VerifierKind VK, + tool_output_file *YamlFile, StringRef PassPipeline, + opt_tool::OutputKind OK, opt_tool::VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder, bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex, bool EmitModuleHash); Index: tools/opt/NewPMDriver.cpp =================================================================== --- tools/opt/NewPMDriver.cpp +++ tools/opt/NewPMDriver.cpp @@ -170,8 +170,8 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, tool_output_file *Out, tool_output_file *ThinLTOLinkOut, - StringRef PassPipeline, OutputKind OK, - VerifierKind VK, + tool_output_file *YamlFile, StringRef PassPipeline, + OutputKind OK, VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder, bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex, bool EmitModuleHash) { @@ -266,5 +266,9 @@ if (OK == OK_OutputThinLTOBitcode && ThinLTOLinkOut) ThinLTOLinkOut->keep(); } + + if (YamlFile) + YamlFile->keep(); + return true; } Index: tools/opt/opt.cpp =================================================================== --- tools/opt/opt.cpp +++ tools/opt/opt.cpp @@ -540,7 +540,8 @@ // string. Hand off the rest of the functionality to the new code for that // layer. return runPassPipeline(argv[0], *M, TM.get(), Out.get(), ThinLinkOut.get(), - PassPipeline, OK, VK, PreserveAssemblyUseListOrder, + YamlFile.get(), PassPipeline, OK, VK, + PreserveAssemblyUseListOrder, PreserveBitcodeUseListOrder, EmitSummaryIndex, EmitModuleHash) ? 0