[llvm] [BOLT][AArch64] Speedup `computeInstructionSize` (PR #121106)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 25 04:30:18 PST 2024


https://github.com/liusy58 updated https://github.com/llvm/llvm-project/pull/121106

>From d333a78172f79e949b528a98aa9c76b647984610 Mon Sep 17 00:00:00 2001
From: liusy58 <liusy58 at linux.alibaba.com>
Date: Wed, 25 Dec 2024 19:45:08 +0800
Subject: [PATCH] [BOLT][AArch64]  Speedup `computeInstructionSize`

---
 bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
index 7e08e5c81d26ff..362b0f9527fac5 100644
--- a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -1790,6 +1790,13 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
   }
 
   uint16_t getMinFunctionAlignment() const override { return 4; }
+
+  std::optional<uint32_t> getSize(const MCInst &Inst) const {
+    if (isPseudo(Inst)) {
+      return 0;
+    }
+    return 4;
+  };
 };
 
 } // end anonymous namespace



More information about the llvm-commits mailing list