[llvm] r355455 - [opt] Report if the provided architecture is invalid.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 15:10:28 PST 2019
Author: fhahn
Date: Tue Mar 5 15:10:28 2019
New Revision: 355455
URL: http://llvm.org/viewvc/llvm-project?rev=355455&view=rev
Log:
[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
Modified:
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=355455&r1=355454&r2=355455&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Tue Mar 5 15:10:28 2019
@@ -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);
More information about the llvm-commits
mailing list