[PATCH] D143550: [IR] Allow destruction of symbol table entries regardless of DiscardValueNames (Deeper Refactoring)

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 21:23:53 PST 2023


yrouban created this revision.
yrouban added reviewers: arsenm, efriedma, jsilvanus, tejohnson.
yrouban added projects: All, LLVM.
yrouban requested review of this revision.

This is a deeper refactoring of D143487 <https://reviews.llvm.org/D143487> that tries avoiding Twine -> StringData conversion.

Value::setNameImpl() is used both to set and reset name of the value.
In destructor of Function all arguments get reset their names (see Function::clearArguments()).
If the arguments had their names set (e.g. when the function was created with LLVMContex::DiscardValueNames == true) then their ValueName entries referred by the function's symbol table must be destructed. They are not destructed if LLVMContex::DiscardValueNames is set to false because of the fast path in Value::setNameImpl(). See the new test cases that demonstrate the problem. Without the fix they both crash in the function's destructor.

In Value::setNameImpl() this patch removes the fast path return for DiscardValueNames == true to allow destruction of ValueName entries.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143550

Files:
  llvm/lib/IR/Value.cpp
  llvm/unittests/IR/BasicBlockTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143550.495719.patch
Type: text/x-patch
Size: 4443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230208/b86916fd/attachment.bin>


More information about the llvm-commits mailing list