diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-09-13 02:20:00 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-09-13 02:20:00 +0000 |
commit | 49c4e58b75ecec8dce75dd13c61aaeb30e14b531 (patch) | |
tree | e3f6c7ecea4c744d4f12b1c1fabf4edcf2eace7e /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 51ead00bf81cd92a868bdd1551a06ec5efdb563b (diff) | |
download | llvm-49c4e58b75ecec8dce75dd13c61aaeb30e14b531.zip llvm-49c4e58b75ecec8dce75dd13c61aaeb30e14b531.tar.gz llvm-49c4e58b75ecec8dce75dd13c61aaeb30e14b531.tar.bz2 |
For PR17164: split -fno-lax-vector-conversion into three different
levels:
-- none: no lax vector conversions [new GCC default]
-- integer: only conversions between integer vectors [old GCC default]
-- all: all conversions between same-size vectors [Clang default]
For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)
Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.
llvm-svn: 371805
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 3db0b88..0e29e6d 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2265,7 +2265,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, if (Opts.OpenCL) { Opts.AltiVec = 0; Opts.ZVector = 0; - Opts.LaxVectorConversions = 0; + Opts.setLaxVectorConversions(LangOptions::LaxVectorConversionKind::None); Opts.setDefaultFPContractMode(LangOptions::FPC_On); Opts.NativeHalfType = 1; Opts.NativeHalfArgsAndReturns = 1; @@ -2667,8 +2667,18 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings); Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings, Opts.ConstStrings); - if (Args.hasArg(OPT_fno_lax_vector_conversions)) - Opts.LaxVectorConversions = 0; + if (Arg *A = Args.getLastArg(OPT_flax_vector_conversions_EQ)) { + using LaxKind = LangOptions::LaxVectorConversionKind; + if (auto Kind = llvm::StringSwitch<Optional<LaxKind>>(A->getValue()) + .Case("none", LaxKind::None) + .Case("integer", LaxKind::Integer) + .Case("all", LaxKind::All) + .Default(llvm::None)) + Opts.setLaxVectorConversions(*Kind); + else + Diags.Report(diag::err_drv_invalid_value) + << A->getAsString(Args) << A->getValue(); + } if (Args.hasArg(OPT_fno_threadsafe_statics)) Opts.ThreadsafeStatics = 0; Opts.Exceptions = Args.hasArg(OPT_fexceptions); |