[llvm-branch-commits] [llvm] [SCEV] Prove monotonic predicates from loop entry in isKnownViaInduction (PR #231697)

Dmitry Makogon via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 20 10:54:32 PDT 2026


================
@@ -611,9 +608,59 @@ loop:
   %iv.inc = add i32 %iv, 1
   %iv.2.inc = add i32 %iv.2, 1
   %iv.cmp = icmp slt i32 %iv, %len.add.5
+  br i1 %iv.cmp, label %be, label %leave
+
+be:
+  call void @side_effect()
+  %be.cond = icmp slt i32 %iv.2, %len
+  br i1 %be.cond, label %loop, label %leave
+
+leave:
+  ret void
+}
+
+; %iv + 1 s< %len.add.5 follows from %iv.2 s< %len, since %len s< INT_MIN - (-5)
+; from the entry condition. Unlike @func_17, the loop can iterate.
+define void @func_17_iterating(ptr %len.ptr) {
----------------
d-makogon wrote:

The current policy in llvm is to post the tests in the same PR. You can see the changes to tests when viewing  diffs of particular commit.

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


More information about the llvm-branch-commits mailing list