By default, use `.opt.yaml`, but when a format is specified with
`-fsave-optimization-record=<format>`, use `.opt.<format>`.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363627
91177308-0d34-0410-b5e6-
96231b3b80d8
If this option is not used, optimization records are output to a file named
after the primary file being compiled. If that's "foo.c", for example,
- optimization records are output to "foo.opt.yaml".
+ optimization records are output to "foo.opt.yaml". If a specific
+ serialization format is specified, the file will be named
+ "foo.opt.<format>".
.. _opt_foptimization-record-passes:
}
}
- llvm::sys::path::replace_extension(F, "opt.yaml");
+ std::string Extension = "opt.";
+ if (const Arg *A =
+ Args.getLastArg(options::OPT_fsave_optimization_record_EQ))
+ Extension += A->getValue();
+ else
+ Extension += "yaml";
+
+ llvm::sys::path::replace_extension(F, Extension);
CmdArgs.push_back(Args.MakeArgString(F));
}
+
if (const Arg *A =
Args.getLastArg(options::OPT_foptimization_record_passes_EQ)) {
CmdArgs.push_back("-opt-record-passes");
SmallString<128> F;
F = Output.getFilename();
- F += ".opt.yaml";
+ F += ".opt.";
+ if (const Arg *A =
+ Args.getLastArg(options::OPT_fsave_optimization_record_EQ))
+ F += A->getValue();
+ else
+ F += "yaml";
+
CmdArgs.push_back(Args.MakeArgString(F));
if (getLastProfileUseArg(Args)) {
//
// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record=some-format -### -o foo/bar.out 2> %t.log
// RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_FORMAT %s < %t.log
-// PASS_REMARKS_WITH_FORMAT: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-format=some-format"
+// PASS_REMARKS_WITH_FORMAT: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "foo/bar.out.opt.some-format" "-mllvm" "-lto-pass-remarks-format=some-format"
// RUN: %clang -target x86_64-apple-ios6.0 -miphoneos-version-min=6.0 -fprofile-instr-generate -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log
// CHECK-FOPT-DISABLE-PASSES-NOT: "-fno-save-optimization-record"
// CHECK-EQ-FORMAT: "-cc1"
+// CHECK-EQ-FORMAT: "-opt-record-file" "FOO.opt.some-format"
// CHECK-EQ-FORMAT: "-opt-record-format" "some-format"
// CHECK-FOPT-DISABLE-FORMAT-NOT: "-fno-save-optimization-record"