This is an archive of the discontinued LLVM Phabricator instance.

[Verifier] Significantly speed up IsolatedFromAbove checking. NFC.
ClosedPublic

Authored by lattner on May 28 2021, 3:12 PM.

Details

Summary

The implementation had a couple of problems, including checking
"isProperAncestor" in an inefficient way. It also recursed into
other "isolated from above" ops. In the case of CIRCT, we get
three levels of isolated ops:

mlir::ModuleOp
  firrtl::CircuitOp
     firrtl::FModuleOp

The verification for module would recurse into the circuits and
fmodules checking them. The verifier hook for circuit would
recurse into all the modules reverifying them, fmoduleop would
then reverify them. The same happens for mlir::ModuleOp and Func.

While here, fix an old design problem: IsolatedFromAbove checking
was implemented by a method on the Region class, which isn't
actually general and isn't used by anything else. Move it over
to be a trait impl verifier method like the others and specialize
it for its task.

Diff Detail

Event Timeline

lattner created this revision.May 28 2021, 3:12 PM
lattner requested review of this revision.May 28 2021, 3:12 PM
rriddle accepted this revision.May 28 2021, 3:24 PM
rriddle added inline comments.
mlir/lib/IR/Operation.cpp
1110–1112

This comment seems off, e.g. there is no noteLoc provided here.

1137–1138

Seems like this is just !region.isAncestor(operandRegion).

This revision is now accepted and ready to land.May 28 2021, 3:24 PM
lattner marked 2 inline comments as done.May 28 2021, 4:02 PM

Thank you for the quick review!

mlir/lib/IR/Operation.cpp
1110–1112

Indeed, fixed!

1137–1138

Oh nice. Thanks!

lattner marked 2 inline comments as done.May 28 2021, 4:02 PM
lattner updated this revision to Diff 348592.May 28 2021, 4:13 PM

Improvements suggested by River

This revision was landed with ongoing or failed builds.May 28 2021, 4:14 PM
This revision was automatically updated to reflect the committed changes.