[llvm] b0343a3 - Support the min of module flags when linking, use for AArch64 BTI/PAC-RET
Daniel Kiss via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 00:31:59 PDT 2022
Author: Daniel Kiss
Date: 2022-04-13T09:31:51+02:00
New Revision: b0343a38a5910e980bb031e4014655d77cd0c162
URL: https://github.com/llvm/llvm-project/commit/b0343a38a5910e980bb031e4014655d77cd0c162
DIFF: https://github.com/llvm/llvm-project/commit/b0343a38a5910e980bb031e4014655d77cd0c162.diff
LOG: Support the min of module flags when linking, use for AArch64 BTI/PAC-RET
LTO objects might compiled with different `mbranch-protection` flags which will cause an error in the linker.
Such a setup is allowed in the normal build with this change that is possible.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D123493
Added:
llvm/test/Bitcode/upgrade-branch-protection.ll
llvm/test/LTO/AArch64/Inputs/foo.ll
llvm/test/LTO/AArch64/link-branch-target-enforcement.ll
llvm/test/LTO/AArch64/lit.local.cfg
Modified:
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/aarch64-sign-return-address.c
clang/test/CodeGen/arm-branch-protection-attr-2.c
clang/test/Frontend/arm-ignore-branch-protection-option.c
llvm/include/llvm/IR/Module.h
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Linker/IRMover.cpp
llvm/test/CodeGen/AArch64/debug-info-sve-dbg-declare.mir
llvm/test/CodeGen/AArch64/live-debugvalues-sve.mir
llvm/test/CodeGen/AArch64/memsize-remarks.ll
llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-0.ll
llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-1.ll
llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-2.ll
llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-3.ll
llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-4.ll
llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-2.ll
llvm/test/CodeGen/AArch64/pacbti-module-attrs.ll
llvm/test/CodeGen/AArch64/setjmp-bti-no-enforcement.ll
llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll
llvm/test/CodeGen/AArch64/setjmp-bti.ll
llvm/test/CodeGen/ARM/pacbti-module-attrs.ll
llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll
llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-vpt-debug.mir
llvm/test/CodeGen/Thumb2/bti-const-island-multiple-jump-tables.mir
llvm/test/CodeGen/Thumb2/bti-const-island.mir
llvm/test/CodeGen/Thumb2/bti-entry-blocks.ll
llvm/test/CodeGen/Thumb2/bti-indirect-branches.ll
llvm/test/CodeGen/Thumb2/bti-jump-table.mir
llvm/test/CodeGen/Thumb2/bti-outliner-1.ll
llvm/test/CodeGen/Thumb2/bti-outliner-2.ll
llvm/test/CodeGen/Thumb2/bti-outliner-cost-1.ll
llvm/test/CodeGen/Thumb2/bti-outliner-cost-2.ll
llvm/test/CodeGen/Thumb2/bti-pac-replace-1.mir
llvm/test/CodeGen/Thumb2/bti-pac-replace-2.ll
llvm/test/CodeGen/Thumb2/pacbti-m-basic.ll
llvm/test/CodeGen/Thumb2/pacbti-m-indirect-tail-call.ll
llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll
llvm/test/CodeGen/Thumb2/pacbti-m-outliner-2.ll
llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
llvm/test/CodeGen/Thumb2/pacbti-m-outliner-4.ll
llvm/test/CodeGen/Thumb2/pacbti-m-outliner-5.ll
llvm/test/CodeGen/Thumb2/pacbti-m-overalign.ll
llvm/test/CodeGen/Thumb2/pacbti-m-unsupported-arch.ll
llvm/test/CodeGen/Thumb2/pacbti-m-varargs-1.ll
llvm/test/CodeGen/Thumb2/pacbti-m-varargs-2.ll
llvm/test/CodeGen/Thumb2/pacbti-m-vla.ll
llvm/test/DebugInfo/AArch64/debugline-endsequence.ll
llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll
llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll
llvm/test/Verifier/module-flags-1.ll
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 4efcc8447d81b..b251a4a7df3d2 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -729,7 +729,10 @@ void CodeGenModule::Release() {
// attributes, but we use module metadata to emit build attributes. This is
// needed for LTO, where the function attributes are inside bitcode
// serialised into a global variable by the time build attributes are
- // emitted, so we can't access them.
+ // emitted, so we can't access them. LTO objects could be compiled with
+ //
diff erent flags therefore module flags are set to "Min" behavior to achieve
+ // the same end result of the normal build where e.g BTI is off if any object
+ // doesn't support it.
if (Context.getTargetInfo().hasFeature("ptrauth") &&
LangOpts.getSignReturnAddressScope() !=
LangOptions::SignReturnAddressScopeKind::None)
@@ -743,16 +746,16 @@ void CodeGenModule::Release() {
Arch == llvm::Triple::arm || Arch == llvm::Triple::armeb ||
Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_32 ||
Arch == llvm::Triple::aarch64_be) {
- getModule().addModuleFlag(llvm::Module::Error, "branch-target-enforcement",
+ getModule().addModuleFlag(llvm::Module::Min, "branch-target-enforcement",
LangOpts.BranchTargetEnforcement);
- getModule().addModuleFlag(llvm::Module::Error, "sign-return-address",
+ getModule().addModuleFlag(llvm::Module::Min, "sign-return-address",
LangOpts.hasSignReturnAddress());
- getModule().addModuleFlag(llvm::Module::Error, "sign-return-address-all",
+ getModule().addModuleFlag(llvm::Module::Min, "sign-return-address-all",
LangOpts.isSignReturnAddressScopeAll());
- getModule().addModuleFlag(llvm::Module::Error,
+ getModule().addModuleFlag(llvm::Module::Min,
"sign-return-address-with-bkey",
!LangOpts.isSignReturnAddressWithAKey());
}
diff --git a/clang/test/CodeGen/aarch64-sign-return-address.c b/clang/test/CodeGen/aarch64-sign-return-address.c
index 7dd7231e824ac..9812238dcded1 100644
--- a/clang/test/CodeGen/aarch64-sign-return-address.c
+++ b/clang/test/CodeGen/aarch64-sign-return-address.c
@@ -19,28 +19,28 @@
// Check module attributes
-// NONE: !{i32 1, !"branch-target-enforcement", i32 0}
-// ALL: !{i32 1, !"branch-target-enforcement", i32 0}
-// PART: !{i32 1, !"branch-target-enforcement", i32 0}
-// BTE: !{i32 1, !"branch-target-enforcement", i32 1}
-// B-KEY: !{i32 1, !"branch-target-enforcement", i32 0}
-
-// NONE: !{i32 1, !"sign-return-address", i32 0}
-// ALL: !{i32 1, !"sign-return-address", i32 1}
-// PART: !{i32 1, !"sign-return-address", i32 1}
-// BTE: !{i32 1, !"sign-return-address", i32 0}
-// B-KEY: !{i32 1, !"sign-return-address", i32 1}
-
-// NONE: !{i32 1, !"sign-return-address-all", i32 0}
-// ALL: !{i32 1, !"sign-return-address-all", i32 1}
-// PART: !{i32 1, !"sign-return-address-all", i32 0}
-// BTE: !{i32 1, !"sign-return-address-all", i32 0}
-// B-KEY: !{i32 1, !"sign-return-address-all", i32 0}
-
-// NONE: !{i32 1, !"sign-return-address-with-bkey", i32 0}
-// ALL: !{i32 1, !"sign-return-address-with-bkey", i32 0}
-// PART: !{i32 1, !"sign-return-address-with-bkey", i32 0}
-// BTE: !{i32 1, !"sign-return-address-with-bkey", i32 0}
-// B-KEY: !{i32 1, !"sign-return-address-with-bkey", i32 1}
+// NONE: !{i32 8, !"branch-target-enforcement", i32 0}
+// ALL: !{i32 8, !"branch-target-enforcement", i32 0}
+// PART: !{i32 8, !"branch-target-enforcement", i32 0}
+// BTE: !{i32 8, !"branch-target-enforcement", i32 1}
+// B-KEY: !{i32 8, !"branch-target-enforcement", i32 0}
+
+// NONE: !{i32 8, !"sign-return-address", i32 0}
+// ALL: !{i32 8, !"sign-return-address", i32 1}
+// PART: !{i32 8, !"sign-return-address", i32 1}
+// BTE: !{i32 8, !"sign-return-address", i32 0}
+// B-KEY: !{i32 8, !"sign-return-address", i32 1}
+
+// NONE: !{i32 8, !"sign-return-address-all", i32 0}
+// ALL: !{i32 8, !"sign-return-address-all", i32 1}
+// PART: !{i32 8, !"sign-return-address-all", i32 0}
+// BTE: !{i32 8, !"sign-return-address-all", i32 0}
+// B-KEY: !{i32 8, !"sign-return-address-all", i32 0}
+
+// NONE: !{i32 8, !"sign-return-address-with-bkey", i32 0}
+// ALL: !{i32 8, !"sign-return-address-with-bkey", i32 0}
+// PART: !{i32 8, !"sign-return-address-with-bkey", i32 0}
+// BTE: !{i32 8, !"sign-return-address-with-bkey", i32 0}
+// B-KEY: !{i32 8, !"sign-return-address-with-bkey", i32 1}
void foo() {}
diff --git a/clang/test/CodeGen/arm-branch-protection-attr-2.c b/clang/test/CodeGen/arm-branch-protection-attr-2.c
index 18a15b8534b50..963059441d76e 100644
--- a/clang/test/CodeGen/arm-branch-protection-attr-2.c
+++ b/clang/test/CodeGen/arm-branch-protection-attr-2.c
@@ -15,19 +15,19 @@
// Check module attributes
-// NONE: !{i32 1, !"branch-target-enforcement", i32 0}
-// PART: !{i32 1, !"branch-target-enforcement", i32 0}
-// ALL: !{i32 1, !"branch-target-enforcement", i32 0}
-// BTE: !{i32 1, !"branch-target-enforcement", i32 1}
-
-// NONE: !{i32 1, !"sign-return-address", i32 0}
-// PART: !{i32 1, !"sign-return-address", i32 1}
-// ALL: !{i32 1, !"sign-return-address", i32 1}
-// BTE: !{i32 1, !"sign-return-address", i32 0}
-
-// NONE: !{i32 1, !"sign-return-address-all", i32 0}
-// PART: !{i32 1, !"sign-return-address-all", i32 0}
-// ALL: !{i32 1, !"sign-return-address-all", i32 1}
-// BTE: !{i32 1, !"sign-return-address-all", i32 0}
+// NONE: !{i32 8, !"branch-target-enforcement", i32 0}
+// PART: !{i32 8, !"branch-target-enforcement", i32 0}
+// ALL: !{i32 8, !"branch-target-enforcement", i32 0}
+// BTE: !{i32 8, !"branch-target-enforcement", i32 1}
+
+// NONE: !{i32 8, !"sign-return-address", i32 0}
+// PART: !{i32 8, !"sign-return-address", i32 1}
+// ALL: !{i32 8, !"sign-return-address", i32 1}
+// BTE: !{i32 8, !"sign-return-address", i32 0}
+
+// NONE: !{i32 8, !"sign-return-address-all", i32 0}
+// PART: !{i32 8, !"sign-return-address-all", i32 0}
+// ALL: !{i32 8, !"sign-return-address-all", i32 1}
+// BTE: !{i32 8, !"sign-return-address-all", i32 0}
void foo() {}
diff --git a/clang/test/Frontend/arm-ignore-branch-protection-option.c b/clang/test/Frontend/arm-ignore-branch-protection-option.c
index 9a7c0aca25d3c..99a2accef3ae2 100644
--- a/clang/test/Frontend/arm-ignore-branch-protection-option.c
+++ b/clang/test/Frontend/arm-ignore-branch-protection-option.c
@@ -15,4 +15,4 @@ __attribute__((target("arch=cortex-m0"))) void f() {}
// CHECK-NOT: attributes { {{.*}} "branch-target-enforcement"
/// Check that there are branch protection module attributes despite the warning.
-// CHECK: !{i32 1, !"branch-target-enforcement", i32 1}
+// CHECK: !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 0414adfaee4d3..6cad37f4fe0ec 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -146,9 +146,12 @@ class LLVM_EXTERNAL_VISIBILITY Module {
/// Takes the max of the two values, which are required to be integers.
Max = 7,
+ /// Takes the min of the two values, which are required to be integers.
+ Min = 8,
+
// Markers:
ModFlagBehaviorFirstVal = Error,
- ModFlagBehaviorLastVal = Max
+ ModFlagBehaviorLastVal = Min
};
/// Checks if Metadata represents a valid ModFlagBehavior, and stores the
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index a8547354f77c7..b268fad8cd300 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -4388,6 +4388,24 @@ bool llvm::UpgradeModuleFlags(Module &M) {
}
}
}
+
+ // Upgrade branch protection and return address signing module flags. The
+ // module flag behavior for these fields were Error and now they are Min.
+ if (ID->getString() == "branch-target-enforcement" ||
+ ID->getString().startswith("sign-return-address")) {
+ if (auto *Behavior =
+ mdconst::dyn_extract_or_null<ConstantInt>(Op->getOperand(0))) {
+ if (Behavior->getLimitedValue() == Module::Error) {
+ Type *Int32Ty = Type::getInt32Ty(M.getContext());
+ Metadata *Ops[3] = {
+ ConstantAsMetadata::get(ConstantInt::get(Int32Ty, Module::Min)),
+ Op->getOperand(1), Op->getOperand(2)};
+ ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops));
+ Changed = true;
+ }
+ }
+ }
+
// Upgrade Objective-C Image Info Section. Removed the whitespce in the
// section name so that llvm-lto will not complain about mismatching
// module flags that is functionally the same.
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index dc7b979823175..09d47954c05e7 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1623,6 +1623,13 @@ Verifier::visitModuleFlag(const MDNode *Op,
// These behavior types accept any value.
break;
+ case Module::Min: {
+ Check(mdconst::dyn_extract_or_null<ConstantInt>(Op->getOperand(2)),
+ "invalid value for 'min' module flag (expected constant integer)",
+ Op->getOperand(2));
+ break;
+ }
+
case Module::Max: {
Check(mdconst::dyn_extract_or_null<ConstantInt>(Op->getOperand(2)),
"invalid value for 'max' module flag (expected constant integer)",
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 1a5363d44af86..05b71d1f3cb89 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -12,6 +12,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DiagnosticPrinter.h"
@@ -1256,6 +1257,9 @@ Error IRLinker::linkModuleFlagsMetadata() {
if (!SrcModFlags)
return Error::success();
+ // Check for module flag for updates before do anything.
+ UpgradeModuleFlags(*SrcM);
+
// If the destination module doesn't have module flags yet, then just copy
// over the source module's flags.
NamedMDNode *DstModFlags = DstM.getOrInsertModuleFlagsMetadata();
@@ -1338,11 +1342,15 @@ Error IRLinker::linkModuleFlagsMetadata() {
// Diagnose inconsistent merge behavior types.
if (SrcBehaviorValue != DstBehaviorValue) {
+ bool MinAndWarn = (SrcBehaviorValue == Module::Min &&
+ DstBehaviorValue == Module::Warning) ||
+ (DstBehaviorValue == Module::Min &&
+ SrcBehaviorValue == Module::Warning);
bool MaxAndWarn = (SrcBehaviorValue == Module::Max &&
DstBehaviorValue == Module::Warning) ||
(DstBehaviorValue == Module::Max &&
SrcBehaviorValue == Module::Warning);
- if (!MaxAndWarn)
+ if (!(MaxAndWarn || MinAndWarn))
return stringErr("linking module flags '" + ID->getString() +
"': IDs have conflicting behaviors in '" +
SrcM->getModuleIdentifier() + "' and '" +
@@ -1371,6 +1379,25 @@ Error IRLinker::linkModuleFlagsMetadata() {
emitWarning(Str);
}
+ // Choose the minimum if either source or destination request Min behavior.
+ if (DstBehaviorValue == Module::Min || SrcBehaviorValue == Module::Min) {
+ ConstantInt *DstValue =
+ mdconst::extract<ConstantInt>(DstOp->getOperand(2));
+ ConstantInt *SrcValue =
+ mdconst::extract<ConstantInt>(SrcOp->getOperand(2));
+
+ // The resulting flag should have a Min behavior, and contain the minimum
+ // value from between the source and destination values.
+ Metadata *FlagOps[] = {
+ (DstBehaviorValue != Module::Min ? SrcOp : DstOp)->getOperand(0), ID,
+ (SrcValue->getZExtValue() < DstValue->getZExtValue() ? SrcOp : DstOp)
+ ->getOperand(2)};
+ MDNode *Flag = MDNode::get(DstM.getContext(), FlagOps);
+ DstModFlags->setOperand(DstIndex, Flag);
+ Flags[ID].first = Flag;
+ continue;
+ }
+
// Choose the maximum if either source or destination request Max behavior.
if (DstBehaviorValue == Module::Max || SrcBehaviorValue == Module::Max) {
ConstantInt *DstValue =
diff --git a/llvm/test/Bitcode/upgrade-branch-protection.ll b/llvm/test/Bitcode/upgrade-branch-protection.ll
new file mode 100644
index 0000000000000..1b33e3901198e
--- /dev/null
+++ b/llvm/test/Bitcode/upgrade-branch-protection.ll
@@ -0,0 +1,16 @@
+;; Test that module flags "branch-target-enforcement" and "sign-return-address" can be upgraded to
+;; are upgraded from Error to Min.
+
+; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s
+
+!llvm.module.flags = !{!0, !1, !2, !3}
+
+!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!1 = !{i32 1, !"sign-return-address", i32 1}
+!2 = !{i32 1, !"sign-return-address-all", i32 1}
+!3 = !{i32 1, !"sign-return-address-with-bkey", i32 1}
+
+;CHECK: !0 = !{i32 8, !"branch-target-enforcement", i32 1}
+;CHECK: !1 = !{i32 8, !"sign-return-address", i32 1}
+;CHECK: !2 = !{i32 8, !"sign-return-address-all", i32 1}
+;CHECK: !3 = !{i32 8, !"sign-return-address-with-bkey", i32 1}
\ No newline at end of file
diff --git a/llvm/test/CodeGen/AArch64/debug-info-sve-dbg-declare.mir b/llvm/test/CodeGen/AArch64/debug-info-sve-dbg-declare.mir
index 81b3c6d9092c5..22cff36afaf7f 100644
--- a/llvm/test/CodeGen/AArch64/debug-info-sve-dbg-declare.mir
+++ b/llvm/test/CodeGen/AArch64/debug-info-sve-dbg-declare.mir
@@ -89,10 +89,10 @@
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
- !6 = !{i32 1, !"branch-target-enforcement", i32 0}
- !7 = !{i32 1, !"sign-return-address", i32 0}
- !8 = !{i32 1, !"sign-return-address-all", i32 0}
- !9 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+ !6 = !{i32 8, !"branch-target-enforcement", i32 0}
+ !7 = !{i32 8, !"sign-return-address", i32 0}
+ !8 = !{i32 8, !"sign-return-address-all", i32 0}
+ !9 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
!10 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git b19275ba870a06c5ef0428af6264ffd28c7cde9e)"}
!11 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !12, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
!12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/CodeGen/AArch64/live-debugvalues-sve.mir b/llvm/test/CodeGen/AArch64/live-debugvalues-sve.mir
index fed32002847ad..8903ca2b865b9 100644
--- a/llvm/test/CodeGen/AArch64/live-debugvalues-sve.mir
+++ b/llvm/test/CodeGen/AArch64/live-debugvalues-sve.mir
@@ -69,10 +69,10 @@
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
- !6 = !{i32 1, !"branch-target-enforcement", i32 0}
- !7 = !{i32 1, !"sign-return-address", i32 0}
- !8 = !{i32 1, !"sign-return-address-all", i32 0}
- !9 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+ !6 = !{i32 8, !"branch-target-enforcement", i32 0}
+ !7 = !{i32 8, !"sign-return-address", i32 0}
+ !8 = !{i32 8, !"sign-return-address-all", i32 0}
+ !9 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
!10 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git b19275ba870a06c5ef0428af6264ffd28c7cde9e)"}
!11 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 6, type: !12, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !26)
!12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/CodeGen/AArch64/memsize-remarks.ll b/llvm/test/CodeGen/AArch64/memsize-remarks.ll
index 2d9ef520d5705..dffbf0438ac01 100644
--- a/llvm/test/CodeGen/AArch64/memsize-remarks.ll
+++ b/llvm/test/CodeGen/AArch64/memsize-remarks.ll
@@ -328,10 +328,10 @@ attributes #4 = { nounwind }
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 12, i32 0]}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 1, !"wchar_size", i32 4}
-!3 = !{i32 1, !"branch-target-enforcement", i32 0}
-!4 = !{i32 1, !"sign-return-address", i32 0}
-!5 = !{i32 1, !"sign-return-address-all", i32 0}
-!6 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!3 = !{i32 8, !"branch-target-enforcement", i32 0}
+!4 = !{i32 8, !"sign-return-address", i32 0}
+!5 = !{i32 8, !"sign-return-address-all", i32 0}
+!6 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
!7 = !{i32 7, !"PIC Level", i32 2}
!8 = !{i32 7, !"uwtable", i32 1}
!9 = !{i32 7, !"frame-pointer", i32 1}
diff --git a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-0.ll b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-0.ll
index b64fda769df91..c4b80c426050a 100644
--- a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-0.ll
+++ b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-0.ll
@@ -8,10 +8,10 @@ attributes #0 = { "branch-target-enforcement"="true" }
!llvm.module.flags = !{!0, !1, !2, !3}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
-!3 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
; Both attributes present in a file with no functions.
; ASM: .word 3221225472
diff --git a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-1.ll b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-1.ll
index 4996d8e66f7fe..c5995caba941c 100644
--- a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-1.ll
+++ b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-1.ll
@@ -10,10 +10,10 @@ entry:
!llvm.module.flags = !{!0, !1, !2, !3}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
-!1 = !{i32 1, !"sign-return-address", i32 0}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
-!3 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 0}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
; BTI attribute present
; ASM: .word 3221225472
diff --git a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-2.ll b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-2.ll
index f765aeb5c4176..f0dd522e6adfb 100644
--- a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-2.ll
+++ b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-2.ll
@@ -10,10 +10,10 @@ entry:
!llvm.module.flags = !{!0, !1, !2, !3}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
-!3 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
; PAC attribute present
; ASM: .word 3221225472
diff --git a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-3.ll b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-3.ll
index f5ef65b7b9032..4bf6532cbe27e 100644
--- a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-3.ll
+++ b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-3.ll
@@ -10,10 +10,10 @@ entry:
!llvm.module.flags = !{!0, !1, !2, !3}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
-!3 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
; Both attribute present
; ASM: .word 3221225472
diff --git a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-4.ll b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-4.ll
index 67ad5f07080b8..fff698d2152ac 100644
--- a/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-4.ll
+++ b/llvm/test/CodeGen/AArch64/note-gnu-property-pac-bti-4.ll
@@ -17,10 +17,10 @@ attributes #1 = { "branch-target-enforcement"="true" }
!llvm.module.flags = !{!0, !1, !2, !3}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 0}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
-!3 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 0}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
; Note is not emited if module has no properties
; ASM-NOT: .note.gnu.property
\ No newline at end of file
diff --git a/llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-2.ll b/llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-2.ll
index e8c659380f7c9..3cb4505041f3b 100644
--- a/llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-2.ll
+++ b/llvm/test/CodeGen/AArch64/pacbti-llvm-generated-funcs-2.ll
@@ -65,7 +65,7 @@ attributes #2 = { nofree noinline norecurse nounwind writeonly }
!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 1, !"wchar_size", i32 4}
-!2 = !{i32 1, !"branch-target-enforcement", i32 0}
-!3 = !{i32 1, !"sign-return-address", i32 1}
-!4 = !{i32 1, !"sign-return-address-all", i32 1}
-!5 = !{i32 1, !"sign-return-address-with-bkey", i32 1}
+!2 = !{i32 8, !"branch-target-enforcement", i32 0}
+!3 = !{i32 8, !"sign-return-address", i32 1}
+!4 = !{i32 8, !"sign-return-address-all", i32 1}
+!5 = !{i32 8, !"sign-return-address-with-bkey", i32 1}
diff --git a/llvm/test/CodeGen/AArch64/pacbti-module-attrs.ll b/llvm/test/CodeGen/AArch64/pacbti-module-attrs.ll
index 27287bd1895e7..ae2fe567f8457 100644
--- a/llvm/test/CodeGen/AArch64/pacbti-module-attrs.ll
+++ b/llvm/test/CodeGen/AArch64/pacbti-module-attrs.ll
@@ -71,7 +71,7 @@ attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!0 = !{i32 1, !"wchar_size", i32 4}
-!1 = !{i32 1, !"branch-target-enforcement", i32 1}
-!2 = !{i32 1, !"sign-return-address", i32 1}
-!3 = !{i32 1, !"sign-return-address-all", i32 0}
-!4 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!1 = !{i32 8, !"branch-target-enforcement", i32 1}
+!2 = !{i32 8, !"sign-return-address", i32 1}
+!3 = !{i32 8, !"sign-return-address-all", i32 0}
+!4 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
diff --git a/llvm/test/CodeGen/AArch64/setjmp-bti-no-enforcement.ll b/llvm/test/CodeGen/AArch64/setjmp-bti-no-enforcement.ll
index cd48245e0a22f..720c0a44e3090 100644
--- a/llvm/test/CodeGen/AArch64/setjmp-bti-no-enforcement.ll
+++ b/llvm/test/CodeGen/AArch64/setjmp-bti-no-enforcement.ll
@@ -48,4 +48,4 @@ declare void @notsetjmp()
attributes #0 = { returns_twice }
; !llvm.module.flags = !{!0}
-; !0 = !{i32 1, !"branch-target-enforcement", i32 1}
+; !0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll b/llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll
index f9c5416d6daae..17b89d8db06d0 100644
--- a/llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll
+++ b/llvm/test/CodeGen/AArch64/setjmp-bti-outliner.ll
@@ -80,4 +80,4 @@ attributes #0 = { returns_twice }
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/AArch64/setjmp-bti.ll b/llvm/test/CodeGen/AArch64/setjmp-bti.ll
index ceea80c839a89..2c279e5415cf6 100644
--- a/llvm/test/CodeGen/AArch64/setjmp-bti.ll
+++ b/llvm/test/CodeGen/AArch64/setjmp-bti.ll
@@ -52,4 +52,4 @@ declare void @notsetjmp()
attributes #0 = { returns_twice }
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/ARM/pacbti-module-attrs.ll b/llvm/test/CodeGen/ARM/pacbti-module-attrs.ll
index e0dda1c80ae3b..a2ea83241afa7 100644
--- a/llvm/test/CodeGen/ARM/pacbti-module-attrs.ll
+++ b/llvm/test/CodeGen/ARM/pacbti-module-attrs.ll
@@ -16,6 +16,6 @@ entry:
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/CodeGen/ARM/setjmp-bti-basic.ll b/llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
index e18f87d82e6c6..4c10cd6ebcbe6 100644
--- a/llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
+++ b/llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
@@ -47,4 +47,4 @@ attributes #0 = { returns_twice }
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll b/llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll
index 20fd1768d6077..c168eb2cdd2da 100644
--- a/llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll
+++ b/llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll
@@ -89,4 +89,4 @@ attributes #0 = { returns_twice }
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-vpt-debug.mir b/llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-vpt-debug.mir
index 6d0688432a5a0..1bfe8f9d289cd 100644
--- a/llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-vpt-debug.mir
+++ b/llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-vpt-debug.mir
@@ -93,9 +93,9 @@
!6 = !{i32 1, !"static_rwdata", i32 1}
!7 = !{i32 1, !"enumsize_buildattr", i32 2}
!8 = !{i32 1, !"armlib_unavailable", i32 0}
- !9 = !{i32 1, !"branch-target-enforcement", i32 0}
- !10 = !{i32 1, !"sign-return-address", i32 0}
- !11 = !{i32 1, !"sign-return-address-all", i32 0}
+ !9 = !{i32 8, !"branch-target-enforcement", i32 0}
+ !10 = !{i32 8, !"sign-return-address", i32 0}
+ !11 = !{i32 8, !"sign-return-address-all", i32 0}
!12 = !{!"Component: ARM Compiler 6.17.0.0 (permissive) Tool: armclang [00000000]"}
!13 = distinct !DISubprogram(name: "arm_max_no_idx_f32", scope: !1, file: !1, line: 5, type: !14, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !23)
!14 = !DISubroutineType(types: !15)
diff --git a/llvm/test/CodeGen/Thumb2/bti-const-island-multiple-jump-tables.mir b/llvm/test/CodeGen/Thumb2/bti-const-island-multiple-jump-tables.mir
index e565d34cbadeb..8298ed792a030 100644
--- a/llvm/test/CodeGen/Thumb2/bti-const-island-multiple-jump-tables.mir
+++ b/llvm/test/CodeGen/Thumb2/bti-const-island-multiple-jump-tables.mir
@@ -126,7 +126,7 @@
!llvm.module.flags = !{!0}
- !0 = !{i32 1, !"branch-target-enforcement", i32 1}
+ !0 = !{i32 8, !"branch-target-enforcement", i32 1}
...
---
diff --git a/llvm/test/CodeGen/Thumb2/bti-const-island.mir b/llvm/test/CodeGen/Thumb2/bti-const-island.mir
index 52ee5c8b1d049..a861e1e3deb4a 100644
--- a/llvm/test/CodeGen/Thumb2/bti-const-island.mir
+++ b/llvm/test/CodeGen/Thumb2/bti-const-island.mir
@@ -43,7 +43,7 @@
}
!llvm.module.flags = !{!0}
- !0 = !{i32 1, !"branch-target-enforcement", i32 1}
+ !0 = !{i32 8, !"branch-target-enforcement", i32 1}
...
---
diff --git a/llvm/test/CodeGen/Thumb2/bti-entry-blocks.ll b/llvm/test/CodeGen/Thumb2/bti-entry-blocks.ll
index ce673fe0e23b6..1c89e60bc6a54 100644
--- a/llvm/test/CodeGen/Thumb2/bti-entry-blocks.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-entry-blocks.ll
@@ -19,4 +19,4 @@ entry:
}
!llvm.module.flags = !{!1}
-!1 = !{i32 1, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/Thumb2/bti-indirect-branches.ll b/llvm/test/CodeGen/Thumb2/bti-indirect-branches.ll
index f56e3b67b1d0c..bfff648980d65 100644
--- a/llvm/test/CodeGen/Thumb2/bti-indirect-branches.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-indirect-branches.ll
@@ -132,4 +132,4 @@ return:
}
!llvm.module.flags = !{!1}
-!1 = !{i32 1, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/Thumb2/bti-jump-table.mir b/llvm/test/CodeGen/Thumb2/bti-jump-table.mir
index 22f255b98472c..22e7a7711de76 100644
--- a/llvm/test/CodeGen/Thumb2/bti-jump-table.mir
+++ b/llvm/test/CodeGen/Thumb2/bti-jump-table.mir
@@ -28,7 +28,7 @@
}
!llvm.module.flags = !{!0}
- !0 = !{i32 1, !"branch-target-enforcement", i32 1}
+ !0 = !{i32 8, !"branch-target-enforcement", i32 1}
...
---
diff --git a/llvm/test/CodeGen/Thumb2/bti-outliner-1.ll b/llvm/test/CodeGen/Thumb2/bti-outliner-1.ll
index 7cccfac31076c..03bdf454b8553 100644
--- a/llvm/test/CodeGen/Thumb2/bti-outliner-1.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-outliner-1.ll
@@ -133,4 +133,4 @@ attributes #2 = { minsize nofree norecurse nounwind optsize "branch-target-enfor
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/bti-outliner-2.ll b/llvm/test/CodeGen/Thumb2/bti-outliner-2.ll
index b0d03d575bc58..f5d2d393040c0 100644
--- a/llvm/test/CodeGen/Thumb2/bti-outliner-2.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-outliner-2.ll
@@ -79,4 +79,4 @@ attributes #2 = { minsize nofree norecurse nounwind optsize "branch-target-enfor
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/Thumb2/bti-outliner-cost-1.ll b/llvm/test/CodeGen/Thumb2/bti-outliner-cost-1.ll
index 3c800ad85a28f..85358e694e20e 100644
--- a/llvm/test/CodeGen/Thumb2/bti-outliner-cost-1.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-outliner-cost-1.ll
@@ -64,4 +64,4 @@ attributes #0 = { minsize nofree norecurse nounwind optsize }
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/bti-outliner-cost-2.ll b/llvm/test/CodeGen/Thumb2/bti-outliner-cost-2.ll
index 2cb6e2c5b5c18..376dc3a31068a 100644
--- a/llvm/test/CodeGen/Thumb2/bti-outliner-cost-2.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-outliner-cost-2.ll
@@ -48,4 +48,4 @@ attributes #0 = { minsize nofree norecurse nounwind optsize }
!llvm.module.flags = !{!0}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
diff --git a/llvm/test/CodeGen/Thumb2/bti-pac-replace-1.mir b/llvm/test/CodeGen/Thumb2/bti-pac-replace-1.mir
index 277679908aa42..609dc72e258f8 100644
--- a/llvm/test/CodeGen/Thumb2/bti-pac-replace-1.mir
+++ b/llvm/test/CodeGen/Thumb2/bti-pac-replace-1.mir
@@ -15,9 +15,9 @@
!llvm.module.flags = !{!0, !1, !2}
- !0 = !{i32 1, !"branch-target-enforcement", i32 1}
- !1 = !{i32 1, !"sign-return-address", i32 1}
- !2 = !{i32 1, !"sign-return-address-all", i32 0}
+ !0 = !{i32 8, !"branch-target-enforcement", i32 1}
+ !1 = !{i32 8, !"sign-return-address", i32 1}
+ !2 = !{i32 8, !"sign-return-address-all", i32 0}
...
---
diff --git a/llvm/test/CodeGen/Thumb2/bti-pac-replace-2.ll b/llvm/test/CodeGen/Thumb2/bti-pac-replace-2.ll
index 630ae856560b7..ee497433551f9 100644
--- a/llvm/test/CodeGen/Thumb2/bti-pac-replace-2.ll
+++ b/llvm/test/CodeGen/Thumb2/bti-pac-replace-2.ll
@@ -14,9 +14,9 @@ entry:
declare dso_local i32 @_Z1gi(i32)
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; Check the function starts with `pacbti` and correct unwind info is emitted
; CHECK-LABEL: _Z1fi:
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-basic.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-basic.ll
index d4be44edbcec9..0376d2164bd08 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-basic.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-basic.ll
@@ -97,9 +97,9 @@ attributes #1 = { "cmse_nonsecure_entry" "target-features"="+8msecext,+armv8-m.m
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; UNWIND-LABEL: FunctionAddress: 0x0
; UNWIND: 0x00 ; vsp = vsp + 4
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-indirect-tail-call.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-indirect-tail-call.ll
index 1feb74cbfb828..98a5eb5b98aae 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-indirect-tail-call.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-indirect-tail-call.ll
@@ -32,6 +32,6 @@ attributes #0 = { nounwind }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll
index 84983411e86cb..ce22d4eb632bd 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll
@@ -120,9 +120,9 @@ attributes #0 = { minsize nofree norecurse nounwind optsize uwtable}
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; UNWIND-LABEL: FunctionAddress: 0x0
; UNWIND: 0xB4 ; pop ra_auth_code
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-2.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-2.ll
index a346bb4391add..b2c631ee3cbbd 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-2.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-2.ll
@@ -84,6 +84,6 @@ attributes #0 = { minsize nofree norecurse nounwind optsize}
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
index edbae593ee84d..5e55c9aa15f5e 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
@@ -138,9 +138,9 @@ attributes #0 = { minsize noinline norecurse nounwind optsize readnone uwtable }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; UNWIND-LABEL: FunctionAddress: 0x4
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-4.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-4.ll
index fa7337561ab8e..b1768863b764c 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-4.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-4.ll
@@ -172,9 +172,9 @@ attributes #2 = { noreturn }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; UNWIND-LABEL: FunctionAddress: 0x0
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-5.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-5.ll
index b7a475ad6ab8e..d1fdbee0cf29c 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-5.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-5.ll
@@ -93,6 +93,6 @@ attributes #1 = { minsize nofree norecurse nounwind optsize "sign-return-address
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-overalign.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-overalign.ll
index 111f2de8a608e..1f3626585209d 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-overalign.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-overalign.ll
@@ -60,9 +60,9 @@ declare dso_local i32 @_Z1giPi(i32, i32*) local_unnamed_addr
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; UNWIND-LABEL: FunctionAddress: 0x0
; UNWIND: 0x97 ; vsp = r7
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-unsupported-arch.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-unsupported-arch.ll
index 0af18a9f62ca6..979292a5b1f28 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-unsupported-arch.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-unsupported-arch.ll
@@ -26,6 +26,6 @@ attributes #0 = { noinline nounwind }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 1}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-1.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-1.ll
index 89a1e139a6587..87c9e41acd6ed 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-1.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-1.ll
@@ -72,6 +72,6 @@ attributes #1 = { nounwind }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-2.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-2.ll
index ef0912ed68ac4..e6069f6a1c908 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-2.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-varargs-2.ll
@@ -90,9 +90,9 @@ attributes #1 = { nounwind }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
; UNWIND-LABEL: FunctionAddress
; UNWIND: 0x01 ; vsp = vsp + 8
diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-vla.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-vla.ll
index b1881ee4d67c2..898410de1520a 100644
--- a/llvm/test/CodeGen/Thumb2/pacbti-m-vla.ll
+++ b/llvm/test/CodeGen/Thumb2/pacbti-m-vla.ll
@@ -120,6 +120,6 @@ attributes #0 = { nounwind }
!llvm.module.flags = !{!0, !1, !2}
-!0 = !{i32 1, !"branch-target-enforcement", i32 0}
-!1 = !{i32 1, !"sign-return-address", i32 1}
-!2 = !{i32 1, !"sign-return-address-all", i32 0}
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
diff --git a/llvm/test/DebugInfo/AArch64/debugline-endsequence.ll b/llvm/test/DebugInfo/AArch64/debugline-endsequence.ll
index a6722788ec64f..82b7743664251 100644
--- a/llvm/test/DebugInfo/AArch64/debugline-endsequence.ll
+++ b/llvm/test/DebugInfo/AArch64/debugline-endsequence.ll
@@ -46,10 +46,10 @@ define void @f4() !dbg !19 {
!7 = !{i32 7, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{i32 1, !"wchar_size", i32 4}
-!10 = !{i32 1, !"branch-target-enforcement", i32 0}
-!11 = !{i32 1, !"sign-return-address", i32 0}
-!12 = !{i32 1, !"sign-return-address-all", i32 0}
-!13 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!10 = !{i32 8, !"branch-target-enforcement", i32 0}
+!11 = !{i32 8, !"sign-return-address", i32 0}
+!12 = !{i32 8, !"sign-return-address-all", i32 0}
+!13 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
!14 = !{i32 7, !"PIC Level", i32 2}
!15 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 1, type: !16, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
!16 = !DISubroutineType(types: !17)
diff --git a/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll b/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll
index f5d7a069c3165..7ac788e0c861d 100644
--- a/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll
+++ b/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll
@@ -20,10 +20,10 @@ declare void @llvm.instrprof.cover(i8*, i64, i32, i32)
!2 = !{i32 7, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !{i32 1, !"wchar_size", i32 4}
-!5 = !{i32 1, !"branch-target-enforcement", i32 0}
-!6 = !{i32 1, !"sign-return-address", i32 0}
-!7 = !{i32 1, !"sign-return-address-all", i32 0}
-!8 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!5 = !{i32 8, !"branch-target-enforcement", i32 0}
+!6 = !{i32 8, !"sign-return-address", i32 0}
+!7 = !{i32 8, !"sign-return-address-all", i32 0}
+!8 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
!9 = !{i32 7, !"uwtable", i32 1}
!10 = !{i32 7, !"frame-pointer", i32 1}
!11 = !{!"clang version 14.0.0"}
diff --git a/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll b/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll
index 421bf96b6e73e..64102ab4374f0 100644
--- a/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll
+++ b/llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll
@@ -34,10 +34,10 @@ declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
!2 = !{i32 7, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !{i32 1, !"wchar_size", i32 4}
-!5 = !{i32 1, !"branch-target-enforcement", i32 0}
-!6 = !{i32 1, !"sign-return-address", i32 0}
-!7 = !{i32 1, !"sign-return-address-all", i32 0}
-!8 = !{i32 1, !"sign-return-address-with-bkey", i32 0}
+!5 = !{i32 8, !"branch-target-enforcement", i32 0}
+!6 = !{i32 8, !"sign-return-address", i32 0}
+!7 = !{i32 8, !"sign-return-address-all", i32 0}
+!8 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
!9 = !{i32 7, !"uwtable", i32 1}
!10 = !{i32 7, !"frame-pointer", i32 1}
!11 = !{!"clang version 14.0.0"}
diff --git a/llvm/test/LTO/AArch64/Inputs/foo.ll b/llvm/test/LTO/AArch64/Inputs/foo.ll
new file mode 100644
index 0000000000000..961b0d4e7997e
--- /dev/null
+++ b/llvm/test/LTO/AArch64/Inputs/foo.ll
@@ -0,0 +1,16 @@
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+define dso_local i32 @foo() #0 {
+entry:
+ ret i32 42
+}
+
+attributes #0 = { noinline nounwind optnone uwtable }
+
+!llvm.module.flags = !{!0, !1, !2, !3}
+
+!0 = !{i32 8, !"branch-target-enforcement", i32 1}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 1}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 1}
diff --git a/llvm/test/LTO/AArch64/link-branch-target-enforcement.ll b/llvm/test/LTO/AArch64/link-branch-target-enforcement.ll
new file mode 100644
index 0000000000000..ccf8cf67ede6d
--- /dev/null
+++ b/llvm/test/LTO/AArch64/link-branch-target-enforcement.ll
@@ -0,0 +1,38 @@
+; Testcase to check that module with
diff erent branch-target-enforcement can
+; be mixed.
+;
+; RUN: llvm-as %s -o %t1.bc
+; RUN: llvm-as %p/Inputs/foo.ll -o %t2.bc
+; RUN: llvm-lto -exported-symbol main \
+; RUN: -exported-symbol foo \
+; RUN: -filetype=obj \
+; RUN: %t1.bc %t2.bc \
+; RUN: -o %t1.exe 2>&1 | FileCheck --allow-empty %s
+; RUN: llvm-objdump -d %t1.exe | FileCheck --check-prefix=CHECK-DUMP %s
+; RUN: llvm-readelf -n %t1.exe | FileCheck --check-prefix=CHECK-PROP %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+declare i32 @foo();
+
+define i32 @main() {
+entry:
+ %add = call i32 @foo()
+ ret i32 %add
+}
+
+!llvm.module.flags = !{!0, !1, !2, !3 }
+!0 = !{i32 8, !"branch-target-enforcement", i32 0}
+!1 = !{i32 8, !"sign-return-address", i32 1}
+!2 = !{i32 8, !"sign-return-address-all", i32 0}
+!3 = !{i32 8, !"sign-return-address-with-bkey", i32 0}
+
+; CHECK-NOT: linking module flags 'branch-target-enforcement': IDs have conflicting values in
+; CHECK-DUMP: <main>:
+; CHECK-DUMP: bl 0x8 <main+0x8>
+; CHECK-DUMP: <foo>:
+
+; `main` doesn't support BTI while `foo` does, so in the binary
+; we should see only PAC which is supported by both.
+; CHECK-PROP: Properties: aarch64 feature: PAC
\ No newline at end of file
diff --git a/llvm/test/LTO/AArch64/lit.local.cfg b/llvm/test/LTO/AArch64/lit.local.cfg
new file mode 100644
index 0000000000000..304f2436ece15
--- /dev/null
+++ b/llvm/test/LTO/AArch64/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'AArch64' in config.root.targets:
+ config.unsupported = True
diff --git a/llvm/test/Verifier/module-flags-1.ll b/llvm/test/Verifier/module-flags-1.ll
index ff82c2845235a..a3e50c59f18e4 100644
--- a/llvm/test/Verifier/module-flags-1.ll
+++ b/llvm/test/Verifier/module-flags-1.ll
@@ -45,6 +45,10 @@
; CHECK: invalid value for 'max' module flag (expected constant integer)
!19 = !{i32 7, !"max", !"max"}
+; Check that any 'min' module flags are valid.
+; CHECK: invalid value for 'min' module flag (expected constant integer)
+!20 = !{i32 8, !"min", !"min"}
+
; Check that any 'require' module flags are valid.
; CHECK: invalid requirement on flag, flag is not present in module
!11 = !{i32 3, !"bar", !{!"no-such-flag", i32 52}}
@@ -58,4 +62,4 @@
!llvm.module.flags = !{
!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15,
- !16, !17, !18, !19 }
+ !16, !17, !18, !19, !20 }
More information about the llvm-commits
mailing list