================ @@ -492,6 +493,18 @@ void Flang::addOffloadOptions(Compilation &C, const InputInfoList &Inputs, if (Args.hasArg(options::OPT_nogpulib)) CmdArgs.push_back("-nogpulib"); } + + // For all the host OpenMP offloading compile jobs we need to pass the targets + // information using -fopenmp-targets= option. + if (JA.isHostOffloading(Action::OFK_OpenMP)) { + SmallString<128> Targets("-fopenmp-targets="); + + SmallVector<std::string, 4> Triples; + auto TCRange = C.getOffloadToolChains<Action::OFK_OpenMP>(); + std::transform(TCRange.first, TCRange.second, std::back_inserter(Triples), + [](auto TC) { return TC.second->getTripleString(); }); + CmdArgs.push_back(Args.MakeArgString(Targets + llvm::join(Triples, ","))); ---------------- Meinersbur wrote:
```suggestion CmdArgs.push_back(Args.MakeArgString(Twine(Targets) + llvm::join(Triples, ","))); ``` To make it work with StringRef (`MakeArgString` takes a `Twine` and uses `SmallString` internally). That is, just do ```suggestion CmdArgs.push_back(Args.MakeArgString(Twine("-fopenmp-targets") + llvm::join(Triples, ","))); ``` https://github.com/llvm/llvm-project/pull/100152 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits