[llvm] [LoopFlatten] Add option to version loops instead of widening IVs (PR #166156)
Ehsan Amiri via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 3 12:27:47 PST 2025
================
@@ -102,6 +102,10 @@ static cl::opt<bool>
VersionLoops("loop-flatten-version-loops", cl::Hidden, cl::init(true),
cl::desc("Version loops if flattened loop could overflow"));
+static cl::opt<bool> VersionLoopsOverWiden(
+ "loop-flatten-version-over-widen", cl::Hidden, cl::init(false),
+ cl::desc("Version loops and generate runtime checks over widening the IV"));
+
----------------
amehsan wrote:
Can't we avoid introducing a new option and instead make the existing options achieve what is needed here?Basically when `loop-flatten-widen-iv` is set to `false`, given that the default value of `loop-flatten-version-loops` is `true` we should see the behavior that is expected from the newly introduced option. The advantage is that there are fewer options and they work closer to what you expect from them.
I think most of your changes will remain still the same or very close to what you already have. You just don't need a new option for this.
Extracting `versionLoop` code in a static function is a good idea anyways.
https://github.com/llvm/llvm-project/pull/166156
More information about the llvm-commits
mailing list