[llvm] [NFC][DebugInfo] Make MDNodeKeyImpl<DILocation>::Column 16 bits (PR #143399)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 10:01:12 PDT 2025


https://github.com/OCHyams updated https://github.com/llvm/llvm-project/pull/143399

>From fb4a8b67c125b6cc1dc4519871e3a5d529e5e5ee Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Mon, 9 Jun 2025 15:01:30 +0100
Subject: [PATCH 1/2] [NFC][DebugInfo] Make MDNodeKeyImpl<DILocation>::Column
 16 bits

Column is limited to 16 bits in several places in the compiler:
https://github.com/llvm/llvm-project/blob/a3c7d461456f2da25c1d119b6686773f675e313e/llvm/lib/IR/DebugInfoMetadata.cpp#L87
  https://github.com/llvm/llvm-project/blob/a3c7d461456f2da25c1d119b6686773f675e313e/llvm/lib/AsmParser/LLParser.cpp#L4706

Slight compile time improvement due to reducing `hash_combine` workload in
MDNodeKeyImpl<DILocation>::getHashValue().

https://llvm-compile-time-tracker.com/compare.php?from=2b7b0e178259a910355631d7d648c89052000872&to=89490929c34f45842df1588cf78d836f51c2c222&stat=instructions%3Au
---
 llvm/lib/IR/LLVMContextImpl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 7b6083a7a3496..946dc3188aeb1 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -311,7 +311,7 @@ template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
 /// DenseMapInfo for DILocation.
 template <> struct MDNodeKeyImpl<DILocation> {
   unsigned Line;
-  unsigned Column;
+  uint16_t Column;
   Metadata *Scope;
   Metadata *InlinedAt;
   bool ImplicitCode;

>From 865e7589034b6f9c5c0454d4894e60e0e2466f1f Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Mon, 9 Jun 2025 18:01:00 +0100
Subject: [PATCH 2/2] update ctor

---
 llvm/lib/IR/LLVMContextImpl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 946dc3188aeb1..87cd52e357be2 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -320,7 +320,7 @@ template <> struct MDNodeKeyImpl<DILocation> {
   uint64_t AtomRank : 3;
 #endif
 
-  MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
+  MDNodeKeyImpl(unsigned Line, uint16_t Column, Metadata *Scope,
                 Metadata *InlinedAt, bool ImplicitCode, uint64_t AtomGroup,
                 uint8_t AtomRank)
       : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt),



More information about the llvm-commits mailing list