[PATCH] D81115: [PowerPC] Do not check for non-Darwin in PowerPC target cpu handling

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 3 16:02:35 PDT 2020


hubert.reinterpretcast added a comment.

Calling it the "Darwin factor" gives it a certain je ne sais quoi. :)



================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:298
+    // each architecture. (except on AIX)
     if (TargetCPUName.empty()) {
       if (T.isOSAIX())
----------------
I think we can reduce the nesting while keeping the NRVO and reorder the checks to prefer the more likely (for non-AIX) case of `ppc64le`:
```
if (!TargetCPUName.empty())
  return TargetCPUName;

if (T.isOSAIX())
  TargetCPUName = "pwr4";
else if (T.getArch() == llvm::Triple::ppc64le)
  TargetCPUName = "ppc64le";
else if (T.getArch() == llvm::Triple::ppc64)
  TargetCPUName = "ppc64";
else
  TargetCPUName = "ppc";

return TargetCPUName;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81115





More information about the cfe-commits mailing list