[Mlir-commits] [mlir] 87549e6 - [LLVMIR] Use helper methods to set/check readnone attribute (NFC)
Nikita Popov
llvmlistbot at llvm.org
Fri Oct 21 07:24:00 PDT 2022
Author: Nikita Popov
Date: 2022-10-21T16:23:52+02:00
New Revision: 87549e61dae5c1cbb8ef590058aa93053ded481d
URL: https://github.com/llvm/llvm-project/commit/87549e61dae5c1cbb8ef590058aa93053ded481d
DIFF: https://github.com/llvm/llvm-project/commit/87549e61dae5c1cbb8ef590058aa93053ded481d.diff
LOG: [LLVMIR] Use helper methods to set/check readnone attribute (NFC)
This makes the code forward-compatible to the memory attribute.
Added:
Modified:
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
index 6ea7c71cd40d4..2995ad33e57fa 100644
--- a/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
+++ b/mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
@@ -1018,7 +1018,7 @@ void Importer::processFunctionAttributes(llvm::Function *func,
auto addNamedUnitAttr = [&](StringRef name) {
return funcOp->setAttr(name, UnitAttr::get(context));
};
- if (func->hasFnAttribute(llvm::Attribute::ReadNone))
+ if (func->doesNotAccessMemory())
addNamedUnitAttr(LLVMDialect::getReadnoneAttrName());
}
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 26bc99f53a568..e409b665c30d9 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -984,7 +984,7 @@ LogicalResult ModuleTranslation::convertFunctionSignatures() {
addRuntimePreemptionSpecifier(function.getDsoLocal(), llvmFunc);
if (function->getAttrOfType<UnitAttr>(LLVMDialect::getReadnoneAttrName()))
- llvmFunc->addFnAttr(llvm::Attribute::ReadNone);
+ llvmFunc->setDoesNotAccessMemory();
// Forward the pass-through attributes to LLVM.
if (failed(forwardPassthroughAttributes(
More information about the Mlir-commits
mailing list