[clang] 9e6670b - [Driver] Only pass LTO remark arguments if the driver asks for it
Francis Visoiu Mistrih via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 7 14:12:10 PDT 2020
Author: Francis Visoiu Mistrih
Date: 2020-04-07T14:11:47-07:00
New Revision: 9e6670b03ceaa5980eccb06e2dd037e6a9584c66
URL: https://github.com/llvm/llvm-project/commit/9e6670b03ceaa5980eccb06e2dd037e6a9584c66
DIFF: https://github.com/llvm/llvm-project/commit/9e6670b03ceaa5980eccb06e2dd037e6a9584c66.diff
LOG: [Driver] Only pass LTO remark arguments if the driver asks for it
Previous fix missed a check to willEmitRemarks, causing remarks to
always be enabled for LTO.
Added:
Modified:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/darwin-opt-record-ld.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index ab984271555b..a113d05cc579 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -533,7 +533,8 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// we follow suite for ease of comparison.
AddLinkArgs(C, Args, CmdArgs, Inputs);
- if (checkRemarksOptions(getToolChain().getDriver(), Args,
+ if (willEmitRemarks(Args) &&
+ checkRemarksOptions(getToolChain().getDriver(), Args,
getToolChain().getTriple()))
renderRemarksOptions(Args, CmdArgs, getToolChain().getTriple(), Output, JA);
diff --git a/clang/test/Driver/darwin-opt-record-ld.c b/clang/test/Driver/darwin-opt-record-ld.c
index 0e1e312c493d..83630ed01da8 100644
--- a/clang/test/Driver/darwin-opt-record-ld.c
+++ b/clang/test/Driver/darwin-opt-record-ld.c
@@ -2,6 +2,10 @@
// RUN: touch %t.o
//
+// Check that we're not passing -lto-pass-remarks-output if not requested
+// RUN: %clang -target x86_64-apple-darwin12 %t.o -### -o foo/bar.out 2> %t.log
+// RUN: FileCheck -check-prefix=NO_PASS_REMARKS_OUTPUT %s < %t.log
+// NO_PASS_REMARKS_OUTPUT-NOT: -lto-pass-remarks
// Check that we're passing -lto-pass-remarks-output for LTO
// 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
More information about the cfe-commits
mailing list