[llvm] [DA] getBackedgeTakenCount in isKnownLessThan can return CouldNotCompute (PR #162495)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 9 09:33:18 PDT 2025
================
@@ -0,0 +1,25 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
+target triple = "aarch64-unknown-linux-gnu"
+
+; Test for function isKnownLessThan that calculates a back-edge taken count,
+; which can return a CouldNotCompute SCEV.
+
+define void @test(i64 %conv, ptr %a) {
+; CHECK-LABEL: 'test'
+; CHECK-NEXT: Src: %.pre.pre.pre = load i32, ptr %arrayidx12, align 4 --> Dst: %.pre.pre.pre = load i32, ptr %arrayidx12, align 4
+; CHECK-NEXT: da analyze - none!
+;
+entry:
+ %sub = add i64 %conv, 1
+ br label %for.cond
+
+for.cond:
+ %i.0 = phi i64 [ %add26, %for.cond ], [ 0, %entry ]
+ %arrayidx12 = getelementptr i32, ptr %a, i64 %i.0
+ %.pre.pre.pre = load i32, ptr %arrayidx12, align 4
+ %add26 = add nsw i64 %sub, %i.0
+ br label %for.cond
+}
----------------
kasuga-fj wrote:
I think this can be simplified. If you just want to write an infinite loop, some values (`%i.0`, `%conv`, etc.) should not be necessary.
https://github.com/llvm/llvm-project/pull/162495
More information about the llvm-commits
mailing list