[llvm] r334601 - [llvm-exegesis] Fix buildbot - power was using native target for X86.

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 07:07:37 PDT 2018


Author: gchatelet
Date: Wed Jun 13 07:07:36 2018
New Revision: 334601

URL: http://llvm.org/viewvc/llvm-project?rev=334601&view=rev
Log:
[llvm-exegesis] Fix buildbot - power was using native target for X86.

Reviewers: courbet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48125

Modified:
    llvm/trunk/tools/llvm-exegesis/lib/LlvmState.cpp
    llvm/trunk/tools/llvm-exegesis/lib/LlvmState.h
    llvm/trunk/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp

Modified: llvm/trunk/tools/llvm-exegesis/lib/LlvmState.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/LlvmState.cpp?rev=334601&r1=334600&r2=334601&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/LlvmState.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/LlvmState.cpp Wed Jun 13 07:07:36 2018
@@ -20,9 +20,8 @@
 
 namespace exegesis {
 
-LLVMState::LLVMState()
-    : TheTriple(llvm::sys::getProcessTriple()),
-      CpuName(llvm::sys::getHostCPUName().str()) {
+LLVMState::LLVMState(const std::string &Triple, const std::string &CpuName)
+    : TheTriple(Triple), CpuName(CpuName) {
   std::string Error;
   TheTarget = llvm::TargetRegistry::lookupTarget(TheTriple, Error);
   assert(TheTarget && "unknown target for host");
@@ -33,6 +32,10 @@ LLVMState::LLVMState()
   AsmInfo.reset(TheTarget->createMCAsmInfo(*RegInfo, TheTriple));
 }
 
+LLVMState::LLVMState()
+    : LLVMState(llvm::sys::getProcessTriple(),
+                llvm::sys::getHostCPUName().str()) {}
+
 std::unique_ptr<llvm::LLVMTargetMachine>
 LLVMState::createTargetMachine() const {
   const llvm::TargetOptions Options;

Modified: llvm/trunk/tools/llvm-exegesis/lib/LlvmState.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/LlvmState.h?rev=334601&r1=334600&r2=334601&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/LlvmState.h (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/LlvmState.h Wed Jun 13 07:07:36 2018
@@ -32,6 +32,9 @@ class LLVMState {
 public:
   LLVMState();
 
+  LLVMState(const std::string &Triple,
+            const std::string &CpuName); // For tests.
+
   llvm::StringRef getTriple() const { return TheTriple; }
   llvm::StringRef getCpuName() const { return CpuName; }
   llvm::StringRef getFeatures() const { return Features; }

Modified: llvm/trunk/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp?rev=334601&r1=334600&r2=334601&view=diff
==============================================================================
--- llvm/trunk/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp (original)
+++ llvm/trunk/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp Wed Jun 13 07:07:36 2018
@@ -23,7 +23,8 @@ namespace {
 class X86SnippetGeneratorTest : public ::testing::Test {
 protected:
   X86SnippetGeneratorTest()
-      : MCInstrInfo(State.getInstrInfo()), MCRegisterInfo(State.getRegInfo()) {}
+      : State("x86_64-unknown-linux", "haswell"),
+        MCInstrInfo(State.getInstrInfo()), MCRegisterInfo(State.getRegInfo()) {}
 
   static void SetUpTestCase() {
     LLVMInitializeX86TargetInfo();




More information about the llvm-commits mailing list