[BOLT] Set NOOP size only on X86 (NFC) (#71307)

Small fix, we have problems with noop size only on x86, no reason to do
it on other platforms.
This commit is contained in:
Vladislav Khmelevsky
2023-11-06 15:21:50 +04:00
committed by GitHub
parent ed350bb3d8
commit 838331a081

View File

@@ -1375,8 +1375,8 @@ add_instruction:
if (BC.keepOffsetForInstruction(Instruction))
MIB->setOffset(Instruction, static_cast<uint32_t>(Offset));
if (BC.MIB->isNoop(Instruction)) {
// NOTE: disassembly loses the correct size information for noops.
if (BC.isX86() && BC.MIB->isNoop(Instruction)) {
// NOTE: disassembly loses the correct size information for noops on x86.
// E.g. nopw 0x0(%rax,%rax,1) is 9 bytes, but re-encoded it's only
// 5 bytes. Preserve the size info using annotations.
MIB->addAnnotation(Instruction, "Size", static_cast<uint32_t>(Size));