https://github.com/kasuga-fj updated https://github.com/llvm/llvm-project/pull/185578
>From 1b4e416cc508df0917cdc1e0fc80ecc65573b36e Mon Sep 17 00:00:00 2001 From: Ryotaro Kasuga <[email protected]> Date: Mon, 9 Mar 2026 09:04:26 +0000 Subject: [PATCH] [DA] Update tests for the Weak Zero SIV tests (NFC) --- .../weak-zero-siv-addrec-wrap.ll | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 llvm/test/Analysis/DependenceAnalysis/weak-zero-siv-addrec-wrap.ll diff --git a/llvm/test/Analysis/DependenceAnalysis/weak-zero-siv-addrec-wrap.ll b/llvm/test/Analysis/DependenceAnalysis/weak-zero-siv-addrec-wrap.ll new file mode 100644 index 0000000000000..09e910542d68a --- /dev/null +++ b/llvm/test/Analysis/DependenceAnalysis/weak-zero-siv-addrec-wrap.ll @@ -0,0 +1,112 @@ +; 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=weak-zero-siv 2>&1 \ +; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-WEAK-ZERO-SIV +; +; coeff = (1 << 62) - 1; +; // Use `i*i <u n` to make the BTC unpredictable. +; for (i = 0; i*i <u n; i++) { +; A[-4] = 0; +; if (i == 4) +; A[coeff*i] = 1; +; } +; +; When `n` is large enough, there exists a dependency with all directions between the two stores. +; +; memory access | i == 0 | i == 4 | i == 5 +; ---------------|--------|--------|-------- +; A[-4] | A[-4] | A[-4] | A[-4] +; A[(2^62-1)*i] | | A[-4] | +; +; FIXME: DependenceAnalysis currently misses the dependency. +; +define void @weak_zero_src_siv_addrec_wrap(ptr %A, i64 %n) { +; CHECK-LABEL: 'weak_zero_src_siv_addrec_wrap' +; CHECK-NEXT: Src: store i8 0, ptr %gep.0, align 1 --> Dst: store i8 0, ptr %gep.0, align 1 +; CHECK-NEXT: da analyze - output [S]! +; 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 - output [*]! +; +entry: + br label %loop.header + +loop.header: + %i = phi i64 [ 0, %entry ], [ %i.inc, %loop.latch ] + %gep.0 = getelementptr i8, ptr %A, i64 -4 + store i8 0, ptr %gep.0 + %cond = icmp eq i64 %i, 4 + br i1 %cond, label %if.then, label %loop.latch + +if.then: + %offset = mul i64 4611686018427387903, %i + %gep.1 = getelementptr i8, ptr %A, i64 %offset + store i8 1, ptr %gep.1 + br label %loop.latch + +loop.latch: + %i.inc = add nuw nsw i64 %i, 1 + %sq = mul nuw nsw i64 %i.inc, %i.inc + %ec = icmp uge i64 %sq, %n + br i1 %ec, label %exit, label %loop.header + +exit: + ret void +} + +; coeff = (1 << 62) - 1; +; // Use `i*i <u n` to make the BTC unpredictable. +; for (i = 0; i*i <u n; i++) { +; if (i == 4) +; A[coeff*i] = 0; +; A[-4] = 1; +; } +; +; When `n` is large enough, there exists a dependency with all directions between the two stores. +; +; memory access | i == 0 | i == 4 | i == 5 +; ---------------|--------|--------|-------- +; A[(2^62-1)*i] | | A[-4] | +; A[-4] | A[-4] | A[-4] | A[-4] +; +; FIXME: DependenceAnalysis currently misses the dependency. +; +define void @weak_zero_dst_siv_addrec_wrap(ptr %A, i64 %n) { +; CHECK-LABEL: 'weak_zero_dst_siv_addrec_wrap' +; CHECK-NEXT: Src: store i8 0, ptr %gep.0, align 1 --> Dst: store i8 0, ptr %gep.0, align 1 +; CHECK-NEXT: da analyze - output [*]! +; 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 - output [S]! +; +entry: + br label %loop.header + +loop.header: + %i = phi i64 [ 0, %entry ], [ %i.inc, %loop.latch ] + %cond = icmp eq i64 %i, 4 + br i1 %cond, label %if.then, label %loop.latch + +if.then: + %offset = mul i64 4611686018427387903, %i + %gep.0 = getelementptr i8, ptr %A, i64 %offset + store i8 0, ptr %gep.0 + br label %loop.latch + +loop.latch: + %gep.1 = getelementptr i8, ptr %A, i64 -4 + store i8 1, ptr %gep.1 + %i.inc = add nuw nsw i64 %i, 1 + %sq = mul nuw nsw i64 %i.inc, %i.inc + %ec = icmp uge i64 %sq, %n + 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-WEAK-ZERO-SIV: {{.*}} _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
