[all-commits] [llvm/llvm-project] 51a3bd: IR: Remove reference counts from ConstantData (#13...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Tue May 6 08:24:21 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 51a3bd919d68a8fb1b026377d6e86b1523d37433
      https://github.com/llvm/llvm-project/commit/51a3bd919d68a8fb1b026377d6e86b1523d37433
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2025-05-06 (Tue, 06 May 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/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/IR/AsmWriter.cpp
    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 (#137314)

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