================
@@ -398,8 +398,13 @@ void CIRGenModule::constructAttributeList(
attrs.set(cir::CIRDialect::getSideEffectAttrName(),
cir::SideEffectAttr::get(&getMLIRContext(), sideEffect));
- // TODO(cir): When doing 'return attrs' we need to cover the Restrict and
- // ReturnsNonNull attributes here.
+ if (targetDecl->hasAttr<ReturnsNonNullAttr>())
+ retAttrs.set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
+ mlir::UnitAttr::get(&getMLIRContext()));
+
+ // TODO(cir): Add noalias to returns for malloc-like functions
----------------
andykaylor wrote:
Nit: This is handled above the non-null handler in classic codegen. It might be
good to move the comment.
https://github.com/llvm/llvm-project/pull/188281
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits