[llvm] [Matrix] Add tests identifying GVN and DSE opportunities for matrix store / load intrinsics (PR #163573)

Nathan Corbyn via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 02:37:55 PDT 2025


================
@@ -0,0 +1,198 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -passes=dse -S %s | FileCheck %s
+
+define void @live_non_matrix_store(ptr noalias %src, ptr noalias %dst) {
+; CHECK-LABEL: define void @live_non_matrix_store(
+; CHECK-SAME: ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[DST_OFFSET:%.*]] = getelementptr inbounds double, ptr [[SRC]], i32 12
+; CHECK-NEXT:    store double 4.200000e+01, ptr [[DST]], align 8
+; CHECK-NEXT:    [[L:%.*]] = call <8 x double> @llvm.matrix.column.major.load.v8f64.i32(ptr [[SRC]], i32 4, i1 false, i32 4, i32 2)
+; CHECK-NEXT:    call void @llvm.matrix.column.major.store.v8f64.i32(<8 x double> [[L]], ptr [[DST]], i32 4, i1 false, i32 4, i32 2)
+; CHECK-NEXT:    ret void
+;
+entry:
+  %dst.offset = getelementptr inbounds double, ptr %src, i32 12
+  store double 42.0, ptr %dst
----------------
cofibrant wrote:

Sorry, I had meant to use the `%dst.offset` to make the store live.

https://github.com/llvm/llvm-project/pull/163573


More information about the llvm-commits mailing list