[llvm] [Matrix] Propagate shape information through PHI insts (PR #141681)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 10:00:05 PDT 2025


================
@@ -1136,7 +1137,27 @@ class LowerMatrixIntrinsics {
 
     Changed |= !FusedInsts.empty();
 
-    // Fourth, lower remaining instructions with shape information.
+    // Fourth, pre-process all the PHINode's. The incoming values will be
+    // assigned later in VisitPHI.
+    for (Instruction *Inst : MatrixInsts) {
+      auto *PHI = dyn_cast<PHINode>(Inst);
----------------
fhahn wrote:

We were missing an early continue here if Inst is in FusedInsts, which prevents heap-use-after-free if Inst has been removed before. W/o that, the tests fail with ASan. Should be fixed in https://github.com/llvm/llvm-project/commit/0816bb32ac37b24d2f895f0c0464b7659fffd4fc

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


More information about the llvm-commits mailing list