Closed andidr closed 5 months ago
@llvm/pr-subscribers-mlir
Author: Andi Drebes (andidr)
CC @matthiaskramm as the original contributor of has_meet
Looks good!
Not a blocker, but after this change, we don't actually have any tests that verify that inheriting directly from AbstractSparseLattice
(instead of from Lattice<X>
) works as expected?
@matthiaskramm Thanks for the review! Indeed, a merge of this change leaves no test with meet
directly provided by the lattice. However, duplicating the test to restore the original behavior seems overly bulky and parametrization would make the test overly convoluted. Though, if you prefer any of these solutions over the current result, I'd be happy to provide an implementation and to amend the PR.
@matthiaskramm Any thoughts about the options for the tests? If you are fine with the current state, maybe someone with write access could go ahead and merge the changes? Thanks!
I'm OK with the current state. From my side, this is fine to merge in.
Can someone with commits rights merge (or comment if anything needs to be changed)? Maybe @ftynse?
Given that most of the contribution ins mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h
are from @Mogball, maybe @Mogball may consider merging? Thanks!
Apologies for the delay.
The class
Lattice
should automatically delegate invocations of the meet operator to the meet operation of the associated lattice value class if that class provides a static function calledmeet
. This process fails for two reasons:Lattice::has_meet
checks for a member functionmeet
without arguments of the lattice value class, although it should check for a static member function.The function template
Lattice::meet<VT>()
implementing the default meet operation directly in the lattice is always present and takes precedence over the delegating function templateLattice::meet<VT, std::integral_constant<bool, true>>()
.This change fixes the automatic delegation of the meet operation of a lattice to the lattice value class in the presence of a static
meet
function by conditionally enabling either the delegating function template or the non-delegating function template and by changingLattice::has_meet
so that it checks for a staticmeet
member function in the lattice value type.The test from
TestSparseBackwardDataFlowAnalysis.cpp
is changed, such that themeet
function is not provided directly in theWrittenTo
lattice, but by theLattice
base class in order to trigger delegation to a lattice value class.