Index: llvm/trunk/test/Transforms/GVN/opt-remarks.ll =================================================================== --- llvm/trunk/test/Transforms/GVN/opt-remarks.ll +++ llvm/trunk/test/Transforms/GVN/opt-remarks.ll @@ -1,6 +1,9 @@ ; RUN: opt < %s -gvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \ ; RUN: 2>&1 | FileCheck %s ; RUN: cat %t | FileCheck -check-prefix=YAML %s +; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \ +; RUN: 2>&1 | FileCheck %s +; RUN: cat %t | FileCheck -check-prefix=YAML %s ; CHECK: remark: :0:0: load of type i32 eliminated{{$}} ; CHECK-NEXT: remark: :0:0: load of type i32 eliminated{{$}} Index: llvm/trunk/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll =================================================================== --- llvm/trunk/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll +++ llvm/trunk/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll @@ -2,6 +2,10 @@ ; RUN: opt < %s -loop-vectorize -o /dev/null -pass-remarks-output=%t.yaml ; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s +; RUN: opt < %s -passes=loop-vectorize -S -pass-remarks-missed='loop-vectorize' -pass-remarks-analysis='loop-vectorize' 2>&1 | FileCheck %s +; RUN: opt < %s -passes=loop-vectorize -o /dev/null -pass-remarks-output=%t.yaml +; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s + ; C/C++ code for tests ; void test(int *A, int Length) { ; #pragma clang loop vectorize(enable) interleave(enable) Index: llvm/trunk/test/Transforms/NewGVN/opt-remarks.ll =================================================================== --- llvm/trunk/test/Transforms/NewGVN/opt-remarks.ll +++ llvm/trunk/test/Transforms/NewGVN/opt-remarks.ll @@ -2,6 +2,10 @@ ; RUN: opt < %s -newgvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \ ; RUN: 2>&1 | FileCheck %s ; RUN: cat %t | FileCheck -check-prefix=YAML %s +; RUN: opt < %s -passes=newgvn -o /dev/null -pass-remarks-output=%t -S -pass-remarks=gvn \ +; RUN: 2>&1 | FileCheck %s +; RUN: cat %t | FileCheck -check-prefix=YAML %s + ; CHECK: remark: :0:0: load of type i32 eliminated{{$}} ; CHECK-NEXT: remark: :0:0: load of type i32 eliminated{{$}} Index: llvm/trunk/test/Transforms/PGOProfile/memop_size_opt.ll =================================================================== --- llvm/trunk/test/Transforms/PGOProfile/memop_size_opt.ll +++ llvm/trunk/test/Transforms/PGOProfile/memop_size_opt.ll @@ -1,6 +1,10 @@ +; RUN: opt < %s -pgo-memop-opt -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -S | FileCheck %s --check-prefix=MEMOP_OPT ; RUN: opt < %s -passes=pgo-memop-opt -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -S | FileCheck %s --check-prefix=MEMOP_OPT ; RUN: opt < %s -pgo-memop-opt -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -pass-remarks-with-hotness -pass-remarks-output=%t.opt.yaml -S | FileCheck %s --check-prefix=MEMOP_OPT ; RUN: FileCheck %s -input-file=%t.opt.yaml --check-prefix=YAML +; RUN: opt < %s -passes=pgo-memop-opt -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -pass-remarks-with-hotness -pass-remarks-output=%t.opt.yaml -S | FileCheck %s --check-prefix=MEMOP_OPT +; RUN: FileCheck %s -input-file=%t.opt.yaml --check-prefix=YAML + target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" Index: llvm/trunk/test/Transforms/SLPVectorizer/AArch64/getelementptr.ll =================================================================== --- llvm/trunk/test/Transforms/SLPVectorizer/AArch64/getelementptr.ll +++ llvm/trunk/test/Transforms/SLPVectorizer/AArch64/getelementptr.ll @@ -1,5 +1,8 @@ ; RUN: opt -S -slp-vectorizer -slp-threshold=-18 -dce -instcombine -pass-remarks-output=%t < %s | FileCheck %s ; RUN: cat %t | FileCheck -check-prefix=YAML %s +; RUN: opt -S -passes='slp-vectorizer,dce,instcombine' -slp-threshold=-18 -pass-remarks-output=%t < %s | FileCheck %s +; RUN: cat %t | FileCheck -check-prefix=YAML %s + target datalayout = "e-m:e-i32:64-i128:128-n32:64-S128" target triple = "aarch64--linux-gnu" Index: llvm/trunk/test/Transforms/SLPVectorizer/AArch64/horizontal.ll =================================================================== --- llvm/trunk/test/Transforms/SLPVectorizer/AArch64/horizontal.ll +++ llvm/trunk/test/Transforms/SLPVectorizer/AArch64/horizontal.ll @@ -1,5 +1,8 @@ ; RUN: opt -slp-vectorizer -slp-threshold=-6 -S -pass-remarks-output=%t < %s | FileCheck %s ; RUN: cat %t | FileCheck -check-prefix=YAML %s +; RUN: opt -passes=slp-vectorizer -slp-threshold=-6 -S -pass-remarks-output=%t < %s | FileCheck %s +; RUN: cat %t | FileCheck -check-prefix=YAML %s + ; FIXME: The threshold is changed to keep this test case a bit smaller. ; The AArch64 cost model should not give such high costs to select statements. Index: llvm/trunk/test/Transforms/SampleProfile/remarks.ll =================================================================== --- llvm/trunk/test/Transforms/SampleProfile/remarks.ll +++ llvm/trunk/test/Transforms/SampleProfile/remarks.ll @@ -1,6 +1,8 @@ ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml 2>&1 | FileCheck %s -; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefix=YAML < %t.opt.yaml +; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml 2>&1 | FileCheck %s +; RUN: FileCheck %s -check-prefix=YAML < %t.opt.yaml + ; Original test case. ; ; 1 #include Index: llvm/trunk/test/Transforms/Util/libcalls-opt-remarks.ll =================================================================== --- llvm/trunk/test/Transforms/Util/libcalls-opt-remarks.ll +++ llvm/trunk/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: llvm/trunk/tools/opt/NewPMDriver.h =================================================================== --- llvm/trunk/tools/opt/NewPMDriver.h +++ llvm/trunk/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 *OptRemarkFile, StringRef PassPipeline, + opt_tool::OutputKind OK, opt_tool::VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder, bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex, bool EmitModuleHash); Index: llvm/trunk/tools/opt/NewPMDriver.cpp =================================================================== --- llvm/trunk/tools/opt/NewPMDriver.cpp +++ llvm/trunk/tools/opt/NewPMDriver.cpp @@ -170,6 +170,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, tool_output_file *Out, tool_output_file *ThinLTOLinkOut, + tool_output_file *OptRemarkFile, StringRef PassPipeline, OutputKind OK, VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder, @@ -266,5 +267,9 @@ if (OK == OK_OutputThinLTOBitcode && ThinLTOLinkOut) ThinLTOLinkOut->keep(); } + + if (OptRemarkFile) + OptRemarkFile->keep(); + return true; } Index: llvm/trunk/tools/opt/opt.cpp =================================================================== --- llvm/trunk/tools/opt/opt.cpp +++ llvm/trunk/tools/opt/opt.cpp @@ -430,17 +430,17 @@ if (PassRemarksHotnessThreshold) Context.setDiagnosticsHotnessThreshold(PassRemarksHotnessThreshold); - std::unique_ptr YamlFile; + std::unique_ptr OptRemarkFile; if (RemarksFilename != "") { std::error_code EC; - YamlFile = llvm::make_unique(RemarksFilename, EC, - sys::fs::F_None); + OptRemarkFile = llvm::make_unique(RemarksFilename, EC, + sys::fs::F_None); if (EC) { errs() << EC.message() << '\n'; return 1; } Context.setDiagnosticsOutputFile( - llvm::make_unique(YamlFile->os())); + llvm::make_unique(OptRemarkFile->os())); } // Load the input module... @@ -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, + OptRemarkFile.get(), PassPipeline, OK, VK, + PreserveAssemblyUseListOrder, PreserveBitcodeUseListOrder, EmitSummaryIndex, EmitModuleHash) ? 0 @@ -767,8 +768,8 @@ "the compile-twice option\n"; Out->os() << BOS->str(); Out->keep(); - if (YamlFile) - YamlFile->keep(); + if (OptRemarkFile) + OptRemarkFile->keep(); return 1; } Out->os() << BOS->str(); @@ -778,8 +779,8 @@ if (!NoOutput || PrintBreakpoints) Out->keep(); - if (YamlFile) - YamlFile->keep(); + if (OptRemarkFile) + OptRemarkFile->keep(); if (ThinLinkOut) ThinLinkOut->keep();