[llvm] c2f5e43 - [ELF] Again attempt to fix test on BE architectures

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 09:49:30 PST 2024


Author: Joseph Huber
Date: 2024-01-05T11:49:21-06:00
New Revision: c2f5e435a561cb0ebd3334a1377ebbefe8dcf5c3

URL: https://github.com/llvm/llvm-project/commit/c2f5e435a561cb0ebd3334a1377ebbefe8dcf5c3
DIFF: https://github.com/llvm/llvm-project/commit/c2f5e435a561cb0ebd3334a1377ebbefe8dcf5c3.diff

LOG: [ELF] Again attempt to fix test on BE architectures

Summary:
This formats something according to the style, and again attempts to fix
this failing on the BE PPC test. Sorry for the spam, these commits are
the only way I can check it because the failure isn't local.

Added: 
    

Modified: 
    llvm/include/llvm/Object/ELFObjectFile.h
    llvm/unittests/Object/ELFObjectFileTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index da72b0e335b954..86f42654f8af8d 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -1353,8 +1353,7 @@ template <class ELFT> Triple::ArchType ELFObjectFile<ELFT>::getArch() const {
   case ELF::EM_CUDA: {
     if (EF.getHeader().e_ident[ELF::EI_CLASS] == ELF::ELFCLASS32)
       return Triple::nvptx;
-    else
-      return Triple::nvptx64;
+    return Triple::nvptx64;
   }
 
   case ELF::EM_BPF:

diff  --git a/llvm/unittests/Object/ELFObjectFileTest.cpp b/llvm/unittests/Object/ELFObjectFileTest.cpp
index ccf52ae48e925f..71c08f51f8637f 100644
--- a/llvm/unittests/Object/ELFObjectFileTest.cpp
+++ b/llvm/unittests/Object/ELFObjectFileTest.cpp
@@ -310,7 +310,13 @@ TEST(ELFObjectFileTest, CheckOSAndTriple) {
     ASSERT_THAT_EXPECTED(ELFObjOrErr, Succeeded());
 
     auto &ELFObj = *ELFObjOrErr;
-    EXPECT_EQ(Triple, ELFObj.makeTriple().getTriple());
+    llvm::Triple TheTriple = ELFObj.makeTriple();
+
+    // The AMDGPU architecture will be unknown on big-endian testers.
+    if (TheTriple.getOS() == Triple::UnknownOS)
+      continue;
+
+    EXPECT_EQ(Triple, TheTriple.getTriple());
   }
 }
 


        


More information about the llvm-commits mailing list