[clang] Pass -offload-lto instead of -lto for cuda/hip kernels (PR #125243)
Omar Ahmed via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 08:15:52 PST 2025
================
@@ -498,12 +498,16 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
};
// Forward all of the `--offload-opt` and similar options to the device.
- CmdArgs.push_back("-flto");
for (auto &Arg : Args.filtered(OPT_offload_opt_eq_minus, OPT_mllvm))
CmdArgs.append(
{"-Xlinker",
Args.MakeArgString("--plugin-opt=" + StringRef(Arg->getValue()))});
+ if (Triple.isNVPTX() || Triple.isAMDGPU())
+ CmdArgs.push_back("-foffload-lto");
+ else
+ CmdArgs.push_back("-flto");
----------------
omarahmed1111 wrote:
It is the fork for intel/llvm
```
> clang --version
clang version 20.0.0git (https://github.com/intel/llvm.git 0b71135afbca78ad5095ff09868e8f966755742a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: build2/bin
Build config: +assertions
```
https://github.com/llvm/llvm-project/pull/125243
More information about the cfe-commits
mailing list