[llvm] [AArch64] Treat NOP as a separate instruction. (PR #170968)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 04:50:53 PST 2025


hvdijk wrote:

> Hi - This sounds fine, but where do you expect them to be used?

There's a fair number of places that *should* bail out on instructions with unmodelled side effects, but currently don't. For example, we should have something like

```diff
--- a/bolt/lib/Core/MCPlusBuilder.cpp
+++ b/bolt/lib/Core/MCPlusBuilder.cpp
@@ -450,6 +450,10 @@ void MCPlusBuilder::getClobberedRegs(const MCInst &Inst,
     return;
 
   const MCInstrDesc &InstInfo = Info->get(Inst.getOpcode());
+  if (InstInfo.hasUnmodeledSideEffects()) {
+    Regs.set();
+    return;
+  }
 
   for (MCPhysReg ImplicitDef : InstInfo.implicit_defs())
     Regs |= getAliases(ImplicitDef, /*OnlySmaller=*/false);
```

This is what would benefit from this PR: this PR is enough to make `InstInfo.hasUnmodeledSideEffects()` return `false` for AArch64's `nop`.

There are a number of other instructions with the same problem, but I am splitting up the PRs for easier review. Once they're all in, at least for the instructions where we know it is a problem, I can submit the changes to BOLT to check `hasUnmodeledSideEffects()`.

https://github.com/llvm/llvm-project/pull/170968


More information about the llvm-commits mailing list