[llvm] 06e666a - [DA] Add overflow test for BanerjeeMIVtest (#190468)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:03:01 PDT 2026


Author: Ruoyu Qiu
Date: 2026-04-06T16:02:56Z
New Revision: 06e666a8f6c1a6555650cdbe641e0bbd5d0a00f0

URL: https://github.com/llvm/llvm-project/commit/06e666a8f6c1a6555650cdbe641e0bbd5d0a00f0
DIFF: https://github.com/llvm/llvm-project/commit/06e666a8f6c1a6555650cdbe641e0bbd5d0a00f0.diff

LOG: [DA] Add overflow test for BanerjeeMIVtest (#190468)

Added: 
    llvm/test/Analysis/DependenceAnalysis/banerjee-overflow.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/DependenceAnalysis/banerjee-overflow.ll b/llvm/test/Analysis/DependenceAnalysis/banerjee-overflow.ll
new file mode 100644
index 0000000000000..21562f8177723
--- /dev/null
+++ b/llvm/test/Analysis/DependenceAnalysis/banerjee-overflow.ll
@@ -0,0 +1,75 @@
+; 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=banerjee-miv 2>&1 \
+; RUN:     | FileCheck %s --check-prefixes=CHECK,CHECK-BANERJEE-MIV
+
+;
+; for (int i = 0; i < 2; i++)
+;   for (int j = 0; j < 4611686018427387906; j++) {
+;     A[i - j + 9223372036854775805] = 0;
+;     A[i + j - 5] = 1;
+;   }
+;
+; FIXME: DependenceAnalysis fails to detect dependency between two stores.
+;
+; memory accesses                     | (i,j) == (0,4611686018427387905)
+; ------------------------------------|----------------------------------
+; A[i - j + 9223372036854775805]      | A[4611686018427387900]
+; A[i + j - 5]                        | A[4611686018427387900]
+;
+define void @banerjee_delta_ovfl(ptr %A) {
+; CHECK-LABEL: 'banerjee_delta_ovfl'
+; CHECK-NEXT:  Src: store i8 0, ptr %arrayidx1, align 8 --> Dst: store i8 0, ptr %arrayidx1, align 8
+; CHECK-NEXT:    da analyze - output [* *]!
+; CHECK-NEXT:  Src: store i8 0, ptr %arrayidx1, align 8 --> Dst: store i8 0, ptr %arrayidx2, align 8
+; CHECK-NEXT:    da analyze - none!
+; CHECK-NEXT:  Src: store i8 0, ptr %arrayidx2, align 8 --> Dst: store i8 0, ptr %arrayidx2, align 8
+; CHECK-NEXT:    da analyze - output [* *]!
+;
+entry:
+  br label %for.cond.i
+
+for.cond.i:
+  %i = phi i64 [ 0, %entry ], [ %inc.i, %for.inc.i ]
+  %cmp.i = icmp slt i64 %i, 2
+  br i1 %cmp.i, label %for.body.i, label %for.end.i
+
+for.body.i:
+  br label %for.cond.j
+
+for.cond.j:
+  %j = phi i64 [ 0, %for.body.i ], [ %inc.j, %for.inc.j ]
+  %cmp.j = icmp slt i64 %j, 4611686018427387906
+  br i1 %cmp.j, label %for.body.j, label %for.end.j
+
+for.body.j:
+  %sub = sub i64 %i, %j
+  %add1 = add i64 %sub, 9223372036854775805
+  %arrayidx1 = getelementptr i8, ptr %A, i64 %add1
+  store i8 0, ptr %arrayidx1, align 8
+
+  %add2 = add i64 %i, %j
+  %sub2 = sub i64 %add2, 5
+  %arrayidx2 = getelementptr i8, ptr %A, i64 %sub2
+  store i8 0, ptr %arrayidx2, align 8
+
+  br label %for.inc.j
+
+for.inc.j:
+  %inc.j = add i64 %j, 1
+  br label %for.cond.j
+
+for.end.j:
+  br label %for.inc.i
+
+for.inc.i:
+  %inc.i = add i64 %i, 1
+  br label %for.cond.i
+
+for.end.i:
+  ret void
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK-ALL: {{.*}}
+; CHECK-BANERJEE-MIV: {{.*}}


        


More information about the llvm-commits mailing list