This makes the code forward-compatible to the memory attribute.
auto addNamedUnitAttr = [&](StringRef name) {
return funcOp->setAttr(name, UnitAttr::get(context));
};
- if (func->hasFnAttribute(llvm::Attribute::ReadNone))
+ if (func->doesNotAccessMemory())
addNamedUnitAttr(LLVMDialect::getReadnoneAttrName());
}
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(