[clang] [AMDGPU] Correctly pass the target-id to `ld.lld` (PR #101037)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 09:41:53 PDT 2024


================
@@ -634,7 +634,17 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
                   C.getDriver().getLTOMode() == LTOK_Thin);
   else if (Args.hasArg(options::OPT_mcpu_EQ))
     CmdArgs.push_back(Args.MakeArgString(
-        "-plugin-opt=mcpu=" + Args.getLastArgValue(options::OPT_mcpu_EQ)));
+        "-plugin-opt=mcpu=" +
+        getProcessorFromTargetID(getToolChain().getTriple(),
+                                 Args.getLastArgValue(options::OPT_mcpu_EQ))));
+
+  // Always pass the target-id features to the LTO job.
+  std::vector<StringRef> Features;
+  getAMDGPUTargetFeatures(C.getDriver(), getToolChain().getTriple(), Args,
+                          Features);
+  if (!Features.empty())
----------------
jhuber6 wrote:

I figured this qualifies for the outline in https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

https://github.com/llvm/llvm-project/pull/101037


More information about the cfe-commits mailing list