[llvm] [LFI] Report reserved register modification in error message (PR #195160)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 13:08:33 PDT 2026


================
@@ -64,10 +65,12 @@ static bool isPrivilegedTPAccess(const MCInst &Inst) {
   return false;
 }
 
-bool AArch64MCLFIRewriter::mayModifyReserved(const MCInst &Inst) const {
-  return mayModifyRegister(Inst, LFIAddrReg) ||
-         mayModifyRegister(Inst, LFIBaseReg) ||
-         mayModifyRegister(Inst, LFICtxReg);
+MCRegister AArch64MCLFIRewriter::mayModifyReserved(const MCInst &Inst) const {
+  for (MCRegister Reg : {LFIAddrReg, LFIBaseReg, LFICtxReg}) {
+    if (mayModifyRegister(Inst, Reg))
+      return Reg;
+  }
+  return MCRegister();
----------------
nickdesaulniers wrote:

```suggestion
  return {};
```

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


More information about the llvm-commits mailing list