[llvm] [ELF] Correctly set the `nvptx` triple from `makeTriple()` (PR #76970)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 09:31:41 PST 2024


================
@@ -1349,6 +1349,13 @@ template <class ELFT> Triple::ArchType ELFObjectFile<ELFT>::getArch() const {
     return Triple::UnknownArch;
   }
 
+  case ELF::EM_CUDA: {
+    if (EF.getHeader().e_ident[ELF::EI_CLASS] == ELF::ELFCLASS32)
+      return Triple::nvptx;
+    else
+      return Triple::nvptx64;
----------------
dwblaikie wrote:

avoid else-after-return, per the LLVM style guide. 
Instead use:
```
if (...)
  return ...;
return ...;
```


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


More information about the llvm-commits mailing list