Skip to content

Commit a5688e5

Browse files
committed
[PAC][CodeGen] Emit trap sequence w/o FPAC on LOADgotAUTH expansion
1 parent c1dd585 commit a5688e5

7 files changed

+246
-89
lines changed

llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,6 +2273,7 @@ void AArch64AsmPrinter::LowerMOVaddrPAC(const MachineInstr &MI) {
22732273

22742274
void AArch64AsmPrinter::LowerLOADgotAUTH(const MachineInstr &MI) {
22752275
Register DstReg = MI.getOperand(0).getReg();
2276+
Register AuthResultReg = STI->hasFPAC() ? DstReg : AArch64::X16;
22762277
const MachineOperand &GAMO = MI.getOperand(1);
22772278
assert(GAMO.getOffset() == 0);
22782279

@@ -2286,17 +2287,17 @@ void AArch64AsmPrinter::LowerLOADgotAUTH(const MachineInstr &MI) {
22862287
MCInstLowering.lowerOperand(GALoOp, GAMCLo);
22872288

22882289
EmitToStreamer(
2289-
MCInstBuilder(AArch64::ADRP).addReg(AArch64::X16).addOperand(GAMCHi));
2290+
MCInstBuilder(AArch64::ADRP).addReg(AArch64::X17).addOperand(GAMCHi));
22902291

22912292
EmitToStreamer(MCInstBuilder(AArch64::ADDXri)
2292-
.addReg(AArch64::X16)
2293-
.addReg(AArch64::X16)
2293+
.addReg(AArch64::X17)
2294+
.addReg(AArch64::X17)
22942295
.addOperand(GAMCLo)
22952296
.addImm(0));
22962297

22972298
EmitToStreamer(MCInstBuilder(AArch64::LDRXui)
2298-
.addReg(DstReg)
2299-
.addReg(AArch64::X16)
2299+
.addReg(AuthResultReg)
2300+
.addReg(AArch64::X17)
23002301
.addImm(0));
23012302

23022303
assert(GAMO.isGlobal());
@@ -2305,7 +2306,7 @@ void AArch64AsmPrinter::LowerLOADgotAUTH(const MachineInstr &MI) {
23052306
UndefWeakSym = createTempSymbol("undef_weak");
23062307
EmitToStreamer(
23072308
MCInstBuilder(AArch64::CBZX)
2308-
.addReg(DstReg)
2309+
.addReg(AuthResultReg)
23092310
.addExpr(MCSymbolRefExpr::create(UndefWeakSym, OutContext)));
23102311
}
23112312

@@ -2314,12 +2315,23 @@ void AArch64AsmPrinter::LowerLOADgotAUTH(const MachineInstr &MI) {
23142315
? AArch64::AUTIA
23152316
: AArch64::AUTDA;
23162317
EmitToStreamer(MCInstBuilder(AuthOpcode)
2317-
.addReg(DstReg)
2318-
.addReg(DstReg)
2319-
.addReg(AArch64::X16));
2318+
.addReg(AuthResultReg)
2319+
.addReg(AuthResultReg)
2320+
.addReg(AArch64::X17));
23202321

23212322
if (GAMO.getGlobal()->hasExternalWeakLinkage())
23222323
OutStreamer->emitLabel(UndefWeakSym);
2324+
2325+
if (!STI->hasFPAC()) {
2326+
auto AuthKey =
2327+
(AuthOpcode == AArch64::AUTIA ? AArch64PACKey::IA : AArch64PACKey::DA);
2328+
2329+
emitPtrauthCheckAuthenticatedValue(AuthResultReg, AArch64::X17, AuthKey,
2330+
/*ShouldTrap=*/true,
2331+
/*OnFailure=*/nullptr);
2332+
2333+
emitMovXReg(DstReg, AuthResultReg);
2334+
}
23232335
}
23242336

23252337
const MCExpr *

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,8 +1944,8 @@ let Predicates = [HasPAuth] in {
19441944

19451945
def LOADgotAUTH : Pseudo<(outs GPR64common:$dst), (ins i64imm:$addr), []>,
19461946
Sched<[WriteI, ReadI]> {
1947-
let Defs = [X16];
1948-
let Size = 20;
1947+
let Defs = [X16,X17,NZCV];
1948+
let Size = 44;
19491949
}
19501950

19511951
// Load a signed global address from a special $auth_ptr$ stub slot.

llvm/test/CodeGen/AArch64/ptrauth-basic-pic.ll

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel=0 -fast-isel=0 -verify-machineinstrs \
2-
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac %s -o - | FileCheck %s
2+
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac %s -o - | FileCheck %s --check-prefixes=CHECK,NOTRAP
33
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel=0 -fast-isel=0 -verify-machineinstrs \
44
; RUN: -relocation-model=pic -mattr=+pauth %s -o - | FileCheck %s --check-prefixes=CHECK,TRAP
55

66
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel=0 -fast-isel=1 -verify-machineinstrs \
7-
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac %s -o - | FileCheck %s
7+
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac %s -o - | FileCheck %s --check-prefixes=CHECK,NOTRAP
88
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel=0 -fast-isel=1 -verify-machineinstrs \
99
; RUN: -relocation-model=pic -mattr=+pauth %s -o - | FileCheck %s --check-prefixes=CHECK,TRAP
1010

1111
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel=1 -global-isel-abort=1 -verify-machineinstrs \
12-
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac %s -o - | FileCheck %s
12+
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac %s -o - | FileCheck %s --check-prefixes=CHECK,NOTRAP
1313
; RUN: llc -mtriple=aarch64-linux-gnu -global-isel=1 -global-isel-abort=1 -verify-machineinstrs \
1414
; RUN: -relocation-model=pic -mattr=+pauth %s -o - | FileCheck %s --check-prefixes=CHECK,TRAP
1515

@@ -19,10 +19,19 @@
1919

2020
define i32 @get_globalvar() {
2121
; CHECK-LABEL: get_globalvar:
22-
; CHECK: adrp x16, :got_auth:var
23-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:var
24-
; CHECK-NEXT: ldr x8, [x16]
25-
; CHECK-NEXT: autda x8, x16
22+
; CHECK: adrp x17, :got_auth:var
23+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:var
24+
; NOTRAP-NEXT: ldr x8, [x17]
25+
; NOTRAP-NEXT: autda x8, x17
26+
; TRAP-NEXT: ldr x16, [x17]
27+
; TRAP-NEXT: autda x16, x17
28+
; TRAP-NEXT: mov x17, x16
29+
; TRAP-NEXT: xpacd x17
30+
; TRAP-NEXT: cmp x16, x17
31+
; TRAP-NEXT: b.eq .Lauth_success_0
32+
; TRAP-NEXT: brk #0xc472
33+
; TRAP-NEXT: .Lauth_success_0:
34+
; TRAP-NEXT: mov x8, x16
2635
; CHECK-NEXT: ldr w0, [x8]
2736
; CHECK-NEXT: ret
2837

@@ -32,10 +41,19 @@ define i32 @get_globalvar() {
3241

3342
define ptr @get_globalvaraddr() {
3443
; CHECK-LABEL: get_globalvaraddr:
35-
; CHECK: adrp x16, :got_auth:var
36-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:var
37-
; CHECK-NEXT: ldr x0, [x16]
38-
; CHECK-NEXT: autda x0, x16
44+
; CHECK: adrp x17, :got_auth:var
45+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:var
46+
; NOTRAP-NEXT: ldr x0, [x17]
47+
; NOTRAP-NEXT: autda x0, x17
48+
; TRAP-NEXT: ldr x16, [x17]
49+
; TRAP-NEXT: autda x16, x17
50+
; TRAP-NEXT: mov x17, x16
51+
; TRAP-NEXT: xpacd x17
52+
; TRAP-NEXT: cmp x16, x17
53+
; TRAP-NEXT: b.eq .Lauth_success_1
54+
; TRAP-NEXT: brk #0xc472
55+
; TRAP-NEXT: .Lauth_success_1:
56+
; TRAP-NEXT: mov x0, x16
3957
; CHECK-NEXT: ret
4058

4159
%val = load i32, ptr @var
@@ -53,9 +71,9 @@ define ptr @resign_globalfunc() {
5371
; TRAP-NEXT: mov x17, x16
5472
; TRAP-NEXT: xpaci x17
5573
; TRAP-NEXT: cmp x16, x17
56-
; TRAP-NEXT: b.eq .Lauth_success_0
74+
; TRAP-NEXT: b.eq .Lauth_success_2
5775
; TRAP-NEXT: brk #0xc470
58-
; TRAP-NEXT: .Lauth_success_0:
76+
; TRAP-NEXT: .Lauth_success_2:
5977
; CHECK-NEXT: mov x17, #42
6078
; CHECK-NEXT: pacia x16, x17
6179
; CHECK-NEXT: mov x0, x16
@@ -73,9 +91,9 @@ define ptr @resign_globalvar() {
7391
; TRAP-NEXT: mov x17, x16
7492
; TRAP-NEXT: xpacd x17
7593
; TRAP-NEXT: cmp x16, x17
76-
; TRAP-NEXT: b.eq .Lauth_success_1
94+
; TRAP-NEXT: b.eq .Lauth_success_3
7795
; TRAP-NEXT: brk #0xc472
78-
; TRAP-NEXT: .Lauth_success_1:
96+
; TRAP-NEXT: .Lauth_success_3:
7997
; CHECK-NEXT: mov x17, #43
8098
; CHECK-NEXT: pacdb x16, x17
8199
; CHECK-NEXT: mov x0, x16
@@ -93,9 +111,9 @@ define ptr @resign_globalvar_offset() {
93111
; TRAP-NEXT: mov x17, x16
94112
; TRAP-NEXT: xpacd x17
95113
; TRAP-NEXT: cmp x16, x17
96-
; TRAP-NEXT: b.eq .Lauth_success_2
114+
; TRAP-NEXT: b.eq .Lauth_success_4
97115
; TRAP-NEXT: brk #0xc472
98-
; TRAP-NEXT: .Lauth_success_2:
116+
; TRAP-NEXT: .Lauth_success_4:
99117
; CHECK-NEXT: add x16, x16, #16
100118
; CHECK-NEXT: mov x17, #44
101119
; CHECK-NEXT: pacda x16, x17

llvm/test/CodeGen/AArch64/ptrauth-elf-globals-pic.ll

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=0 -relocation-model=pic -o - %s \
2-
; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck %s
2+
; RUN: -mcpu=cyclone -mattr=+pauth -mattr=+fpac | FileCheck --check-prefixes=CHECK,NOTRAP %s
3+
; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=0 -relocation-model=pic -o - %s \
4+
; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck --check-prefixes=CHECK,TRAP %s
5+
6+
; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=1 -relocation-model=pic -o - %s \
7+
; RUN: -mcpu=cyclone -mattr=+pauth -mattr=+fpac | FileCheck --check-prefixes=CHECK,NOTRAP %s
38
; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=1 -relocation-model=pic -o - %s \
4-
; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck %s
9+
; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck --check-prefixes=CHECK,TRAP %s
10+
11+
; RUN: llc -mtriple=arm64 -global-isel=1 -global-isel-abort=1 -relocation-model=pic -o - %s \
12+
; RUN: -mcpu=cyclone -mattr=+pauth -mattr=+fpac | FileCheck --check-prefixes=CHECK,NOTRAP %s
513
; RUN: llc -mtriple=arm64 -global-isel=1 -global-isel-abort=1 -relocation-model=pic -o - %s \
6-
; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck %s
14+
; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck --check-prefixes=CHECK,TRAP %s
715

816
;; Note: for FastISel, we fall back to SelectionDAG
917

@@ -15,10 +23,19 @@ define i8 @test_i8(i8 %new) {
1523
ret i8 %val
1624

1725
; CHECK-LABEL: test_i8:
18-
; CHECK: adrp x16, :got_auth:var8
19-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:var8
20-
; CHECK-NEXT: ldr x9, [x16]
21-
; CHECK-NEXT: autda x9, x16
26+
; CHECK: adrp x17, :got_auth:var8
27+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:var8
28+
; NOTRAP-NEXT: ldr x9, [x17]
29+
; NOTRAP-NEXT: autda x9, x17
30+
; TRAP-NEXT: ldr x16, [x17]
31+
; TRAP-NEXT: autda x16, x17
32+
; TRAP-NEXT: mov x17, x16
33+
; TRAP-NEXT: xpacd x17
34+
; TRAP-NEXT: cmp x16, x17
35+
; TRAP-NEXT: b.eq .Lauth_success_0
36+
; TRAP-NEXT: brk #0xc472
37+
; TRAP-NEXT: .Lauth_success_0:
38+
; TRAP-NEXT: mov x9, x16
2239
; CHECK-NEXT: ldrb w8, [x9]
2340
; CHECK-NEXT: strb w0, [x9]
2441
; CHECK-NEXT: mov x0, x8

llvm/test/CodeGen/AArch64/ptrauth-extern-weak.ll

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel=0 -fast-isel=0 -relocation-model=pic \
2-
; RUN: -mattr=+pauth -mattr=+fpac -o - %s | FileCheck %s
2+
; RUN: -mattr=+pauth -mattr=+fpac -o - %s | FileCheck --check-prefixes=CHECK,NOTRAP %s
3+
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel=0 -fast-isel=0 -relocation-model=pic \
4+
; RUN: -mattr=+pauth -o - %s | FileCheck --check-prefixes=CHECK,TRAP %s
5+
6+
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel=0 -fast-isel=1 -relocation-model=pic \
7+
; RUN: -mattr=+pauth -mattr=+fpac -o - %s | FileCheck --check-prefixes=CHECK,NOTRAP %s
38
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel=0 -fast-isel=1 -relocation-model=pic \
4-
; RUN: -mattr=+pauth -mattr=+fpac -o - %s | FileCheck %s
9+
; RUN: -mattr=+pauth -o - %s | FileCheck --check-prefixes=CHECK,TRAP %s
10+
11+
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel=1 -global-isel-abort=1 -relocation-model=pic \
12+
; RUN: -mattr=+pauth -mattr=+fpac -o - %s | FileCheck --check-prefixes=CHECK,NOTRAP %s
513
; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel=1 -global-isel-abort=1 -relocation-model=pic \
6-
; RUN: -mattr=+pauth -mattr=+fpac -o - %s | FileCheck %s
14+
; RUN: -mattr=+pauth -o - %s | FileCheck --check-prefixes=CHECK,TRAP %s
715

816
;; Note: for FastISel, we fall back to SelectionDAG
917

@@ -16,12 +24,22 @@ define ptr @foo() {
1624
ret ptr @var
1725

1826
; CHECK-LABEL: foo:
19-
; CHECK: adrp x16, :got_auth:var
20-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:var
21-
; CHECK-NEXT: ldr x0, [x16]
22-
; CHECK-NEXT: cbz x0, .Lundef_weak0
23-
; CHECK-NEXT: autia x0, x16
27+
; CHECK: adrp x17, :got_auth:var
28+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:var
29+
; NOTRAP-NEXT: ldr x0, [x17]
30+
; NOTRAP-NEXT: cbz x0, .Lundef_weak0
31+
; NOTRAP-NEXT: autia x0, x17
32+
; TRAP-NEXT: ldr x16, [x17]
33+
; TRAP-NEXT: cbz x16, .Lundef_weak0
34+
; TRAP-NEXT: autia x16, x17
2435
; CHECK-NEXT: .Lundef_weak0:
36+
; TRAP-NEXT: mov x17, x16
37+
; TRAP-NEXT: xpaci x17
38+
; TRAP-NEXT: cmp x16, x17
39+
; TRAP-NEXT: b.eq .Lauth_success_0
40+
; TRAP-NEXT: brk #0xc470
41+
; TRAP-NEXT: .Lauth_success_0:
42+
; TRAP-NEXT: mov x0, x16
2543
; CHECK-NEXT: ret
2644
}
2745

@@ -32,12 +50,22 @@ define ptr @bar() {
3250
ret ptr %addr
3351

3452
; CHECK-LABEL: bar:
35-
; CHECK: adrp x16, :got_auth:arr_var
36-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:arr_var
37-
; CHECK-NEXT: ldr x8, [x16]
38-
; CHECK-NEXT: cbz x8, .Lundef_weak1
39-
; CHECK-NEXT: autda x8, x16
53+
; CHECK: adrp x17, :got_auth:arr_var
54+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:arr_var
55+
; NOTRAP-NEXT: ldr x8, [x17]
56+
; NOTRAP-NEXT: cbz x8, .Lundef_weak1
57+
; NOTRAP-NEXT: autda x8, x17
58+
; TRAP-NEXT: ldr x16, [x17]
59+
; TRAP-NEXT: cbz x16, .Lundef_weak1
60+
; TRAP-NEXT: autda x16, x17
4061
; CHECK-NEXT: .Lundef_weak1:
62+
; TRAP-NEXT: mov x17, x16
63+
; TRAP-NEXT: xpacd x17
64+
; TRAP-NEXT: cmp x16, x17
65+
; TRAP-NEXT: b.eq .Lauth_success_1
66+
; TRAP-NEXT: brk #0xc472
67+
; TRAP-NEXT: .Lauth_success_1:
68+
; TRAP-NEXT: mov x8, x16
4169
; CHECK-NEXT: add x0, x8, #20
4270
; CHECK-NEXT: ret
4371
}

llvm/test/CodeGen/AArch64/ptrauth-got-abuse.ll

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=0 -fast-isel=0 \
2-
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac -o - %s | FileCheck %s
2+
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac -o - %s | FileCheck --check-prefixes=CHECK,NOTRAP %s
3+
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=0 -fast-isel=0 \
4+
; RUN: -relocation-model=pic -mattr=+pauth -o - %s | FileCheck --check-prefixes=CHECK,TRAP %s
5+
6+
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=0 -fast-isel=1 \
7+
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac -o - %s | FileCheck --check-prefixes=CHECK,NOTRAP %s
38
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=0 -fast-isel=1 \
4-
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac -o - %s | FileCheck %s
9+
; RUN: -relocation-model=pic -mattr=+pauth -o - %s | FileCheck --check-prefixes=CHECK,TRAP %s
10+
11+
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=1 -global-isel-abort=1 \
12+
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac -o - %s | FileCheck --check-prefixes=CHECK,NOTRAP %s
513
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=1 -global-isel-abort=1 \
6-
; RUN: -relocation-model=pic -mattr=+pauth -mattr=+fpac -o - %s | FileCheck %s
14+
; RUN: -relocation-model=pic -mattr=+pauth -o - %s | FileCheck --check-prefixes=CHECK,TRAP %s
715

816
; RUN: llc -mtriple=aarch64-none-linux-gnu -asm-verbose=false -global-isel=0 -fast-isel=0 \
917
; RUN: -relocation-model=pic -filetype=obj -mattr=+pauth -o /dev/null %s
@@ -29,22 +37,49 @@ define void @foo() nounwind {
2937
; CHECK-LABEL: foo:
3038
entry:
3139
call void @consume(i32 ptrtoint (ptr @func to i32))
32-
; CHECK: adrp x16, :got_auth:func
33-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:func
34-
; CHECK-NEXT: ldr x[[TMP0:[0-9]+]], [x16]
35-
; CHECK-NEXT: autia x[[TMP0]], x16
40+
; CHECK: adrp x17, :got_auth:func
41+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:func
42+
; NOTRAP-NEXT: ldr x[[TMP0:[0-9]+]], [x17]
43+
; NOTRAP-NEXT: autia x[[TMP0]], x17
44+
; TRAP-NEXT: ldr x16, [x17]
45+
; TRAP-NEXT: autia x16, x17
46+
; TRAP-NEXT: mov x17, x16
47+
; TRAP-NEXT: xpaci x17
48+
; TRAP-NEXT: cmp x16, x17
49+
; TRAP-NEXT: b.eq .Lauth_success_0
50+
; TRAP-NEXT: brk #0xc470
51+
; TRAP-NEXT: .Lauth_success_0:
52+
; TRAP-NEXT: mov x[[TMP0:[0-9]+]], x16
3653

3754
call void @consume(i32 ptrtoint (ptr @alias_func to i32))
38-
; CHECK: adrp x16, :got_auth:alias_func
39-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:alias_func
40-
; CHECK-NEXT: ldr x[[TMP1:[0-9]+]], [x16]
41-
; CHECK-NEXT: autia x[[TMP1]], x16
55+
; CHECK: adrp x17, :got_auth:alias_func
56+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:alias_func
57+
; NOTRAP-NEXT: ldr x[[TMP1:[0-9]+]], [x17]
58+
; NOTRAP-NEXT: autia x[[TMP1]], x17
59+
; TRAP-NEXT: ldr x16, [x17]
60+
; TRAP-NEXT: autia x16, x17
61+
; TRAP-NEXT: mov x17, x16
62+
; TRAP-NEXT: xpaci x17
63+
; TRAP-NEXT: cmp x16, x17
64+
; TRAP-NEXT: b.eq .Lauth_success_1
65+
; TRAP-NEXT: brk #0xc470
66+
; TRAP-NEXT: .Lauth_success_1:
67+
; TRAP-NEXT: mov x[[TMP1:[0-9]+]], x16
4268

4369
call void @consume(i32 ptrtoint (ptr @alias_global to i32))
44-
; CHECK: adrp x16, :got_auth:alias_global
45-
; CHECK-NEXT: add x16, x16, :got_auth_lo12:alias_global
46-
; CHECK-NEXT: ldr x[[TMP2:[0-9]+]], [x16]
47-
; CHECK-NEXT: autda x[[TMP2]], x16
70+
; CHECK: adrp x17, :got_auth:alias_global
71+
; CHECK-NEXT: add x17, x17, :got_auth_lo12:alias_global
72+
; NOTRAP-NEXT: ldr x[[TMP2:[0-9]+]], [x17]
73+
; NOTRAP-NEXT: autda x[[TMP2]], x17
74+
; TRAP-NEXT: ldr x16, [x17]
75+
; TRAP-NEXT: autda x16, x17
76+
; TRAP-NEXT: mov x17, x16
77+
; TRAP-NEXT: xpacd x17
78+
; TRAP-NEXT: cmp x16, x17
79+
; TRAP-NEXT: b.eq .Lauth_success_2
80+
; TRAP-NEXT: brk #0xc472
81+
; TRAP-NEXT: .Lauth_success_2:
82+
; TRAP-NEXT: mov x[[TMP2:[0-9]+]], x16
4883

4984
ret void
5085
}

0 commit comments

Comments
 (0)