================ @@ -161,6 +161,14 @@ void Flang::addCodegenOptions(const ArgList &Args, options::OPT_fno_vectorize, enableVec)) CmdArgs.push_back("-vectorize-loops"); + // -fslp-vectorize is enabled based on the optimization level selected. + bool EnableSLPVec = shouldEnableVectorizerAtOLevel(Args, true); + OptSpecifier SLPVectAliasOption = + EnableSLPVec ? options::OPT_O_Group : options::OPT_fslp_vectorize; + if (Args.hasFlag(options::OPT_fslp_vectorize, SLPVectAliasOption, + options::OPT_fno_slp_vectorize, EnableSLPVec)) + CmdArgs.push_back("-vectorize-slp"); + ---------------- tarunprabhu wrote:
I think this block and the one above it that adds the `-vectorize-loops` `-fc1` option can be shared between `clang` and `flang`. The corresponding code in clang is [here](https://github.com/llvm/llvm-project/blob/8d3dc1ed5656a3e69e4195d58684a7f4bf0ff5cc/clang/lib/Driver/ToolChains/Clang.cpp#L7600). Such code is typically moved to `clang/lib/Driver/ToolChains/CommonArgs.cpp`. It's probably better to share it rather than duplicate it. See, for example, [this](https://github.com/llvm/llvm-project/pull/109210/files) https://github.com/llvm/llvm-project/pull/132801 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits