[PATCH] D156618: [IR] Fix a memory leak if Function::dropAllReferences() is followed by setHungoffOperand
Liqiang Tao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 4 06:23:41 PDT 2023
taolq updated this revision to Diff 555716.
taolq retitled this revision from "[IR] Fix a memory leak if Function::dropAllReferences() is followed by setHungoffOperand " to "[IR] Fix a memory leak if Function::dropAllReferences() is followed by setHungoffOperand".
taolq added a comment.
rebase to main
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156618/new/
https://reviews.llvm.org/D156618
Files:
llvm/lib/IR/Function.cpp
Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -539,8 +539,10 @@
// Drop uses of any optional data (real or placeholder).
if (getNumOperands()) {
- User::dropAllReferences();
- setNumHungOffUseOperands(0);
+ auto *CPN = ConstantPointerNull::get(Type::getInt1PtrTy(getContext(), 0));
+ Op<0>().set(CPN);
+ Op<1>().set(CPN);
+ Op<2>().set(CPN);
setValueSubclassData(getSubclassDataFromValue() & ~0xe);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156618.555716.patch
Type: text/x-patch
Size: 552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230904/90e47f63/attachment.bin>
More information about the llvm-commits
mailing list