[llvm] [BOLT][AArch64] Speedup `computeInstructionSize` (PR #121106)
Vladislav Khmelevsky via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 25 05:01:47 PST 2024
================
@@ -1363,6 +1363,17 @@ class BinaryContext {
if (std::optional<uint32_t> Size = MIB->getSize(Inst))
return *Size;
+ // Pseudo instrs will not be emiitted and have no size.
+ if (MIB->isPseudo(Inst)) {
+ return 0;
+ }
+
+ // Directly return 4 because AArch64 instructions always have a
+ // fixed size of 4 bytes.
+ if (isAArch64()) {
----------------
yota9 wrote:
I think the way it is now implemented interference with the idea of getting instruction size in MIB with annotations. We first want to check annotations and then check with target specific API. I don't mind if getSIze would call target-specific function in case of annotation absense that would return optional value too. But don't fully replace annotation version getSize. Although currently it look like it is OK for aarch64 (only looks, since with annotations we can do other funny things potentionaly) we might meet such problems in another architectures, so everything must my in sync.
https://github.com/llvm/llvm-project/pull/121106
More information about the llvm-commits
mailing list