Skip to content

Commit

Permalink
[NFC][CodeGen] Add comments for SDNode debug ID
Browse files Browse the repository at this point in the history
Normally, we place fields serving for debug purpose declarations
under `#if LLVM_ENABLE_ABI_BREAKING_CHECKS`. For `SDNode::PersistentId` and
`SelectionDAG::NextPersistentId`, we do not want to do so because it adds
unneeded complexity without noticeable benefits (see discussion with @Thakis
in D120714). This patch adds comments describing why we don't place those
fields under `#if` not to confuse anyone more.

Differential Revision: https://reviews.llvm.org/D123238
  • Loading branch information
kovdan01 committed Apr 6, 2022
1 parent 25b7efc commit 28cb908
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions llvm/include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ class SelectionDAG {

DenseMap<const SDNode *, CallSiteDbgInfo> SDCallSiteDbgInfo;

/// PersistentId counter to be used when inserting the next
/// SDNode to this SelectionDAG. We do not place that under
/// `#if LLVM_ENABLE_ABI_BREAKING_CHECKS` intentionally because
/// it adds unneeded complexity without noticeable
/// benefits (see discussion with @thakis in D120714).
uint16_t NextPersistentId = 0;

/// Are instruction referencing variable locations desired for this function?
Expand Down
6 changes: 4 additions & 2 deletions llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,10 @@ END_TWO_BYTE_PACK()
SDNodeFlags Flags;

public:
/// Unique and persistent id per SDNode in the DAG.
/// Used for debug printing.
/// Unique and persistent id per SDNode in the DAG. Used for debug printing.
/// We do not place that under `#if LLVM_ENABLE_ABI_BREAKING_CHECKS`
/// intentionally because it adds unneeded complexity without noticeable
/// benefits (see discussion with @thakis in D120714).
uint16_t PersistentId;

//===--------------------------------------------------------------------===//
Expand Down

0 comments on commit 28cb908

Please sign in to comment.