This is an archive of the discontinued LLVM Phabricator instance.

[mlir][CSE] Introduce DialectInterface for CSE
Needs ReviewPublic

Authored by uenoku on Jul 5 2023, 7:31 AM.

Details

Summary

This patch implements CSE dialect interfaces proposed in https://discourse.llvm.org/t/rfc-dialectinterface-for-cse/71831/9.

CSEDialectInterface has three methods getHashValue and isEqual are passed to DenseMapInfo used by CSE to provide a way to customize CSE behaivor from user sides. mergeOperations is a callback when an operation is eliminated in order to propagate operation information one to another.

Diff Detail

Event Timeline

uenoku created this revision.Jul 5 2023, 7:31 AM
Herald added a project: Restricted Project. · View Herald Transcript
uenoku requested review of this revision.Jul 5 2023, 7:31 AM
uenoku updated this revision to Diff 537368.Jul 5 2023, 8:33 AM
uenoku retitled this revision from [Not-For-Commit][mlir][CSE][OperationSupport] Introduce DialectInterfaces for CSE to [mlir][CSE] Introduce DialectInterfaces for CSE.Jul 18 2023, 4:31 AM
uenoku edited the summary of this revision. (Show Details)
uenoku added reviewers: mehdi_amini, springerm.
uenoku added a reviewer: jpienaar.
uenoku retitled this revision from [mlir][CSE] Introduce DialectInterfaces for CSE to [mlir][CSE] Introduce DialectInterface for CSE.Jul 18 2023, 9:47 AM
mehdi_amini added inline comments.Jul 18 2023, 2:11 PM
mlir/lib/Transforms/CSE.cpp
41

dyn_cast seems appropriate here

149

Can you enforce (guarded by #ifndef NDEBUG) the invariant around the hash value of existing not changing?

uenoku updated this revision to Diff 541835.Jul 18 2023, 9:29 PM

Replace dyn_cast_or_null with dyn_cast. Add assertions on the debug build.

uenoku marked 2 inline comments as done.Jul 18 2023, 9:30 PM