Skip to content

Commit 35d6ee6

Browse files
authored
llvm-mca: Error on MCSubtargetInfo construction failure (#159215)
Replace assert with a handled error. The same should probably be done for all of the MC constructors.
1 parent 6b07b05 commit 35d6ee6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/tools/llvm-mca/llvm-mca.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ int main(int argc, char **argv) {
413413

414414
std::unique_ptr<MCSubtargetInfo> STI(
415415
TheTarget->createMCSubtargetInfo(TheTriple, MCPU, FeaturesStr));
416-
assert(STI && "Unable to create subtarget info!");
416+
if (!STI) {
417+
WithColor::error() << "unable to create subtarget info\n";
418+
return 1;
419+
}
420+
417421
if (!STI->isCPUStringValid(MCPU))
418422
return 1;
419423

0 commit comments

Comments
 (0)