[llvm] r332594 - Fix r332592 : X86 tests should use the X86 target, not the native targets.
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Thu May 17 04:31:24 PDT 2018
Author: courbet
Date: Thu May 17 04:31:24 2018
New Revision: 332594
URL: http://llvm.org/viewvc/llvm-project?rev=332594&view=rev
Log:
Fix r332592 : X86 tests should use the X86 target, not the native targets.
Modified:
llvm/trunk/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp
Modified: llvm/trunk/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp?rev=332594&r1=332593&r2=332594&view=diff
==============================================================================
--- llvm/trunk/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp (original)
+++ llvm/trunk/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp Thu May 17 04:31:24 2018
@@ -4,7 +4,6 @@
#include <memory>
#include "X86InstrInfo.h"
-#include "llvm/Support/Host.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "gmock/gmock.h"
@@ -16,17 +15,27 @@ namespace {
class RegisterAliasingTest : public ::testing::Test {
protected:
RegisterAliasingTest() {
- const std::string TT = llvm::sys::getProcessTriple();
+ const std::string TT = "x86_64-unknown-linux";
std::string error;
const llvm::Target *const TheTarget =
llvm::TargetRegistry::lookupTarget(TT, error);
- assert(TheTarget);
+ if (!TheTarget) {
+ llvm::errs() << error << "\n";
+ return;
+ }
MCRegInfo.reset(TheTarget->createMCRegInfo(TT));
}
- static void SetUpTestCase() { llvm::InitializeNativeTarget(); }
+ static void SetUpTestCase() {
+ LLVMInitializeX86TargetInfo();
+ LLVMInitializeX86Target();
+ LLVMInitializeX86TargetMC();
+ }
- const llvm::MCRegisterInfo &getMCRegInfo() { return *MCRegInfo; }
+ const llvm::MCRegisterInfo &getMCRegInfo() {
+ assert(MCRegInfo);
+ return *MCRegInfo;
+ }
private:
std::unique_ptr<const llvm::MCRegisterInfo> MCRegInfo;
More information about the llvm-commits
mailing list