[llvm] acf6721 - MCInst: decrease inline element count to 6. NFC

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 9 16:42:48 PDT 2024


Author: Fangrui Song
Date: 2024-06-09T16:42:44-07:00
New Revision: acf67212e87bdccebba1c6dc6b6e49f3a7bcf866

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

LOG: MCInst: decrease inline element count to 6. NFC

MCInst is primarily used in local variables and MCRelaxableFragment
(mostly JMP/JCC for x86). Reducing the inline element count can make
MCRelaxableFragment smaller, potentially leading to a lower peak RSS.

When compiling sqlite3.c, x86-64 has the largest maximum numOperands.

aarch64: 5; ppc64: 6; riscv64: 3; s390x: 6; x86-64: 8

Here is the frequency table for x86-64:

max getNumOperands: 8
0: 676
1: 37892
2: 84046
3: 26767
4: 1640
5: 1222
6: 80794
7: 768
8: 22

Pull Request: https://github.com/llvm/llvm-project/pull/94913

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCInst.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCInst.h b/llvm/include/llvm/MC/MCInst.h
index 2bc310852fe50..578b7328970b7 100644
--- a/llvm/include/llvm/MC/MCInst.h
+++ b/llvm/include/llvm/MC/MCInst.h
@@ -189,7 +189,7 @@ class MCInst {
   unsigned Flags = 0;
 
   SMLoc Loc;
-  SmallVector<MCOperand, 10> Operands;
+  SmallVector<MCOperand, 6> Operands;
 
 public:
   MCInst() = default;


        


More information about the llvm-commits mailing list