[Mlir-commits] [mlir] 406800c - [mlir] Fixed memory leak after D141726.

Slava Zakharin llvmlistbot at llvm.org
Tue Jan 17 21:35:22 PST 2023


Author: Slava Zakharin
Date: 2023-01-17T21:34:46-08:00
New Revision: 406800cbfee304fe3f46d38299fa706db1b2df15

URL: https://github.com/llvm/llvm-project/commit/406800cbfee304fe3f46d38299fa706db1b2df15
DIFF: https://github.com/llvm/llvm-project/commit/406800cbfee304fe3f46d38299fa706db1b2df15.diff

LOG: [mlir] Fixed memory leak after D141726.

Reported in https://lab.llvm.org/buildbot/#/builders/5/builds/30788

Differential Revision: https://reviews.llvm.org/D141985

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 87eba6e89fdb5..f06991717445d 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -1285,7 +1285,12 @@ LogicalResult ModuleTranslation::createTBAAMetadata() {
                            << refName << "'";
           return failure();
         }
+        auto *tempMD = cast<llvm::MDNode>(descNode->getOperand(opNum).get());
         descNode->replaceOperandWith(opNum, refNode);
+        // Deallocate temporary MDNode's explicitly.
+        // Note that each temporary node has a single use by creation,
+        // so it is valid to deallocate it here.
+        llvm::MDNode::deleteTemporary(tempMD);
       }
     }
   }


        


More information about the Mlir-commits mailing list