15
15
; sign-return-address.ll tests combinations of -mbranch-protection=none/pac-ret
16
16
; and whether +pauth-lr is present or not.
17
17
18
- ; sign-return-address-pauth-lr.ll is identical, with the addition of this module
18
+ ; sign-return-address-pauth-lr.ll is identical, with the addition of the function
19
19
; attribute, which enables -mbranch-protection=pac-ret+pc, and therefore tests
20
20
; the remaining parameter combinations in the table:
21
- !llvm.module.flags = !{!1 }
22
- !1 = !{i32 1 , !"branch-protection-pauth-lr" , i32 1 }
23
21
24
22
; RUN: llc -mtriple=aarch64 < %s | FileCheck --check-prefixes=CHECK,COMPAT %s
25
23
; RUN: llc -mtriple=aarch64 -mattr=v8.3a < %s | FileCheck --check-prefixes=CHECK,V83A %s
26
24
; RUN: llc -mtriple=aarch64 -mattr=v9a -mattr=pauth-lr < %s | FileCheck --check-prefixes=PAUTHLR %s
27
25
28
- define i32 @leaf (i32 %x ) {
26
+ define i32 @leaf (i32 %x ) "branch-protection-pauth-lr" = "true" {
29
27
; CHECK-LABEL: leaf:
30
28
; CHECK: // %bb.0:
31
29
; CHECK-NEXT: ret
@@ -36,7 +34,7 @@ define i32 @leaf(i32 %x) {
36
34
ret i32 %x
37
35
}
38
36
39
- define i32 @leaf_sign_none (i32 %x ) "sign-return-address" ="none" {
37
+ define i32 @leaf_sign_none (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="none" {
40
38
; CHECK-LABEL: leaf_sign_none:
41
39
; CHECK: // %bb.0:
42
40
; CHECK-NEXT: ret
@@ -47,7 +45,7 @@ define i32 @leaf_sign_none(i32 %x) "sign-return-address"="none" {
47
45
ret i32 %x
48
46
}
49
47
50
- define i32 @leaf_sign_non_leaf (i32 %x ) "sign-return-address" ="non-leaf" {
48
+ define i32 @leaf_sign_non_leaf (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="non-leaf" {
51
49
; CHECK-LABEL: leaf_sign_non_leaf:
52
50
; CHECK: // %bb.0:
53
51
; CHECK-NEXT: ret
@@ -58,7 +56,7 @@ define i32 @leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" {
58
56
ret i32 %x
59
57
}
60
58
61
- define i32 @leaf_sign_all (i32 %x ) "sign-return-address" ="all" {
59
+ define i32 @leaf_sign_all (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" {
62
60
; COMPAT-LABEL: leaf_sign_all:
63
61
; COMPAT: // %bb.0:
64
62
; COMPAT-NEXT: hint #39
@@ -89,7 +87,7 @@ define i32 @leaf_sign_all(i32 %x) "sign-return-address"="all" {
89
87
ret i32 %x
90
88
}
91
89
92
- define i64 @leaf_clobbers_lr (i64 %x ) "sign-return-address" ="non-leaf" {
90
+ define i64 @leaf_clobbers_lr (i64 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="non-leaf" {
93
91
; COMPAT-LABEL: leaf_clobbers_lr:
94
92
; COMPAT: // %bb.0:
95
93
; COMPAT-NEXT: hint #39
@@ -144,7 +142,7 @@ define i64 @leaf_clobbers_lr(i64 %x) "sign-return-address"="non-leaf" {
144
142
145
143
declare i32 @foo (i32 )
146
144
147
- define i32 @non_leaf_sign_all (i32 %x ) "sign-return-address" ="all" {
145
+ define i32 @non_leaf_sign_all (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" {
148
146
; COMPAT-LABEL: non_leaf_sign_all:
149
147
; COMPAT: // %bb.0:
150
148
; COMPAT-NEXT: hint #39
@@ -191,7 +189,7 @@ define i32 @non_leaf_sign_all(i32 %x) "sign-return-address"="all" {
191
189
ret i32 %call
192
190
}
193
191
194
- define i32 @non_leaf_sign_non_leaf (i32 %x ) "sign-return-address" ="non-leaf" {
192
+ define i32 @non_leaf_sign_non_leaf (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="non-leaf" {
195
193
; COMPAT-LABEL: non_leaf_sign_non_leaf:
196
194
; COMPAT: // %bb.0:
197
195
; COMPAT-NEXT: hint #39
@@ -239,7 +237,7 @@ define i32 @non_leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" {
239
237
}
240
238
241
239
; Should not use the RETAA instruction.
242
- define i32 @non_leaf_scs (i32 %x ) "sign-return-address" ="non-leaf" shadowcallstack "target-features" ="+v8.3a,+reserve-x18" {
240
+ define i32 @non_leaf_scs (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="non-leaf" shadowcallstack "target-features" ="+v8.3a,+reserve-x18" {
243
241
; CHECK-LABEL: non_leaf_scs:
244
242
; CHECK: // %bb.0:
245
243
; CHECK-NEXT: str x30, [x18], #8
@@ -278,7 +276,7 @@ define i32 @non_leaf_scs(i32 %x) "sign-return-address"="non-leaf" shadowcallstac
278
276
ret i32 %call
279
277
}
280
278
281
- define i32 @leaf_sign_all_v83 (i32 %x ) "sign-return-address" ="all" "target-features" ="+v8.3a" {
279
+ define i32 @leaf_sign_all_v83 (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "target-features" ="+v8.3a" {
282
280
; CHECK-LABEL: leaf_sign_all_v83:
283
281
; CHECK: // %bb.0:
284
282
; CHECK-NEXT: hint #39
@@ -300,7 +298,7 @@ define i32 @leaf_sign_all_v83(i32 %x) "sign-return-address"="all" "target-featur
300
298
301
299
declare fastcc i64 @bar (i64 )
302
300
303
- define fastcc void @spill_lr_and_tail_call (i64 %x ) "sign-return-address" ="all" {
301
+ define fastcc void @spill_lr_and_tail_call (i64 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" {
304
302
; COMPAT-LABEL: spill_lr_and_tail_call:
305
303
; COMPAT: // %bb.0:
306
304
; COMPAT-NEXT: hint #39
@@ -356,7 +354,7 @@ define fastcc void @spill_lr_and_tail_call(i64 %x) "sign-return-address"="all" {
356
354
ret void
357
355
}
358
356
359
- define i32 @leaf_sign_all_a_key (i32 %x ) "sign-return-address" ="all" "sign-return-address-key" ="a_key" {
357
+ define i32 @leaf_sign_all_a_key (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "sign-return-address-key" ="a_key" {
360
358
; COMPAT-LABEL: leaf_sign_all_a_key:
361
359
; COMPAT: // %bb.0:
362
360
; COMPAT-NEXT: hint #39
@@ -387,7 +385,7 @@ define i32 @leaf_sign_all_a_key(i32 %x) "sign-return-address"="all" "sign-return
387
385
ret i32 %x
388
386
}
389
387
390
- define i32 @leaf_sign_all_b_key (i32 %x ) "sign-return-address" ="all" "sign-return-address-key" ="b_key" {
388
+ define i32 @leaf_sign_all_b_key (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "sign-return-address-key" ="b_key" {
391
389
; COMPAT-LABEL: leaf_sign_all_b_key:
392
390
; COMPAT: // %bb.0:
393
391
; COMPAT-NEXT: .cfi_b_key_frame
@@ -421,7 +419,7 @@ define i32 @leaf_sign_all_b_key(i32 %x) "sign-return-address"="all" "sign-return
421
419
ret i32 %x
422
420
}
423
421
424
- define i32 @leaf_sign_all_v83_b_key (i32 %x ) "sign-return-address" ="all" "target-features" ="+v8.3a" "sign-return-address-key" ="b_key" {
422
+ define i32 @leaf_sign_all_v83_b_key (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "target-features" ="+v8.3a" "sign-return-address-key" ="b_key" {
425
423
; CHECK-LABEL: leaf_sign_all_v83_b_key:
426
424
; CHECK: // %bb.0:
427
425
; CHECK-NEXT: .cfi_b_key_frame
@@ -444,7 +442,7 @@ define i32 @leaf_sign_all_v83_b_key(i32 %x) "sign-return-address"="all" "target-
444
442
}
445
443
446
444
; Note that BTI instruction is not needed before PACIASP.
447
- define i32 @leaf_sign_all_a_key_bti (i32 %x ) "sign-return-address" ="all" "sign-return-address-key" ="a_key" "branch-target-enforcement" ="true" {
445
+ define i32 @leaf_sign_all_a_key_bti (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "sign-return-address-key" ="a_key" "branch-target-enforcement" ="true" {
448
446
; COMPAT-LABEL: leaf_sign_all_a_key_bti:
449
447
; COMPAT: // %bb.0:
450
448
; COMPAT-NEXT: hint #34
@@ -479,7 +477,7 @@ define i32 @leaf_sign_all_a_key_bti(i32 %x) "sign-return-address"="all" "sign-re
479
477
}
480
478
481
479
; Note that BTI instruction is not needed before PACIBSP.
482
- define i32 @leaf_sign_all_b_key_bti (i32 %x ) "sign-return-address" ="all" "sign-return-address-key" ="b_key" "branch-target-enforcement" ="true" {
480
+ define i32 @leaf_sign_all_b_key_bti (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "sign-return-address-key" ="b_key" "branch-target-enforcement" ="true" {
483
481
; COMPAT-LABEL: leaf_sign_all_b_key_bti:
484
482
; COMPAT: // %bb.0:
485
483
; COMPAT-NEXT: hint #34
@@ -517,7 +515,7 @@ define i32 @leaf_sign_all_b_key_bti(i32 %x) "sign-return-address"="all" "sign-re
517
515
}
518
516
519
517
; Note that BTI instruction is not needed before PACIBSP.
520
- define i32 @leaf_sign_all_v83_b_key_bti (i32 %x ) "sign-return-address" ="all" "target-features" ="+v8.3a" "sign-return-address-key" ="b_key" "branch-target-enforcement" ="true" {
518
+ define i32 @leaf_sign_all_v83_b_key_bti (i32 %x ) "branch-protection-pauth-lr" = "true" " sign-return-address" ="all" "target-features" ="+v8.3a" "sign-return-address-key" ="b_key" "branch-target-enforcement" ="true" {
521
519
; CHECK-LABEL: leaf_sign_all_v83_b_key_bti:
522
520
; CHECK: // %bb.0:
523
521
; CHECK-NEXT: hint #34
0 commit comments