Skip to content

Conversation

badumbatish
Copy link
Contributor

SparseForwardDataFlowAnalysis, with the comments specifying that StateT must be sublclassing AbstractSparseLattice, also places a static assert in the class itself.

This commit adds the same missing assert for SparseBackwardDataFlowAnalysis

@badumbatish badumbatish requested a review from cxy-1993 October 8, 2025 20:36
@llvmbot llvmbot added the mlir label Oct 8, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 8, 2025

@llvm/pr-subscribers-mlir

Author: Jasmine Tang (badumbatish)

Changes

SparseForwardDataFlowAnalysis, with the comments specifying that StateT must be sublclassing AbstractSparseLattice, also places a static assert in the class itself.

This commit adds the same missing assert for SparseBackwardDataFlowAnalysis


Full diff: https://github.com/llvm/llvm-project/pull/162547.diff

1 Files Affected:

  • (modified) mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h (+4)
diff --git a/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h b/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h
index 3f8874d02afad..1a33ecf8b5aa9 100644
--- a/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h
+++ b/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h
@@ -518,6 +518,10 @@ class AbstractSparseBackwardDataFlowAnalysis : public DataFlowAnalysis {
 template <typename StateT>
 class SparseBackwardDataFlowAnalysis
     : public AbstractSparseBackwardDataFlowAnalysis {
+  static_assert(
+      std::is_base_of<AbstractSparseLattice, StateT>::value,
+      "analysis state class expected to subclass AbstractSparseLattice");
+
 public:
   explicit SparseBackwardDataFlowAnalysis(DataFlowSolver &solver,
                                           SymbolTableCollection &symbolTable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants