[llvm] MCInst: decrease inline element count to 6. NFC (PR #94913)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 9 13:34:07 PDT 2024


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/94913

MCInst is primarily used in local variables and MCRelaxableFragment
(mostly JMP/JCC for x86). Decreasing the inline element count can make
MCRelaxableFragment smaller.

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


>From 218230a03481d0a8b3aefa05ad3d285cb792c16a Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sun, 9 Jun 2024 13:33:57 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 llvm/include/llvm/MC/MCInst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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