[llvm] [X86] Fix incorrect NOP insertion between fused instructions that breaks macro fusion (PR #155316)
Aleksandr Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 27 02:08:11 PDT 2025
================
@@ -0,0 +1,14 @@
+# RUN: llvm-mc -filetype=obj -triple x86_64 --x86-align-branch-boundary=32 --x86-align-branch=fused+jcc %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s
+
+# Exercise the case where fused instructions need to be aligned,
+# ensuring fusion is not broken by a NOP
+
+ .globl f
+f:
+ .nops 27
----------------
aleks-tmb wrote:
I've restored the `-x86-pad-max-prefix-size=1` option to make the issue reproducible without the patch. Without this option, we do not emit `test` instruction into a fragment, due to the check below:
```
if (!(Backend.mayNeedRelaxation(Inst.getOpcode(), Inst.getOperands(), STI) ||
Backend.allowEnhancedRelaxation())) {
emitInstToData(Inst, STI);
return;
}
```
https://github.com/llvm/llvm-project/pull/155316
More information about the llvm-commits
mailing list