[llvm] [AArch64][PAC] Specify Defs and Uses of PAUTH_(PROLOGUE|EPILOGUE) (PR #68205)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 04:04:17 PDT 2023


https://github.com/atrosinenko created https://github.com/llvm/llvm-project/pull/68205

This is a follow-up to eb02ee44d32531931af5312cd450779011664eef.

>From 794180f4c6c55156d2b32c8737f2fa88637c062a Mon Sep 17 00:00:00 2001
From: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
Date: Tue, 3 Oct 2023 19:54:00 +0300
Subject: [PATCH] [AArch64][PAC] Specify Defs and Uses of
 PAUTH_(PROLOGUE|EPILOGUE)

---
 llvm/lib/Target/AArch64/AArch64InstrInfo.td      |  2 ++
 .../machine-outliner-retaddr-sign-sp-mod.mir     | 16 ++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index cd377d659ad3ee9..5293df90b880b8b 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -1482,12 +1482,14 @@ def : InstAlias<"xpaclri", (XPACLRI), 0>;
 
 // Pseudos
 
+let Uses = [LR, SP], Defs = [LR] in {
 // Insertion point of LR signing code.
 def PAUTH_PROLOGUE : Pseudo<(outs), (ins), []>, Sched<[]>;
 // Insertion point of LR authentication code.
 // The RET terminator of the containing machine basic block may be replaced
 // with a combined RETA(A|B) instruction when rewriting this Pseudo.
 def PAUTH_EPILOGUE : Pseudo<(outs), (ins), []>, Sched<[]>;
+}
 
 // These pointer authentication instructions require armv8.3a
 let Predicates = [HasPAuth] in {
diff --git a/llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-sp-mod.mir b/llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-sp-mod.mir
index 9c115a1de0db162..7d5a7e247087fc8 100644
--- a/llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-sp-mod.mir
+++ b/llvm/test/CodeGen/AArch64/machine-outliner-retaddr-sign-sp-mod.mir
@@ -67,7 +67,7 @@ tracksRegLiveness: true
 body:             |
   bb.0 (%ir-block.0):
   liveins: $lr
-    frame-setup PAUTH_PROLOGUE
+    frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
     $sp = frame-setup SUBXri $sp, 16, 0
     renamable $x8 = ADRP target-flags(aarch64-page) @v
     $x9 = ADDXri $sp, 12, 0
@@ -79,7 +79,7 @@ body:             |
     STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     $sp = frame-destroy ADDXri $sp, 16, 0
-    frame-destroy PAUTH_EPILOGUE
+    frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
     RET undef $lr
 
 # CHECK-LABEL:    name:            legal0
@@ -100,7 +100,7 @@ tracksRegLiveness: true
 body:             |
   bb.0 (%ir-block.0):
   liveins: $lr
-    frame-setup PAUTH_PROLOGUE
+    frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
     $sp = frame-setup SUBXri $sp, 16, 0
     renamable $x8 = ADRP target-flags(aarch64-page) @v
     $x9 = ADDXri $sp, 12, 0
@@ -112,7 +112,7 @@ body:             |
     STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     $sp = frame-destroy ADDXri $sp, 16, 0
-    frame-destroy PAUTH_EPILOGUE
+    frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
     RET undef $lr
 
 # CHECK-LABEL:    name:            legal1
@@ -133,7 +133,7 @@ tracksRegLiveness: true
 body:             |
   bb.0 (%ir-block.0):
   liveins: $lr
-    frame-setup PAUTH_PROLOGUE
+    frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
     $sp = frame-setup SUBXri $sp, 16, 0
     renamable $x8 = ADRP target-flags(aarch64-page) @v
     $x9 = ADDXri $sp, 12, 0
@@ -145,7 +145,7 @@ body:             |
     STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     $sp = frame-destroy ADDXri $sp, 12, 0
-    frame-destroy PAUTH_EPILOGUE
+    frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
     RET undef $lr
 
 ...
@@ -155,7 +155,7 @@ tracksRegLiveness: true
 body:             |
   bb.0 (%ir-block.0):
   liveins: $lr
-    frame-setup PAUTH_PROLOGUE
+    frame-setup PAUTH_PROLOGUE implicit-def $lr, implicit $lr, implicit $sp
     $sp = frame-setup SUBXri $sp, 16, 0
     renamable $x8 = ADRP target-flags(aarch64-page) @v
     $x9 = ADDXri $sp, 12, 0
@@ -167,7 +167,7 @@ body:             |
     STRXui renamable $x9, renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     STRXui killed renamable $x9, killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @v :: (volatile store (s64) into @v)
     $sp = frame-destroy ADDXri $sp, 12, 0
-    frame-destroy PAUTH_EPILOGUE
+    frame-destroy PAUTH_EPILOGUE implicit-def $lr, implicit $lr, implicit $sp
     RET undef $lr
 
 # CHECK-LABEL:    name:            illegal0



More information about the llvm-commits mailing list