[clang] [clang][Driver][RISCV] Honor -m[no-]global-merge for RISC-V (PR #79372)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 24 13:56:19 PST 2024
================
@@ -2129,6 +2129,16 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args,
<< A->getSpelling() << Val;
}
}
+
+ // Forward the -mglobal-merge option for explicit control over the pass.
+ if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
+ options::OPT_mno_global_merge)) {
+ CmdArgs.push_back("-mllvm");
----------------
MaskRay wrote:
I know that you are copying arm/aarch64, but for new code for a boolean option (sometimes called flag), we use a convention to only pass a non-default option to cc1.
Since `-riscv-enable-global-merge` defaults to 0, we only pass `-mllvm -riscv-enable-global-merge` to cc1 (remove `=true`).
https://github.com/llvm/llvm-project/pull/79372
More information about the cfe-commits
mailing list