[llvm] [SelectionDAG] Use uintptr_t for ResNo in SDValue. (PR #104660)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 17 12:39:51 PDT 2024


https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/104660

>From 6c8520777908667de7d430cede28cc79ed973dde Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 16 Aug 2024 19:10:06 -0700
Subject: [PATCH 1/2] [SelectionDAG] Use uintptr_t for ResNo in SDValue.

This uses up the padding bytes at the end of SDValue.

This reduces compile and binary size.

compiler time result https://llvm-compile-time-tracker.com/compare.php?from=6e0fc155782ff5307245a85c7b037a2998ec6c86&to=75ea202907d75e9e5362c487466e956036beeefc&stat=instructions:u
---
 llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 2f36c2e86b1c3a..dc3bb63580bd2d 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -146,7 +146,7 @@ class SDValue {
   friend struct DenseMapInfo<SDValue>;
 
   SDNode *Node = nullptr; // The node defining the value we are using.
-  unsigned ResNo = 0;     // Which return value of the node we are using.
+  uintptr_t ResNo = 0;       // Which return value of the node we are using.
 
 public:
   SDValue() = default;

>From f07a9a3a75b00eea204007080310ebbc8f235241 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Sat, 17 Aug 2024 12:39:36 -0700
Subject: [PATCH 2/2] fixup! Use size_t

---
 llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index dc3bb63580bd2d..357797764675c6 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -146,7 +146,7 @@ class SDValue {
   friend struct DenseMapInfo<SDValue>;
 
   SDNode *Node = nullptr; // The node defining the value we are using.
-  uintptr_t ResNo = 0;       // Which return value of the node we are using.
+  size_t ResNo = 0;       // Which return value of the node we are using.
 
 public:
   SDValue() = default;



More information about the llvm-commits mailing list