[llvm-branch-commits] [llvm] [DA] Add test for the Exact SIV test misses dependency (NFC) (PR #186389)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 13 07:08:12 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Ryotaro Kasuga (kasuga-fj)

<details>
<summary>Changes</summary>

The previous PR #<!-- -->186388 increases the number of situations in which the Exact SIV test is invoked. As a result, new corner cases have emerged. Before that PR, if the BTC is negative, the Exact SIV could never have been called, but it now can. This patch adds a test case that exposes this edge case.

---
Full diff: https://github.com/llvm/llvm-project/pull/186389.diff


1 Files Affected:

- (added) llvm/test/Analysis/DependenceAnalysis/exact-siv-large-btc.ll (+53) 


``````````diff
diff --git a/llvm/test/Analysis/DependenceAnalysis/exact-siv-large-btc.ll b/llvm/test/Analysis/DependenceAnalysis/exact-siv-large-btc.ll
new file mode 100644
index 0000000000000..aa15d474f5e60
--- /dev/null
+++ b/llvm/test/Analysis/DependenceAnalysis/exact-siv-large-btc.ll
@@ -0,0 +1,53 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -disable-output "-passes=print<da>" 2>&1 \
+; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-ALL
+; RUN: opt < %s -disable-output "-passes=print<da>" -da-enable-dependence-test=exact-siv 2>&1 \
+; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-EXACT-SIV
+
+
+; for (i = 0; i < (1 << 63) + 10; i++) {
+;   if (i < 4) {
+;     A[i - 20] = 0;
+;     A[i - 19] = 1;
+;   }
+; }
+;
+; FIXME: There is a dependency between the two stores.
+;
+define void @exact_siv_large_btc(ptr %A) {
+; CHECK-LABEL: 'exact_siv_large_btc'
+; CHECK-NEXT:  Src: store i8 0, ptr %gep.0, align 1 --> Dst: store i8 0, ptr %gep.0, align 1
+; CHECK-NEXT:    da analyze - none!
+; CHECK-NEXT:  Src: store i8 0, ptr %gep.0, align 1 --> Dst: store i8 1, ptr %gep.1, align 1
+; CHECK-NEXT:    da analyze - none!
+; CHECK-NEXT:  Src: store i8 1, ptr %gep.1, align 1 --> Dst: store i8 1, ptr %gep.1, align 1
+; CHECK-NEXT:    da analyze - none!
+;
+entry:
+  br label %loop.header
+
+loop.header:
+  %i = phi i64 [ 0, %entry ], [ %i.inc, %loop.latch ]
+  %cond = icmp sle i64 %i, 4
+  br i1 %cond, label %if.then, label %loop.latch
+
+if.then:
+  %offset.0 = sub i64 %i, 20
+  %offset.1 = sub i64 %i, 19
+  %gep.0 = getelementptr i8, ptr %A, i64 %offset.0
+  %gep.1 = getelementptr i8, ptr %A, i64 %offset.1
+  store i8 0, ptr %gep.0
+  store i8 1, ptr %gep.1
+  br label %loop.latch
+
+loop.latch:
+  %i.inc = add i64 %i, 1
+  %ec = icmp eq i64 %i.inc, 9223372036854775818
+  br i1 %ec, label %exit, label %loop.header
+
+exit:
+  ret void
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK-ALL: {{.*}}
+; CHECK-EXACT-SIV: {{.*}}

``````````

</details>


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


More information about the llvm-branch-commits mailing list