diff options
Diffstat (limited to 'flang')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 16 | ||||
-rw-r--r-- | flang/test/Driver/prefer-vector-width.f90 | 2 |
2 files changed, 4 insertions, 14 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 89aaee9..fb9d0ad 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -23,6 +23,7 @@ #include "clang/Basic/AllDiagnostics.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" +#include "clang/Driver/CommonArgs.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/OptionUtils.h" @@ -309,19 +310,8 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts, for (auto *a : args.filtered(clang::driver::options::OPT_fpass_plugin_EQ)) opts.LLVMPassPlugins.push_back(a->getValue()); - // -mprefer_vector_width option - if (const llvm::opt::Arg *a = args.getLastArg( - clang::driver::options::OPT_mprefer_vector_width_EQ)) { - llvm::StringRef s = a->getValue(); - unsigned width; - if (s == "none") - opts.PreferVectorWidth = "none"; - else if (s.getAsInteger(10, width)) - diags.Report(clang::diag::err_drv_invalid_value) - << a->getAsString(args) << a->getValue(); - else - opts.PreferVectorWidth = s.str(); - } + opts.PreferVectorWidth = + clang::driver::tools::ParseMPreferVectorWidthOption(diags, args); // -fembed-offload-object option for (auto *a : diff --git a/flang/test/Driver/prefer-vector-width.f90 b/flang/test/Driver/prefer-vector-width.f90 index 3622b28..89dc6d3 100644 --- a/flang/test/Driver/prefer-vector-width.f90 +++ b/flang/test/Driver/prefer-vector-width.f90 @@ -15,4 +15,4 @@ end subroutine func ! CHECK-NONE-SAME: "prefer-vector-width"="none" ! CHECK-128-SAME: "prefer-vector-width"="128" ! CHECK-256-SAME: "prefer-vector-width"="256" -! CHECK-INVALID: error: invalid value 'xxx' in '-mprefer-vector-width=xxx'
\ No newline at end of file +! CHECK-INVALID: error: invalid value 'xxx' in 'mprefer-vector-width=' |