[PATCH] D28149: [GlobalValue] Move HasLLVMReservedName into existing bitfield. NFC

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 16:32:32 PST 2016


jlebar created this revision.
jlebar added a reviewer: rnk.
jlebar added a subscriber: llvm-commits.

Follow-up to r290691, where I introduced HasLLVMReservedName.  rnk
pointed out that that patch added an extra word to GlobalValue on MSVC,
because it doesn't pack bitfields with different types.

This patch moves HasLLVMReservedName into the existing bitfield, where
we appear to have plenty of bits to spare.


https://reviews.llvm.org/D28149

Files:
  llvm/include/llvm/IR/GlobalValue.h


Index: llvm/include/llvm/IR/GlobalValue.h
===================================================================
--- llvm/include/llvm/IR/GlobalValue.h
+++ llvm/include/llvm/IR/GlobalValue.h
@@ -80,7 +80,7 @@
         ValueType(Ty), Linkage(Linkage), Visibility(DefaultVisibility),
         UnnamedAddrVal(unsigned(UnnamedAddr::None)),
         DllStorageClass(DefaultStorageClass), ThreadLocal(NotThreadLocal),
-        IntID((Intrinsic::ID)0U), HasLLVMReservedName(false), Parent(nullptr) {
+        HasLLVMReservedName(false), IntID((Intrinsic::ID)0U), Parent(nullptr) {
     setName(Name);
   }
 
@@ -94,13 +94,19 @@
 
   unsigned ThreadLocal : 3; // Is this symbol "Thread Local", if so, what is
                             // the desired model?
-  static const unsigned GlobalValueSubClassDataBits = 19;
+
+  /// True if the function's name starts with "llvm.".  This corresponds to the
+  /// value of Function::isIntrinsic(), which may be true even if
+  /// Function::intrinsicID() returns Intrinsic::not_intrinsic.
+  unsigned HasLLVMReservedName : 1;
+
+  static const unsigned GlobalValueSubClassDataBits = 18;
 
 private:
   friend class Constant;
 
   // Give subclasses access to what otherwise would be wasted padding.
-  // (19 + 4 + 2 + 2 + 2 + 3) == 32.
+  // (18 + 4 + 2 + 2 + 2 + 3 + 1) == 32.
   unsigned SubClassData : GlobalValueSubClassDataBits;
 
   void destroyConstantImpl();
@@ -137,12 +143,7 @@
   /// Subclasses can use it to store their intrinsic ID, if they have one.
   ///
   /// This is stored here to save space in Function on 64-bit hosts.
-  Intrinsic::ID IntID : 31;
-
-  /// True if the function's name starts with "llvm.".  This corresponds to the
-  /// value of Function::isIntrinsic(), which may be true even if
-  /// Function::intrinsicID() returns Intrinsic::not_intrinsic.
-  bool HasLLVMReservedName : 1;
+  Intrinsic::ID IntID;
 
   unsigned getGlobalValueSubClassData() const {
     return SubClassData;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28149.82629.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161229/20294639/attachment.bin>


More information about the llvm-commits mailing list