[llvm] [BOLT] Extend Inliner to work on functions with Pointer Autentication (PR #162458)

Gergely Bálint via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 06:18:22 PST 2025


================
@@ -313,6 +313,20 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
            Inst.getOpcode() == AArch64::RETABSPPCr;
   }
 
+  void createMatchingAuth(const MCInst &AuthAndRet, MCInst &Auth) override {
+    Auth.clear();
+    switch (AuthAndRet.getOpcode()) {
+    case AArch64::RETAA:
+      Auth.setOpcode(AArch64::AUTIASP);
+      break;
+    case AArch64::RETAB:
+      Auth.setOpcode(AArch64::AUTIBSP);
+      break;
+    default:
+      llvm_unreachable("Unhandled fused pauth-and-return instruction");
----------------
bgergely0 wrote:

> Fair point, althought BOLT currently has 118 llvm_unreachables, 9 in this very file. Not saying that should excuse adding more, just that this isn't a make-or-break thing.

Actually, I might prefer doing the same convention as the rest of the file, instead of introducing the first `createFatalBOLTError` here. The whole `llvm_unreachable` issue should rather be mitigated on a whole subproject-level, shouldn't it? 

https://discourse.llvm.org/t/llvm-unreachable-is-widely-misused/60587
https://llvm.org/docs/CodingStandards.html#assert-liberally
```
When assertions are disabled (i.e. in release builds), llvm_unreachable becomes a hint to compilers to skip generating code for this branch.
```

I guess it would be worth knowing if BOLT's release builds have assertions or not.

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


More information about the llvm-commits mailing list