[Mlir-commits] [mlir] [mlir] Store OperationState property callbacks as function pointers (NFC) (PR #226083)
Mehdi Amini
llvmlistbot at llvm.org
Thu Sep 24 02:12:36 PDT 2026
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/226083
The property callbacks never capture state. Store their function pointers directly instead of wrapping them in function_ref. This improve slightly MLIR build time and generates slightly smaller binaries.
Assisted-by: Codex
>From 24bb9c7a1a6b4758b4aad3a457ba1ccf675ac717 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Wed, 23 Sep 2026 16:31:53 -0700
Subject: [PATCH] [mlir] Store OperationState property callbacks as function
pointers
The property callbacks never capture state. Store their function pointers
directly instead of wrapping them in function_ref. Paired OpenMP TU
compiles retired about 0.60B fewer instructions and emitted 9.2 KB
less object text.
Assisted-by: Codex
---
mlir/include/mlir/IR/OperationSupport.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 0d94433ef42fc..0a38631fdce03 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -1031,12 +1031,10 @@ struct OperationState {
private:
/// The deleter and setter are non-null whenever `properties` is, and are
- /// only called after checking it. Coverity misses this invariant and flags
- /// the empty `function_ref`s as uninitialized.
- // coverity[uninit_member]
+ /// only called after checking it.
PropertyRef properties;
- llvm::function_ref<void(PropertyRef)> propertiesDeleter;
- llvm::function_ref<void(PropertyRef, const PropertyRef)> propertiesSetter;
+ void (*propertiesDeleter)(PropertyRef) = nullptr;
+ void (*propertiesSetter)(PropertyRef, const PropertyRef) = nullptr;
friend class Operation;
public:
More information about the Mlir-commits
mailing list