[llvm] [Delinearization] Precommit test. NFC. (PR #175173)
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 12 01:23:00 PST 2026
https://github.com/sjoerdmeijer updated https://github.com/llvm/llvm-project/pull/175173
>From ad500aac52403dd7578707fdd8758705bfbf5eb5 Mon Sep 17 00:00:00 2001
From: Sjoerd Meijer <smeijer at nvidia.com>
Date: Fri, 9 Jan 2026 06:12:18 -0800
Subject: [PATCH] [Delinearization] Precommit test. NFC.
This precommits a test for #175158 which should demonstrate that
Delinearization succeeds when we extract loop bounds from the global
variable definition.
---
.../Delinearization/global_array_bounds.ll | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 llvm/test/Analysis/Delinearization/global_array_bounds.ll
diff --git a/llvm/test/Analysis/Delinearization/global_array_bounds.ll b/llvm/test/Analysis/Delinearization/global_array_bounds.ll
new file mode 100644
index 0000000000000..b7708c331fc3e
--- /dev/null
+++ b/llvm/test/Analysis/Delinearization/global_array_bounds.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes='print<delinearization>' -disable-output 2>&1 | FileCheck %s
+
+; Pseudo-code:
+;
+; arr[10][20];
+;
+; for i=0 to N
+; for j=0 to M
+; a[i][j];
+;
+
+ at test_array_10x20 = global [10 x [20 x i32]] zeroinitializer
+
+; Function that accesses a 2D array with dimensions [10][20].
+define void @test_2d_array(i64 %i, i64 %j, i64 %N, i64 %M) {
+; CHECK-LABEL: 'test_2d_array'
+; CHECK-NEXT: Inst: %val = load i32, ptr %gepij, align 4
+; CHECK-NEXT: AccessFunction: {{\{\{}}0,+,80}<%for.i>,+,4}<%for.j>
+; CHECK-NEXT: failed to delinearize
+;
+entry:
+ br label %for.i
+
+for.i:
+ %i.cur = phi i64 [ 0, %entry ], [ %i.next, %for.j.end ]
+ %gepi = getelementptr inbounds nuw [20 x i32], ptr @test_array_10x20, i64 %i.cur
+ %i.cmp = icmp slt i64 %i.cur, %N
+ br i1 %i.cmp, label %for.j, label %exit
+
+for.j:
+ %j.cur = phi i64 [ 0, %for.i ], [ %j.next, %for.j ]
+ %gepij = getelementptr inbounds nuw i32, ptr %gepi, i64 %j.cur
+ %val = load i32, ptr %gepij, align 4
+ %j.next = add i64 %j.cur, 1
+ %j.cmp = icmp slt i64 %j.next, %M
+ br i1 %j.cmp, label %for.j, label %for.j.end
+
+for.j.end:
+ %i.next = add i64 %i.cur, 1
+ br label %for.i
+
+exit:
+ ret void
+}
More information about the llvm-commits
mailing list