[all-commits] [llvm/llvm-project] 96635f: IR: Remove reference counts from ConstantData

Matt Arsenault via All-commits all-commits at lists.llvm.org
Fri Apr 25 04:04:19 PDT 2025


  Branch: refs/heads/users/arsenm/ir/remove-constantdata-reference-counts
  Home:   https://github.com/llvm/llvm-project
  Commit: 96635fca09fa1835e372f175eff83013b03da28e
      https://github.com/llvm/llvm-project/commit/96635fca09fa1835e372f175eff83013b03da28e
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M llvm/docs/ReleaseNotes.md
    M llvm/include/llvm/IR/Constants.h
    M llvm/include/llvm/IR/Use.h
    M llvm/include/llvm/IR/Value.h
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/IR/Value.cpp
    M llvm/unittests/IR/ConstantsTest.cpp

  Log Message:
  -----------
  IR: Remove reference counts from ConstantData

This is a follow up change to eliminating uselists for ConstantData.
In the previous revision, ConstantData had a replacement reference count
instead of a uselist. This reference count was misleading, and not useful
in the same way as it would be for another value. The references may not
have even been in the current module, since these are shared throughout
the LLVMContext.

This doesn't space leak any more than we previously did; nothing was
attempting to garbage collect unused constants.

Previously the use_empty, and hasNUses type of APIs were supported through
the reference count. These now behave as if the uses are always empty.
Ideally it would be illegal to inspect these, but this forces API complexity
into quite a few places. It may be doable to make it illegal to check these
counts, but I would like there to be a targeted fuzzing effort to make sure
every transform properly deals with a constant in every operand position.

All tests pass if I turn the hasNUses* and getNumUses queries into assertions,
only hasOneUse in particular appears to hit in some set of contexts. I've
added unit tests to ensure logical consistency between these cases



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list