[llvm] [TableGen][RISCV] Generate pre/post-RA statistics for macro fusions (PR #209394)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 08:52:27 PDT 2026


================
@@ -13,12 +13,23 @@
 // predicators for checking if input instructions can be fused. These
 // predicators can used in `MacroFusion` DAG mutation.
 //
-// The generated header file contains two parts: one for predicator
-// declarations and one for predicator implementations. The user can get them
-// by defining macro `GET_<TargetName>_MACRO_FUSION_PRED_DECL` or
-// `GET_<TargetName>_MACRO_FUSION_PRED_IMPL` and then including the generated
+// The generated header file contains three parts: one for predicator
+// declarations, one for predicator implementations, and one for the
+// definitions of the `Statistic`s that count how often each fusion is matched.
+// The user can get them by defining macro
+// `GET_<TargetName>_MACRO_FUSION_PRED_DECL`,
+// `GET_<TargetName>_MACRO_FUSION_PRED_IMPL` or
+// `GET_<TargetName>_MACRO_FUSION_STATISTICS` and then including the generated
 // header file.
 //
+// The statistics are opt-in: the predicator implementations only increment the
+// counters when `ENABLE_STATISTIC` is defined, and the
----------------
topperc wrote:

Why do we need 2 levels of control? If a target doesn't want statistics can't they just set GenerateStatistic for all of their fusions?

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


More information about the llvm-commits mailing list