[llvm] [llvm][AArch64] Autoupgrade function attributes from Module attributes. (PR #80640)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 09:02:04 PST 2024


================
@@ -5155,7 +5155,51 @@ struct StrictFPUpgradeVisitor : public InstVisitor<StrictFPUpgradeVisitor> {
 };
 } // namespace
 
-void llvm::UpgradeFunctionAttributes(Function &F) {
+// Check if the module attribute is present and not zero.
+static bool isModuleAttributeSet(const Module *M, const StringRef &ModAttr) {
+  if (const auto *Attr =
+          mdconst::extract_or_null<ConstantInt>(M->getModuleFlag(ModAttr)))
+    if (Attr->getZExtValue())
+      return true;
+  return false;
----------------
nickdesaulniers wrote:

```suggestion
const auto *Attr = mdconst::extract_or_null<ConstantInt>(M->getModuleFlag(ModAttr)));
return Attr && Attr->getZExtValue();
```

https://github.com/llvm/llvm-project/pull/80640


More information about the llvm-commits mailing list