[llvm-branch-commits] [llvm] release/21.x: [AArch64][PAC][GISel] Add missing clobbering info to LOADgotAUTH (#157433) (PR #160668)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Sep 25 02:14:36 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport cff5a439a847db67ea3478b088ec2f8047871ff0
Requested by: @<!-- -->atrosinenko
---
Full diff: https://github.com/llvm/llvm-project/pull/160668.diff
2 Files Affected:
- (modified) llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp (+3-3)
- (added) llvm/test/CodeGen/AArch64/GlobalISel/ptrauth-elf-got.mir (+23)
``````````diff
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 1381a9b70df87..450915518cc2f 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -2977,10 +2977,10 @@ bool AArch64InstructionSelector::select(MachineInstr &I) {
}
if (OpFlags & AArch64II::MO_GOT) {
- I.setDesc(TII.get(MF.getInfo<AArch64FunctionInfo>()->hasELFSignedGOT()
- ? AArch64::LOADgotAUTH
- : AArch64::LOADgot));
+ bool IsGOTSigned = MF.getInfo<AArch64FunctionInfo>()->hasELFSignedGOT();
+ I.setDesc(TII.get(IsGOTSigned ? AArch64::LOADgotAUTH : AArch64::LOADgot));
I.getOperand(1).setTargetFlags(OpFlags);
+ I.addImplicitDefUseOperands(MF);
} else if (TM.getCodeModel() == CodeModel::Large &&
!TM.isPositionIndependent()) {
// Materialize the global using movz/movk instructions.
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/ptrauth-elf-got.mir b/llvm/test/CodeGen/AArch64/GlobalISel/ptrauth-elf-got.mir
new file mode 100644
index 0000000000000..faf2cb8221ec7
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/ptrauth-elf-got.mir
@@ -0,0 +1,23 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
+# RUN: llc -O0 -mtriple=aarch64-linux-gnu -relocation-model=pic -run-pass=instruction-select -global-isel-abort=1 -verify-machineinstrs %s -o - | FileCheck %s
+
+--- |
+ @var_got = external global i8
+ define ptr @loadgotauth_implicit_defs() { ret ptr null }
+
+ !llvm.module.flags = !{!0}
+ !0 = !{i32 8, !"ptrauth-elf-got", i32 1}
+...
+
+---
+name: loadgotauth_implicit_defs
+legalized: true
+regBankSelected: true
+body: |
+ bb.0:
+ ; CHECK-LABEL: name: loadgotauth_implicit_defs
+ ; CHECK: [[LOADgotAUTH:%[0-9]+]]:gpr64common = LOADgotAUTH target-flags(aarch64-got) @var_got, implicit-def $x16, implicit-def $x17, implicit-def $nzcv
+ ; CHECK-NEXT: $x0 = COPY [[LOADgotAUTH]]
+ %0:gpr(p0) = G_GLOBAL_VALUE @var_got
+ $x0 = COPY %0(p0)
+...
``````````
</details>
https://github.com/llvm/llvm-project/pull/160668
More information about the llvm-branch-commits
mailing list