[llvm] 24cae17 - [MI] Reduce MachineInstr size (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 09:38:46 PDT 2020


Author: Nikita Popov
Date: 2020-04-17T18:30:56+02:00
New Revision: 24cae17c283e1b4f4672b987d5b978b8fb997f75

URL: https://github.com/llvm/llvm-project/commit/24cae17c283e1b4f4672b987d5b978b8fb997f75
DIFF: https://github.com/llvm/llvm-project/commit/24cae17c283e1b4f4672b987d5b978b8fb997f75.diff

LOG: [MI] Reduce MachineInstr size (NFC)

Move CapOperands next to AsmPrinterFlags, to reduce size of
MachineInstr by 8 bytes.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachineInstr.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index 6c550dc331dd..48db14e6cd69 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -115,8 +115,6 @@ class MachineInstr
   // Operands are allocated by an ArrayRecycler.
   MachineOperand *Operands = nullptr;   // Pointer to the first operand.
   unsigned NumOperands = 0;             // Number of operands on instruction.
-  using OperandCapacity = ArrayRecycler<MachineOperand>::Capacity;
-  OperandCapacity CapOperands;          // Capacity of the Operands array.
 
   uint16_t Flags = 0;                   // Various bits of additional
                                         // information about machine
@@ -129,6 +127,11 @@ class MachineInstr
                                         // anything other than to convey comment
                                         // information to AsmPrinter.
 
+  // OperandCapacity has uint8_t size, so it should be next to AsmPrinterFlags
+  // to properly pack.
+  using OperandCapacity = ArrayRecycler<MachineOperand>::Capacity;
+  OperandCapacity CapOperands;          // Capacity of the Operands array.
+
   /// Internal implementation detail class that provides out-of-line storage for
   /// extra info used by the machine instruction when this info cannot be stored
   /// in-line within the instruction itself.


        


More information about the llvm-commits mailing list