[all-commits] [llvm/llvm-project] c53d80: [IR] Allow destruction of symbol table entries reg...

Yevgeny Rouban via All-commits all-commits at lists.llvm.org
Thu Mar 30 21:45:14 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c53d807321f680f81c0599e4395be480dec1ee3e
  Author: Yevgeny Rouban <yrouban at azul.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    M llvm/lib/IR/Value.cpp
    M llvm/unittests/IR/BasicBlockTest.cpp

  Log Message:
  [IR] Allow destruction of symbol table entries regardless of DiscardValueNames

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

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

Reviewed By: efriedma

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

More information about the All-commits mailing list