[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 08:33:26 PDT 2025


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

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

(positively affects compile time regardless of whether Key Instructions is enabled)

>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] [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;



More information about the llvm-commits mailing list