[llvm] [Matrix] Add tests identifying GVN and DSE opportunities for matrix store / load intrinsics (PR #163573)
Jon Roelofs via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 12:02:02 PDT 2025
================
@@ -0,0 +1,82 @@
+; RUN: opt %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+
+; BasicAA should prove that loads from sufficiently large static offsets
+; don't overlap with matrix loads with a statically known size.
+
+define <8 x double> @non_overlapping_strided_load(ptr %src) {
+entry:
+ %src.offset = getelementptr inbounds double, ptr %src, i32 16
+ %l = call <8 x double> @llvm.matrix.column.major.load.v8f64.i32(ptr %src.offset, i32 8, i1 false, i32 4, i32 2)
+ call void @llvm.matrix.column.major.store(<8 x double> %l, ptr %src, i32 8, i1 false, i32 4, i32 2)
+ %l.2 = call <8 x double> @llvm.matrix.column.major.load.v8f64.i32(ptr %src.offset, i32 8, i1 false, i32 4, i32 2)
+ %s = fadd <8 x double> %l, %l.2
+ ret <8 x double> %s
+}
+
----------------
jroelofs wrote:
for DSE, we probably also want tests that cover the interaction between matrix intrinsics and normal loads/stores:
* normal store is dead because the last read was from a matrix intrinsic that happened before the store
* normal store is not dead because the last read by a matrix intrinsic happens after the store
* matrix intrinsic store is dead because the last read was from a normal store that happened before the store
* matrix intrinsic store is not dead because the last read from a normal store happens after the store
https://github.com/llvm/llvm-project/pull/163573
More information about the llvm-commits
mailing list