Skip to content

Commit 054aa94

Browse files
Don't use module flags as function attr.
1 parent dfec4ef commit 054aa94

23 files changed

+64
-146
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -11580,15 +11580,10 @@ void SelectionDAGBuilder::lowerWorkItem(SwitchWorkListItem W, Value *Cond,
1158011580
if (FallthroughUnreachable) {
1158111581
Function &CurFunc = CurMF->getFunction();
1158211582
bool HasBranchTargetEnforcement = false;
11583-
if (CurFunc.hasFnAttribute("branch-target-enforcement")) {
11583+
if (CurFunc.hasFnAttribute("branch-target-enforcement"))
1158411584
HasBranchTargetEnforcement =
1158511585
CurFunc.getFnAttribute("branch-target-enforcement")
1158611586
.getValueAsBool();
11587-
} else {
11588-
HasBranchTargetEnforcement =
11589-
CurMF->getMMI().getModule()->getModuleFlag(
11590-
"branch-target-enforcement");
11591-
}
1159211587
if (!HasBranchTargetEnforcement)
1159311588
JTH->FallthroughUnreachable = true;
1159411589
}

llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp

+9-31
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,8 @@ static std::pair<bool, bool> GetSignReturnAddress(const Function &F) {
4141
// The function should be signed in the following situations:
4242
// - sign-return-address=all
4343
// - sign-return-address=non-leaf and the functions spills the LR
44-
if (!F.hasFnAttribute("sign-return-address")) {
45-
const Module &M = *F.getParent();
46-
if (const auto *Sign = mdconst::extract_or_null<ConstantInt>(
47-
M.getModuleFlag("sign-return-address"))) {
48-
if (Sign->getZExtValue()) {
49-
if (const auto *All = mdconst::extract_or_null<ConstantInt>(
50-
M.getModuleFlag("sign-return-address-all")))
51-
return {true, All->getZExtValue()};
52-
return {true, false};
53-
}
54-
}
44+
if (!F.hasFnAttribute("sign-return-address"))
5545
return {false, false};
56-
}
5746

5847
StringRef Scope = F.getFnAttribute("sign-return-address").getValueAsString();
5948
if (Scope.equals("none"))
@@ -68,9 +57,6 @@ static std::pair<bool, bool> GetSignReturnAddress(const Function &F) {
6857

6958
static bool ShouldSignWithBKey(const Function &F, const AArch64Subtarget &STI) {
7059
if (!F.hasFnAttribute("sign-return-address-key")) {
71-
if (const auto *BKey = mdconst::extract_or_null<ConstantInt>(
72-
F.getParent()->getModuleFlag("sign-return-address-with-bkey")))
73-
return BKey->getZExtValue();
7460
if (STI.getTargetTriple().isOSWindows())
7561
return true;
7662
return false;
@@ -93,24 +79,16 @@ AArch64FunctionInfo::AArch64FunctionInfo(const Function &F,
9379
// TODO: skip functions that have no instrumented allocas for optimization
9480
IsMTETagged = F.hasFnAttribute(Attribute::SanitizeMemTag);
9581

96-
// BTI/PAuthLR may be set either on the function or the module. Set Bool from
97-
// either the function attribute or module attribute, depending on what is
98-
// set.
99-
// Note: the module attributed is numeric (0 or 1) but the function attribute
100-
// is stringy ("true" or "false").
101-
auto TryFnThenModule = [&](StringRef AttrName, bool &Bool) {
102-
if (F.hasFnAttribute(AttrName)) {
103-
const StringRef V = F.getFnAttribute(AttrName).getValueAsString();
104-
assert(V.equals_insensitive("true") || V.equals_insensitive("false"));
105-
Bool = V.equals_insensitive("true");
106-
} else if (const auto *ModVal = mdconst::extract_or_null<ConstantInt>(
107-
F.getParent()->getModuleFlag(AttrName))) {
108-
Bool = ModVal->getZExtValue();
109-
}
82+
// BTI/PAuthLR are set on the function attribute.
83+
auto TryFnAttr = [&](StringRef AttrName) -> bool {
84+
if (F.hasFnAttribute(AttrName))
85+
return F.getFnAttribute(AttrName).getValueAsBool();
86+
else
87+
return false;
11088
};
11189

112-
TryFnThenModule("branch-target-enforcement", BranchTargetEnforcement);
113-
TryFnThenModule("branch-protection-pauth-lr", BranchProtectionPAuthLR);
90+
BranchTargetEnforcement = TryFnAttr("branch-target-enforcement");
91+
BranchProtectionPAuthLR = TryFnAttr("branch-protection-pauth-lr");
11492

11593
// The default stack probe size is 4096 if the function has no
11694
// stack-probe-size attribute. This is a safe default because it is the

llvm/lib/Target/ARM/ARMMachineFunctionInfo.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ static bool GetBranchTargetEnforcement(const Function &F,
3030
if (!Subtarget->isMClass() || !Subtarget->hasV7Ops())
3131
return false;
3232

33-
if (!F.hasFnAttribute("branch-target-enforcement")) {
34-
if (const auto *BTE = mdconst::extract_or_null<ConstantInt>(
35-
F.getParent()->getModuleFlag("branch-target-enforcement")))
36-
return BTE->getZExtValue();
33+
if (!F.hasFnAttribute("branch-target-enforcement"))
3734
return false;
38-
}
3935

4036
const StringRef BTIEnable =
4137
F.getFnAttribute("branch-target-enforcement").getValueAsString();

llvm/test/CodeGen/AArch64/kcfi-bti.ll

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
; RUN: llc -mtriple=aarch64-- -verify-machineinstrs -stop-after=kcfi < %s | FileCheck %s --check-prefixes=MIR,KCFI
44

55
; ASM: .word 12345678
6-
define void @f1(ptr noundef %x) !kcfi_type !2 {
6+
define void @f1(ptr noundef %x) #1 !kcfi_type !2 {
77
; ASM-LABEL: f1:
88
; ASM: // %bb.0:
99
; ASM: ldur w16, [x0, #-4]
@@ -30,7 +30,7 @@ define void @f1(ptr noundef %x) !kcfi_type !2 {
3030
}
3131

3232
; ASM: .word 12345678
33-
define void @f2(ptr noundef %x) !kcfi_type !2 {
33+
define void @f2(ptr noundef %x) #1 !kcfi_type !2 {
3434
; ASM-LABEL: f2:
3535
; ASM: // %bb.0:
3636
; ASM: ldur w16, [x0, #-4]
@@ -58,7 +58,7 @@ define void @f2(ptr noundef %x) !kcfi_type !2 {
5858
}
5959

6060
; ASM-NOT: .word:
61-
define void @f3(ptr noundef %x) {
61+
define void @f3(ptr noundef %x) #1 {
6262
; ASM-LABEL: f3:
6363
; ASM: // %bb.0:
6464
; ASM: ldur w9, [x16, #-4]
@@ -85,6 +85,7 @@ define void @f3(ptr noundef %x) {
8585
}
8686

8787
attributes #0 = { returns_twice }
88+
attributes #1 = { "branch-target-enforcement"="true" }
8889

8990
!llvm.module.flags = !{!0, !1}
9091
!0 = !{i32 8, !"branch-target-enforcement", i32 1}

llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-1.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ entry:
1414
declare void @__asan_init()
1515
declare void @__asan_version_mismatch_check_v8()
1616

17-
define internal void @asan.module_ctor() {
17+
define internal void @asan.module_ctor() #0 {
1818
call void @__asan_init()
1919
call void @__asan_version_mismatch_check_v8()
2020
ret void

llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-2.ll

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ entry:
5858
;; CHECK-NEXT: .cfi_negate_ra_state
5959

6060
attributes #0 = { norecurse nounwind readnone "sign-return-address"="all" "sign-return-address-key"="b_key" }
61-
attributes #1 = { noinline }
62-
attributes #2 = { nofree noinline norecurse nounwind writeonly }
61+
attributes #1 = { noinline "sign-return-address"="all" "sign-return-address-key"="b_key" }
62+
attributes #2 = { nofree noinline norecurse nounwind writeonly "sign-return-address"="all" "sign-return-address-key"="b_key" }
6363

6464
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5}
6565

llvm/test/CodeGen/AArch64/pacbti-module-attrs.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ attributes #1 = { nounwind "branch-target-enforcement"="true" "sign-return-addr
6666
attributes #2 = { nounwind "branch-target-enforcement"="false" "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" }
6767
attributes #3 = { nounwind "branch-target-enforcement"="false" "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" }
6868
attributes #4 = { nounwind "branch-target-enforcement"="false" "sign-return-address"="all" "sign-return-address-key"="a_key" }
69-
attributes #5 = { nounwind }
69+
attributes #5 = { nounwind "branch-target-enforcement"="true" "sign-return-address"="all" "sign-return-address-key"="a_key" }
7070

7171
!llvm.module.flags = !{!0, !1, !2, !3, !4}
7272

llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll

+6-9
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
; return 2 + a * (a + b) / (c + d);
2828
; }
2929

30-
define i32 @f(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) {
30+
define i32 @f(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) #0 {
3131
; BTI-LABEL: f:
3232
; BTI: bl OUTLINED_FUNCTION_1
3333
; BTI-NEXT: bl setjmp
@@ -39,7 +39,7 @@ define i32 @f(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) {
3939
; NOBTI-NEXT: bl OUTLINED_FUNCTION_1
4040

4141
entry:
42-
%call = call i32 @setjmp(ptr noundef null) #0
42+
%call = call i32 @setjmp(ptr noundef null) #1
4343
%add = add nsw i32 %b, %a
4444
%mul = mul nsw i32 %add, %a
4545
%add1 = add nsw i32 %d, %c
@@ -50,7 +50,7 @@ entry:
5050

5151
declare i32 @setjmp(ptr noundef) #0
5252

53-
define i32 @g(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) {
53+
define i32 @g(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) #0 {
5454
; BTI-LABEL: g:
5555
; BTI: bl OUTLINED_FUNCTION_1
5656
; BTI-NEXT: bl setjmp
@@ -62,7 +62,7 @@ define i32 @g(i32 noundef %a, i32 noundef %b, i32 noundef %c, i32 noundef %d) {
6262
; NOBTI-NEXT: bl OUTLINED_FUNCTION_1
6363

6464
entry:
65-
%call = call i32 @setjmp(ptr noundef null) #0
65+
%call = call i32 @setjmp(ptr noundef null) #1
6666
%add = add nsw i32 %b, %a
6767
%mul = mul nsw i32 %add, %a
6868
%add1 = add nsw i32 %d, %c
@@ -76,8 +76,5 @@ entry:
7676
; NOBTI: OUTLINED_FUNCTION_1:
7777
; NOBTI-LABEL: ret
7878

79-
attributes #0 = { returns_twice }
80-
81-
!llvm.module.flags = !{!0}
82-
83-
!0 = !{i32 8, !"branch-target-enforcement", i32 1}
79+
attributes #0 = { "branch-target-enforcement"="true" }
80+
attributes #1 = { returns_twice }

llvm/test/CodeGen/AArch64/setjmp-bti.ll

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
; notsetjmp();
2525
; }
2626

27-
define void @bbb() {
27+
define void @bbb() #1 {
2828
; BTI-LABEL: bbb:
2929
; BTI: bl setjmp
3030
; BTI-NEXT: hint #36
@@ -72,6 +72,4 @@ declare i32 @setjmp(ptr noundef) #0
7272
declare void @notsetjmp()
7373

7474
attributes #0 = { returns_twice }
75-
76-
!llvm.module.flags = !{!0}
77-
!0 = !{i32 8, !"branch-target-enforcement", i32 1}
75+
attributes #1 = { "branch-target-enforcement"="true" }

llvm/test/CodeGen/AArch64/sign-return-address-pauth-lr.ll

+17-19
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@
1515
; sign-return-address.ll tests combinations of -mbranch-protection=none/pac-ret
1616
; and whether +pauth-lr is present or not.
1717

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
1919
; attribute, which enables -mbranch-protection=pac-ret+pc, and therefore tests
2020
; the remaining parameter combinations in the table:
21-
!llvm.module.flags = !{!1}
22-
!1 = !{i32 1, !"branch-protection-pauth-lr", i32 1}
2321

2422
; RUN: llc -mtriple=aarch64 < %s | FileCheck --check-prefixes=CHECK,COMPAT %s
2523
; RUN: llc -mtriple=aarch64 -mattr=v8.3a < %s | FileCheck --check-prefixes=CHECK,V83A %s
2624
; RUN: llc -mtriple=aarch64 -mattr=v9a -mattr=pauth-lr < %s | FileCheck --check-prefixes=PAUTHLR %s
2725

28-
define i32 @leaf(i32 %x) {
26+
define i32 @leaf(i32 %x) "branch-protection-pauth-lr"="true" {
2927
; CHECK-LABEL: leaf:
3028
; CHECK: // %bb.0:
3129
; CHECK-NEXT: ret
@@ -36,7 +34,7 @@ define i32 @leaf(i32 %x) {
3634
ret i32 %x
3735
}
3836

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" {
4038
; CHECK-LABEL: leaf_sign_none:
4139
; CHECK: // %bb.0:
4240
; CHECK-NEXT: ret
@@ -47,7 +45,7 @@ define i32 @leaf_sign_none(i32 %x) "sign-return-address"="none" {
4745
ret i32 %x
4846
}
4947

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" {
5149
; CHECK-LABEL: leaf_sign_non_leaf:
5250
; CHECK: // %bb.0:
5351
; CHECK-NEXT: ret
@@ -58,7 +56,7 @@ define i32 @leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" {
5856
ret i32 %x
5957
}
6058

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" {
6260
; COMPAT-LABEL: leaf_sign_all:
6361
; COMPAT: // %bb.0:
6462
; COMPAT-NEXT: hint #39
@@ -89,7 +87,7 @@ define i32 @leaf_sign_all(i32 %x) "sign-return-address"="all" {
8987
ret i32 %x
9088
}
9189

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" {
9391
; COMPAT-LABEL: leaf_clobbers_lr:
9492
; COMPAT: // %bb.0:
9593
; COMPAT-NEXT: hint #39
@@ -144,7 +142,7 @@ define i64 @leaf_clobbers_lr(i64 %x) "sign-return-address"="non-leaf" {
144142

145143
declare i32 @foo(i32)
146144

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" {
148146
; COMPAT-LABEL: non_leaf_sign_all:
149147
; COMPAT: // %bb.0:
150148
; COMPAT-NEXT: hint #39
@@ -191,7 +189,7 @@ define i32 @non_leaf_sign_all(i32 %x) "sign-return-address"="all" {
191189
ret i32 %call
192190
}
193191

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" {
195193
; COMPAT-LABEL: non_leaf_sign_non_leaf:
196194
; COMPAT: // %bb.0:
197195
; COMPAT-NEXT: hint #39
@@ -239,7 +237,7 @@ define i32 @non_leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf" {
239237
}
240238

241239
; 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" {
243241
; CHECK-LABEL: non_leaf_scs:
244242
; CHECK: // %bb.0:
245243
; CHECK-NEXT: str x30, [x18], #8
@@ -278,7 +276,7 @@ define i32 @non_leaf_scs(i32 %x) "sign-return-address"="non-leaf" shadowcallstac
278276
ret i32 %call
279277
}
280278

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" {
282280
; CHECK-LABEL: leaf_sign_all_v83:
283281
; CHECK: // %bb.0:
284282
; CHECK-NEXT: hint #39
@@ -300,7 +298,7 @@ define i32 @leaf_sign_all_v83(i32 %x) "sign-return-address"="all" "target-featur
300298

301299
declare fastcc i64 @bar(i64)
302300

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" {
304302
; COMPAT-LABEL: spill_lr_and_tail_call:
305303
; COMPAT: // %bb.0:
306304
; COMPAT-NEXT: hint #39
@@ -356,7 +354,7 @@ define fastcc void @spill_lr_and_tail_call(i64 %x) "sign-return-address"="all" {
356354
ret void
357355
}
358356

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" {
360358
; COMPAT-LABEL: leaf_sign_all_a_key:
361359
; COMPAT: // %bb.0:
362360
; COMPAT-NEXT: hint #39
@@ -387,7 +385,7 @@ define i32 @leaf_sign_all_a_key(i32 %x) "sign-return-address"="all" "sign-return
387385
ret i32 %x
388386
}
389387

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" {
391389
; COMPAT-LABEL: leaf_sign_all_b_key:
392390
; COMPAT: // %bb.0:
393391
; 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
421419
ret i32 %x
422420
}
423421

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" {
425423
; CHECK-LABEL: leaf_sign_all_v83_b_key:
426424
; CHECK: // %bb.0:
427425
; 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-
444442
}
445443

446444
; 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" {
448446
; COMPAT-LABEL: leaf_sign_all_a_key_bti:
449447
; COMPAT: // %bb.0:
450448
; COMPAT-NEXT: hint #34
@@ -479,7 +477,7 @@ define i32 @leaf_sign_all_a_key_bti(i32 %x) "sign-return-address"="all" "sign-re
479477
}
480478

481479
; 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"{
483481
; COMPAT-LABEL: leaf_sign_all_b_key_bti:
484482
; COMPAT: // %bb.0:
485483
; COMPAT-NEXT: hint #34
@@ -517,7 +515,7 @@ define i32 @leaf_sign_all_b_key_bti(i32 %x) "sign-return-address"="all" "sign-re
517515
}
518516

519517
; 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" {
521519
; CHECK-LABEL: leaf_sign_all_v83_b_key_bti:
522520
; CHECK: // %bb.0:
523521
; CHECK-NEXT: hint #34

llvm/test/CodeGen/AArch64/wineh-bti.ll

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: llc < %s -mtriple=aarch64-windows -aarch64-min-jump-table-entries=4 | FileCheck %s
22

3-
define dso_local i32 @func(i32 %in) {
3+
define dso_local i32 @func(i32 %in) "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" "branch-target-enforcement"="true" {
44
entry:
55
call void asm sideeffect "", "~{x19}"()
66
switch i32 %in, label %def [
@@ -27,11 +27,6 @@ lbl4:
2727
ret i32 8
2828
}
2929

30-
!llvm.module.flags = !{!0, !1}
31-
32-
!0 = !{i32 8, !"branch-target-enforcement", i32 1}
33-
!1 = !{i32 8, !"sign-return-address", i32 1}
34-
3530
; CHECK-LABEL: func:
3631
; CHECK-NEXT: .seh_proc func
3732
; CHECK-NEXT: // %bb.0:

0 commit comments

Comments
 (0)