[test] Speculative fix for bots

Bot has error "Failed to create target from default triple: Unable to
find target for this triple (no targets are registered)", likely because
we only initialized the native target, not the registered target if it's
different.

https://lab.llvm.org/buildbot/#/builders/86/builds/13664
This commit is contained in:
Arthur Eubanks 2021-05-18 09:33:50 -07:00
parent 85f8698eb9
commit 5c291482ec
1 changed files with 3 additions and 2 deletions

View File

@ -15,12 +15,13 @@ using namespace llvm;
class PassBuilderCTest : public testing::Test {
void SetUp() override {
LLVMInitializeNativeTarget();
LLVMInitializeAllTargetInfos();
char *Triple = LLVMGetDefaultTargetTriple();
char *Err;
LLVMTargetRef Target;
if (LLVMGetTargetFromTriple(Triple, &Target, &Err)) {
FAIL() << "Failed to create target from default triple: " << Err;
FAIL() << "Failed to create target from default triple (" << Triple
<< "): " << Err;
}
TM = LLVMCreateTargetMachine(Target, Triple, "generic", "",
LLVMCodeGenLevelDefault, LLVMRelocDefault,