[llvm-branch-commits] [clang] [flang] [flang] Add -f[no-]version-loops-for-trip-count and enable it at -O3 (2/2) (PR #231207)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Oct 15 15:46:08 PDT 2026


================
@@ -190,17 +189,17 @@ void Flang::addPreprocessingOptions(const ArgList &Args,
 /// The gfortran compiler automatically enables the option for -O3 or -Ofast.
 ///
 /// @return true if loop-versioning should be enabled, otherwise false.
-static bool shouldLoopVersion(const ArgList &Args) {
+static bool shouldLoopVersion(const ArgList &Args, options::ID PosFlag,
+                              options::ID NegFlag) {
   const Arg *LoopVersioningArg = Args.getLastArg(
-      options::OPT_Ofast, options::OPT_O, options::OPT_O4,
-      options::OPT_floop_versioning, options::OPT_fno_loop_versioning);
+      options::OPT_Ofast, options::OPT_O, options::OPT_O4, PosFlag, NegFlag);
----------------
MattPD wrote:

Confirmed, a trailing `-O0` now disables both versioning passes.

https://github.com/llvm/llvm-project/pull/231207


More information about the llvm-branch-commits mailing list