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

This commit is contained in:
Ruoyu Qiu 2026-04-07 00:02:56 +08:00 committed by GitHub
parent 8d7823ea8f
commit 06e666a8f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: {{.*}}