[clang] [llvm] [llvm][AArch64] Do not inline a function with different signing scheme. (PR #80642)
Nick Desaulniers via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 13 09:48:23 PST 2024
================
@@ -5155,7 +5155,39 @@ struct StrictFPUpgradeVisitor : public InstVisitor<StrictFPUpgradeVisitor> {
};
} // namespace
-void llvm::UpgradeFunctionAttributes(Function &F) {
+static void
+CopyModuleAttributeToFunction(Function &F, StringRef FnAttrName,
+ StringRef ModAttrName,
+ std::pair<StringRef, StringRef> Values) {
+ Module *M = F.getParent();
+ if (!M)
+ return;
+ if (F.hasFnAttribute(FnAttrName))
+ return;
+ if (const auto *MAttr = mdconst::extract_or_null<ConstantInt>(
+ M->getModuleFlag(ModAttrName))) {
+ if (MAttr->getZExtValue()) {
+ F.addFnAttr(FnAttrName, Values.first);
+ return;
+ }
+ }
+ F.addFnAttr(FnAttrName, Values.second);
+}
+
+static void CopyModuleAttributeToFunction(Function &F, StringRef AttrName) {
+ CopyModuleAttributeToFunction(
+ F, AttrName, AttrName,
+ std::make_pair<StringRef, StringRef>("true", "false"));
+}
+
+static void
+CopyModuleAttributeToFunction(Function &F, StringRef AttrName,
+ std::pair<StringRef, StringRef> Values) {
+ CopyModuleAttributeToFunction(F, AttrName, AttrName, Values);
+}
----------------
nickdesaulniers wrote:
Please add function level comments for these two describing when one should be used vs the other.
https://github.com/llvm/llvm-project/pull/80642
More information about the cfe-commits
mailing list