This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Allow overriding AbstractDenseDataFlowAnalysis::visitOperation
ClosedPublic

Authored by tblah on Jan 3 2023, 3:36 AM.

Details

Summary

AbstractDenseDataFlowAnalysis::visitOperation controls how the dataflow
analysis proceeds around control flow. In particular, conservative
assumptions are made about call operations which can prevent some
analysis from succeeding.

The motivating case for this change is https://reviews.llvm.org/D140415,
for which it is correct and necessary for the lattice to be preserved
after call operations.

Some renaming was necessary to avoid confusion with
DenseDataFlowAnalysis::visitOperation.
AbstractDenseDataFlowAnalysis::visitRegionBranchOperation and
DenseDataFlowAnalysis::visitOperationImpl are also made protected
to allow implementation of AbstractDenseDataFlowAnalysis::visitOperation,
although I did not need these to be virtual.

Diff Detail

Event Timeline

tblah created this revision.Jan 3 2023, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 3:36 AM
tblah requested review of this revision.Jan 3 2023, 3:36 AM
tblah edited the summary of this revision. (Show Details)Jan 3 2023, 3:36 AM

+1 but why is the rename necessary? From what I understand, the name shouldn't conflict with any other method...

tblah added a comment.Jan 3 2023, 8:18 AM

+1 but why is the rename necessary? From what I understand, the name shouldn't conflict with any other method...

Thanks for taking a look.

The rename is necessary because builds using clang with LLVM_ENABLE_WERROR=On will fail on 'mlir::dataflow::DenseDataFlowAnalysis<(anonymous namespace)::LastModification::visitOperation' hides overloaded virtual function [-Werror,-Woverloaded-virtual].

Besides the compilation warning, I think it is confusing to have two methods with the same name that do different things.

Mogball accepted this revision.Jan 3 2023, 8:27 AM

Thanks for the clarification. Can you name it something like processOperation? "CFG" isn't really applicable here since it has nothing to do with "control-flow graphs" specifically.

This revision is now accepted and ready to land.Jan 3 2023, 8:27 AM