[all-commits] [llvm/llvm-project] 77bcab: [InstCombine] Combine ptrauth intrin. callee into ...
Ahmed Bougacha via All-commits
all-commits at lists.llvm.org
Tue Jul 15 14:40:15 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 77bcab835aca155b67548c4a3cb1ae583abb1a14
https://github.com/llvm/llvm-project/commit/77bcab835aca155b67548c4a3cb1ae583abb1a14
Author: Ahmed Bougacha <ahmed at bougacha.org>
Date: 2025-07-15 (Tue, 15 Jul 2025)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
A llvm/test/Transforms/InstCombine/ptrauth-intrinsics-call.ll
Log Message:
-----------
[InstCombine] Combine ptrauth intrin. callee into same-key bundle. (#94707)
Try to optimize a call to the result of a ptrauth intrinsic, potentially
into the ptrauth call bundle:
call(ptrauth.resign(p)), ["ptrauth"()] -> call p, ["ptrauth"()]
call(ptrauth.sign(p)), ["ptrauth"()] -> call p
as long as the key/discriminator are the same in sign and auth-bundle,
and we don't change the key in the bundle (to a potentially-invalid
key.)
Generating a plain call to a raw unauthenticated pointer is generally
undesirable, but if we ended up seeing a naked ptrauth.sign in the first
place, we already have suspicious code. Unauthenticated calls are also
easier to spot than naked signs, so let the indirect call shine.
Note that there is an arguably unsafe extension to this, where we don't
bother checking that the key in bundle and intrinsic are the same (and
also allow folding away an auth into a bundle.)
This can end up generating calls with a bundle that has an invalid key
(which an informed frontend wouldn't have otherwise done), which can be
problematic. The C that generates that is straightforward but arguably
unreasonable. That wouldn't be an issue if we were to bite the bullet
and make these fully AArch64-specific, allowing key knowledge to be
embedded here.
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