Skip to content

AArch64: Clear hasSideEffects on AUT and AUTPAC. #141330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pcc
Copy link
Contributor

@pcc pcc commented May 24, 2025

With hasSideEffects=1 we unnecessarily inhibit certain optimizations in
the backend such as code motion which lead to slightly less efficient
codegen when the pseudo instructions are used frequently, e.g. in the
PFP use case. These annotations do not cause the instructions to be kept
without a use because the underlying intrinsics are IntrNoMem. Users
should be expected to use another means of keeping the use alive if they
need the trapping side effect without a use (e.g. llvm.fake.use).

Created using spr 1.3.6-beta.1
@llvmbot
Copy link
Member

llvmbot commented May 24, 2025

@llvm/pr-subscribers-backend-aarch64

Author: Peter Collingbourne (pcc)

Changes

With hasSideEffects=1 we unnecessarily inhibit certain optimizations in
the backend such as code motion which lead to slightly less efficient
codegen when the pseudo instructions are used frequently, e.g. in the
PFP use case. These annotations do not cause the instructions to be kept
without a use because the underlying intrinsics are IntrNoMem. Users
should be expected to use another means of keeping the use alive if they
need the trapping side effect without a use (e.g. llvm.fake.use).


Full diff: https://github.com/llvm/llvm-project/pull/141330.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AArch64/AArch64InstrInfo.td (+2-2)
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 61055a66e8858..5674721be90c4 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -1943,7 +1943,7 @@ let Predicates = [HasPAuth] in {
   def AUT : Pseudo<(outs), (ins i32imm:$Key, i64imm:$Disc, GPR64noip:$AddrDisc),
                    []>, Sched<[WriteI, ReadI]> {
     let isCodeGenOnly = 1;
-    let hasSideEffects = 1;
+    let hasSideEffects = 0;
     let mayStore = 0;
     let mayLoad = 0;
     let Size = 32;
@@ -1960,7 +1960,7 @@ let Predicates = [HasPAuth] in {
                     i32imm:$PACKey, i64imm:$PACDisc, GPR64noip:$PACAddrDisc),
                []>, Sched<[WriteI, ReadI]> {
     let isCodeGenOnly = 1;
-    let hasSideEffects = 1;
+    let hasSideEffects = 0;
     let mayStore = 0;
     let mayLoad = 0;
     let Size = 48;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants