[PATCH] D133726: [OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TU

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 13 08:10:31 PDT 2022


jhuber6 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/AMDGPU.cpp:717
 AMDGPUToolChain::getGPUArch(const llvm::opt::ArgList &DriverArgs) const {
-  return getProcessorFromTargetID(
-      getTriple(), DriverArgs.getLastArgValue(options::OPT_mcpu_EQ));
+  if (DriverArgs.hasArg(options::OPT_mcpu_EQ))
+    return getProcessorFromTargetID(
----------------
yaxunl wrote:
> can we emit an error if both -march and -mcpu are specified and the values are different? This is a potential source of error.
I'm not exactly sure about the semantics for this, maybe someone else can help. AFAIK `-mcpu` is sometimes treated as an alias of `-mtune` which is generally implied by `-march`. But having `-march` and `-mtune` state different things isn't technically disallowed. `-march` seems to imply that we generate code that can run on a certain architecture. Since these are in some respects equivalent it would probably be fine to just take the last one specified.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133726/new/

https://reviews.llvm.org/D133726



More information about the cfe-commits mailing list