Author: paquette Date: Mon Jun 25 16:20:18 2018 New Revision: 335549 URL: http://llvm.org/viewvc/llvm-project?rev=335549&view=rev Log: [MachineOutliner] NFC - simplify -moutline/-mno-outline logic
It's a bit cleaner to use `hasFlag` instead of nested ifs. This just refactors the -moutline/-mno-outline logic to use that. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=335549&r1=335548&r2=335549&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Jun 25 16:20:18 2018 @@ -1477,19 +1477,16 @@ void Clang::AddAArch64TargetArgs(const A CmdArgs.push_back("-aarch64-enable-global-merge=true"); } - if (Arg *A = Args.getLastArg(options::OPT_moutline, - options::OPT_mno_outline)) { - if (A->getOption().matches(options::OPT_moutline)) { - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-enable-machine-outliner"); + if (Args.hasFlag(options::OPT_moutline, options::OPT_mno_outline, false)) { + 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()) { - CmdArgs.push_back("-mllvm"); - CmdArgs.push_back("-enable-linkonceodr-outlining"); - } + // 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"); } } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits