[opt] Report if the provided architecture is invalid.

Partly addresses PR15026.

There are a few tests that passed in invalid architectures, which are fixed in: rL355349 and D58931

Reviewers: echristo, efriedma, rengolin, atrick

Reviewed By: efriedma

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

llvm-svn: 355455
This commit is contained in:
Florian Hahn 2019-03-05 23:10:28 +00:00
parent 6b439704dd
commit eafd27fedf

View File

@ -639,6 +639,11 @@ int main(int argc, char **argv) {
CPUStr = getCPUStr();
FeaturesStr = getFeaturesStr();
Machine = GetTargetMachine(ModuleTriple, CPUStr, FeaturesStr, Options);
} else if (ModuleTriple.getArchName() != "unknown" &&
ModuleTriple.getArchName() != "") {
errs() << argv[0] << ": unrecognized architecture '"
<< ModuleTriple.getArchName() << "' provided.\n";
return 1;
}
std::unique_ptr<TargetMachine> TM(Machine);