llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
The previous changes to LTO made the flto flag passed by default which
overrode the hack we did to ervert to the old non-LTO pipline. This is a
temporary hack so I'm hacking it even further to fix it.


---
Full diff: https://github.com/llvm/llvm-project/pull/202699.diff


1 Files Affected:

- (modified) clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp (+6-11) 


``````````diff
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 6e4fc7060389c..cfdd11e1d298d 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -534,16 +534,6 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, 
const ArgList &Args,
     Triple.isAMDGPU() ? CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch))
                       : CmdArgs.push_back(Args.MakeArgString("-march=" + 
Arch));
 
-  // AMDGPU defaults to the LTO pipeline. Non-RDC HIP uses the conventional
-  // non-LTO pipeline so device codegen still runs here, in parallel, instead
-  // of being deferred to the LTO link.
-  // FIXME: This is a stop-gap for non-RDC. Longer term, RDC and non-RDC should
-  // share a unified interface so runtime libraries can be provided to non-RDC
-  // compilations without relying on -mlink-builtin-bitcode.
-  bool NonLTOAMDGPU = Triple.isAMDGPU() && Args.hasArg(OPT_no_lto);
-  if (Triple.isAMDGPU() && !NonLTOAMDGPU)
-    CmdArgs.push_back("-flto");
-
   // Forward all of the `--offload-opt` and `-mllvm` options to the device.
   for (auto &Arg : Args.filtered(OPT_offload_opt_eq_minus, OPT_mllvm))
     CmdArgs.append(
@@ -557,7 +547,9 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, 
const ArgList &Args,
   // Force the IR input language so Clang runs the compile and backend phases
   // instead of treating them as linker inputs, which would defer codegen to
   // the LTO link and defeat the non-LTO pipeline.
-  if (NonLTOAMDGPU)
+  // FIXME: This is a stop-gap for non-RDC. Longer term, RDC and non-RDC should
+  //        share a unified interface.
+  if (Args.hasArg(OPT_no_lto))
     CmdArgs.append({"-x", "ir"});
   for (StringRef InputFile : InputFiles)
     CmdArgs.push_back(InputFile);
@@ -621,6 +613,9 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, 
const ArgList &Args,
   for (StringRef Arg : Args.getAllArgValues(OPT_compiler_arg_EQ))
     CmdArgs.push_back(Args.MakeArgString(Arg));
 
+  if (Args.hasArg(OPT_no_lto))
+    CmdArgs.append({"-flto=none", "-Wno-unused-command-line-argument"});
+
   if (Error Err = executeCommands(*ClangPath, CmdArgs))
     return std::move(Err);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/202699
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to