[all-commits] [llvm/llvm-project] e92bb8: [AArch64][PAC] Simplify emission of authenticated ...
Anatoly Trosinenko via All-commits
all-commits at lists.llvm.org
Mon Nov 24 11:19:13 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e92bb83c1810c61a7fa81d55a1690cffa2b14b60
https://github.com/llvm/llvm-project/commit/e92bb83c1810c61a7fa81d55a1690cffa2b14b60
Author: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
Date: 2025-11-24 (Mon, 24 Nov 2025)
Changed paths:
M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
Log Message:
-----------
[AArch64][PAC] Simplify emission of authenticated pointer check (NFC) (#160899)
The `AArch64AsmPrinter::emitPtrauthCheckAuthenticatedValue` method accepts
two arguments, `bool ShouldTrap` and `const MCSymbol *OnFailure`, that
control the behavior of the emitted instruction sequence when the check
fails:
* `ShouldTrap` requests an error to be generated
* `OnFailure` requests branching to the given label after clearing the
PAC field
An assertion in `emitPtrauthCheckAuthenticatedValue` ensures that when
`ShouldTrap` is true, `OnFailure` must be null. But the opposite holds
as well: when `ShouldTrap` is false, `OnFailure` is always non-null,
as otherwise the entire sequence following `AUT[ID][AB]` instruction
would turn into a very expensive equivalent of XPAC (unless the CPU
implements FEAT_FPAC):
authenticate Xn
inspect PAC field of Xn
if PAC field was not cleared:
clear PAC field
In other words, the value of `ShouldTrap` argument can be computed as
`OnFailure == nullptr` at all existing call sites. In fact, at three
of four call sites, constant `true` and `nullptr` are passed as the
values of these function arguments. `emitPtrauthAuthResign` is the
only caller that potentially makes use of checking-but-not-trapping
mode of `emitPtrauthCheckAuthenticatedValue`, and it passes a non-null
pointer as `OnFailure` when `ShouldTrap` is false.
This commit makes the invariant explicit by omitting the `ShouldTrap`
argument and inferring its value from the `OnFailure` argument instead.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list