[llvm] SCEV/test: cover implied-via-addition (PR #123082)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 09:05:31 PST 2025
================
@@ -0,0 +1,111 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -disable-output -passes="print<scalar-evolution>" \
+; RUN: -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
+
+define void @implied1(i32 %n) {
+; Prove that (n > 1) ===> (n - 1 > 0).
+; CHECK-LABEL: 'implied1'
+; CHECK-NEXT: Determining loop execution counts for: @implied1
+; CHECK-NEXT: Loop %header: backedge-taken count is (-2 + %n)
+; CHECK-NEXT: Loop %header: constant max backedge-taken count is i32 2147483646
+; CHECK-NEXT: Loop %header: symbolic max backedge-taken count is (-2 + %n)
+; CHECK-NEXT: Loop %header: Trip multiple is 1
+;
+entry:
+ %cmp1 = icmp sgt i32 %n, 1
+ %n.minus.1 = sub nsw i32 %n, 1
+ call void(i1, ...) @llvm.experimental.guard(i1 %cmp1) [ "deopt"() ]
----------------
fhahn wrote:
Do we need to use `llvm.experimental.guard` or would `llvm.assume` also work? The latter would be more common in general I think
https://github.com/llvm/llvm-project/pull/123082
More information about the llvm-commits
mailing list