[PATCH] D27332: With LTO and profile-use, enable hotness info in opt remarks
Adam Nemet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 2 10:04:45 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL288520: With LTO and profile-use, enable hotness info in opt remarks (authored by anemet).
Changed prior to commit:
https://reviews.llvm.org/D27332?vs=80026&id=80088#toc
Repository:
rL LLVM
https://reviews.llvm.org/D27332
Files:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/darwin-ld.c
Index: cfe/trunk/test/Driver/darwin-ld.c
===================================================================
--- cfe/trunk/test/Driver/darwin-ld.c
+++ cfe/trunk/test/Driver/darwin-ld.c
@@ -332,7 +332,12 @@
// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -### -o foo/bar.out 2> %t.log
// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT %s < %t.log
// PASS_REMARKS_OUTPUT: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml"
+// PASS_REMARKS_OUTPUT-NOT: -lto-pass-remarks-with-hotness
// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -### 2> %t.log
// RUN: FileCheck -check-prefix=PASS_REMARKS_OUTPUT_NO_O %s < %t.log
// PASS_REMARKS_OUTPUT_NO_O: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "a.out.opt.yaml"
+
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -fprofile-instr-use=blah -### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_HOTNESS %s < %t.log
+// PASS_REMARKS_WITH_HOTNESS: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-with-hotness"
Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -3644,6 +3644,19 @@
return VersionTuple();
}
+static Arg *getLastProfileUseArg(const ArgList &Args) {
+ auto *ProfileUseArg = Args.getLastArg(
+ options::OPT_fprofile_instr_use, options::OPT_fprofile_instr_use_EQ,
+ options::OPT_fprofile_use, options::OPT_fprofile_use_EQ,
+ options::OPT_fno_profile_instr_use);
+
+ if (ProfileUseArg &&
+ ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use))
+ ProfileUseArg = nullptr;
+
+ return ProfileUseArg;
+}
+
static void addPGOAndCoverageFlags(Compilation &C, const Driver &D,
const InputInfo &Output, const ArgList &Args,
ArgStringList &CmdArgs) {
@@ -3668,13 +3681,7 @@
D.Diag(diag::err_drv_argument_not_allowed_with)
<< PGOGenerateArg->getSpelling() << ProfileGenerateArg->getSpelling();
- auto *ProfileUseArg = Args.getLastArg(
- options::OPT_fprofile_instr_use, options::OPT_fprofile_instr_use_EQ,
- options::OPT_fprofile_use, options::OPT_fprofile_use_EQ,
- options::OPT_fno_profile_instr_use);
- if (ProfileUseArg &&
- ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use))
- ProfileUseArg = nullptr;
+ auto *ProfileUseArg = getLastProfileUseArg(Args);
if (PGOGenerateArg && ProfileUseArg)
D.Diag(diag::err_drv_argument_not_allowed_with)
@@ -8436,6 +8443,11 @@
F = Output.getFilename();
F += ".opt.yaml";
CmdArgs.push_back(Args.MakeArgString(F));
+
+ if (getLastProfileUseArg(Args)) {
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("-lto-pass-remarks-with-hotness");
+ }
}
// It seems that the 'e' option is completely ignored for dynamic executables
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27332.80088.patch
Type: text/x-patch
Size: 3050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161202/61876056/attachment.bin>
More information about the cfe-commits
mailing list