Skip to content

Commit 28cb908

Browse files
committed
[NFC][CodeGen] Add comments for SDNode debug ID
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
1 parent 25b7efc commit 28cb908

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

llvm/include/llvm/CodeGen/SelectionDAG.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class SelectionDAG {
280280

281281
DenseMap<const SDNode *, CallSiteDbgInfo> SDCallSiteDbgInfo;
282282

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

285290
/// Are instruction referencing variable locations desired for this function?

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,10 @@ END_TWO_BYTE_PACK()
615615
SDNodeFlags Flags;
616616

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

622624
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)