summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-06-29 18:06:10 +0000
committerJessica Paquette <jpaquette@apple.com>2018-06-29 18:06:10 +0000
commit36a25677ae00482d832850b610ac365057fd1656 (patch)
tree2e0ba0429649469e5e21c4b10c5e5e0d596197b0 /clang/lib/Driver
parentcd0d7634f63a2df9acd7280531e9e8acf6213483 (diff)
downloadbcm5719-llvm-36a25677ae00482d832850b610ac365057fd1656.tar.gz
bcm5719-llvm-36a25677ae00482d832850b610ac365057fd1656.zip
[MachineOutliner] Make -mno-outline use -enable-machine-outliner=never
This updates -mno-outline so that it passes -enable-machine-outliner=never instead of nothing. This puts it in sync with the behaviour in llc and other tools. llvm-svn: 336001
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 790fae4a6c8..5999d0b3f95 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4797,23 +4797,30 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_fno_complete_member_pointers, false))
CmdArgs.push_back("-fcomplete-member-pointers");
- if (Args.hasFlag(options::OPT_moutline, options::OPT_mno_outline, false)) {
- // We only support -moutline in AArch64 right now. If we're not compiling
- // for AArch64, emit a warning and ignore the flag. Otherwise, add the
- // proper mllvm flags.
- if (Triple.getArch() != llvm::Triple::aarch64) {
- D.Diag(diag::warn_drv_moutline_unsupported_opt) << Triple.getArchName();
- } else {
- CmdArgs.push_back("-mllvm");
- CmdArgs.push_back("-enable-machine-outliner");
-
- // The outliner shouldn't compete with linkers that dedupe linkonceodr
- // functions in LTO. Enable that behaviour by default when compiling with
- // LTO.
- if (getToolChain().getDriver().isUsingLTO()) {
+ if (Arg *A = Args.getLastArg(options::OPT_moutline,
+ options::OPT_mno_outline)) {
+ if (A->getOption().matches(options::OPT_moutline)) {
+ // We only support -moutline in AArch64 right now. If we're not compiling
+ // for AArch64, emit a warning and ignore the flag. Otherwise, add the
+ // proper mllvm flags.
+ if (Triple.getArch() != llvm::Triple::aarch64) {
+ D.Diag(diag::warn_drv_moutline_unsupported_opt) << Triple.getArchName();
+ } else {
CmdArgs.push_back("-mllvm");
- CmdArgs.push_back("-enable-linkonceodr-outlining");
+ CmdArgs.push_back("-enable-machine-outliner");
+
+ // The outliner shouldn't compete with linkers that dedupe linkonceodr
+ // functions in LTO. Enable that behaviour by default when compiling with
+ // LTO.
+ if (getToolChain().getDriver().isUsingLTO()) {
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("-enable-linkonceodr-outlining");
+ }
}
+ } else {
+ // Disable all outlining behaviour.
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("-enable-machine-outliner=never");
}
}
OpenPOWER on IntegriCloud