]> granicus.if.org Git - llvm/commitdiff
[opt] Report if the provided architecture is invalid.
authorFlorian Hahn <flo@fhahn.com>
Tue, 5 Mar 2019 23:10:28 +0000 (23:10 +0000)
committerFlorian Hahn <flo@fhahn.com>
Tue, 5 Mar 2019 23:10:28 +0000 (23:10 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355455 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt/opt.cpp

index 69485c72410a5a226bd96ce0d53e86f8cc140474..2d80b47973500fe3f60b56133579a5ffe9f9abf9 100644 (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);