[llvm] 0816bb3 - [Matrix] Fix heap-use-after-free after 0fa373c77ded203eddb.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 09:57:52 PDT 2025


Author: Florian Hahn
Date: 2025-06-19T17:52:31+01:00
New Revision: 0816bb32ac37b24d2f895f0c0464b7659fffd4fc

URL: https://github.com/llvm/llvm-project/commit/0816bb32ac37b24d2f895f0c0464b7659fffd4fc
DIFF: https://github.com/llvm/llvm-project/commit/0816bb32ac37b24d2f895f0c0464b7659fffd4fc.diff

LOG: [Matrix] Fix heap-use-after-free after 0fa373c77ded203eddb.

We need to skip instructions in FusedInsts, as they may have been
deleted. Fixes a heap-use-after-free after #141681.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index fa9e44617b7c8..ccb68700747b3 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -1140,6 +1140,9 @@ class LowerMatrixIntrinsics {
     // Fourth, pre-process all the PHINode's. The incoming values will be
     // assigned later in VisitPHI.
     for (Instruction *Inst : MatrixInsts) {
+      if (FusedInsts.count(Inst))
+        continue;
+
       auto *PHI = dyn_cast<PHINode>(Inst);
       if (!PHI)
         continue;


        


More information about the llvm-commits mailing list