[PATCH] D158755: Make "-fno-split-machine-functions" a valid flag for all archs.
Han Shen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 24 10:20:19 PDT 2023
shenhan created this revision.
shenhan added a reviewer: MaskRay.
Herald added a subscriber: pengfei.
Herald added a project: All.
shenhan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Previously, when clang reports an error when -fno-split-machine-functions is used for non-X86 archs.
However, in some cases, users may specify flags as "-fsplit-machine-functions -fother-flags -fno-split-machine-functions", the first one is from a global flag set, the last one is used to negate the global flag, we think this is a valid usage mode.
Another cases is when clang is used to invoke multiple workloads, like "-x cuda -fsplit-machine-functions -Xarch_device -fno-split-machine-functions", the latter is used to negate the global -fsplit-machine-functions when invoke workloads for GPU."
This change makes this work.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158755
Files:
clang/lib/Driver/ToolChains/Clang.cpp
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5872,13 +5872,13 @@
if (Arg *A = Args.getLastArg(options::OPT_fsplit_machine_functions,
options::OPT_fno_split_machine_functions)) {
- // This codegen pass is only available on x86-elf targets.
- if (Triple.isX86() && Triple.isOSBinFormatELF()) {
- if (A->getOption().matches(options::OPT_fsplit_machine_functions))
+ if (!A->getOption().matches(options::OPT_fno_split_machine_functions)) {
+ // This codegen pass is only available on x86-elf targets.
+ if (Triple.isX86() && Triple.isOSBinFormatELF())
A->render(Args, CmdArgs);
- } else {
- D.Diag(diag::err_drv_unsupported_opt_for_target)
- << A->getAsString(Args) << TripleStr;
+ else
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << TripleStr;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158755.553181.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230824/e4aab5ef/attachment.bin>
More information about the cfe-commits
mailing list