[clang] [llvm] [ARM][AArch64] BTI, GCS, PAC Module flag update. (PR #86212)
Daniel Kiss via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 14 11:39:48 PDT 2025
================
@@ -5975,6 +5975,120 @@ void llvm::UpgradeFunctionAttributes(Function &F) {
}
}
+// Check if the function attribute is not present and set it.
+static void SetFunctionAttrIfNotSet(Function &F, StringRef FnAttrName,
+ StringRef Value) {
+ if (!F.hasFnAttribute(FnAttrName))
+ F.addFnAttr(FnAttrName, Value);
+}
+
+// Check if the function attribute is not present and set it if needed.
+// If the attribute is "false" then removes it.
+// If the attribute is "true" resets it to a valueless attribute.
+static void ConvertFunctionAttr(Function &F, bool Set, StringRef FnAttrName) {
+ if (!F.hasFnAttribute(FnAttrName)) {
+ if (Set)
+ F.addFnAttr(FnAttrName);
+ } else {
+ auto A = F.getFnAttribute(FnAttrName);
+ if ("false" == A.getValueAsString())
+ F.removeFnAttr(FnAttrName);
+ else if ("true" == A.getValueAsString()) {
+ F.removeFnAttr(FnAttrName);
+ F.addFnAttr(FnAttrName);
+ }
+ }
+}
+
+void llvm::CopyModuleAttrToFunctions(Module &M) {
----------------
DanielKristofKiss wrote:
done
https://github.com/llvm/llvm-project/pull/86212
More information about the cfe-commits
mailing list