This is an archive of the discontinued LLVM Phabricator instance.

[mlir] NFC: Move the state for managing aliases out of ModuleState and into a new class AliasState.
ClosedPublic

Authored by rriddle on Jan 6 2020, 10:37 AM.

Details

Summary

This reduces the complexity of ModuleState and simplifies the code. A future revision will mold ModuleState into something that can be used by users for caching of printer state, as well as for implementing printAsOperand style methods.

Diff Detail

Event Timeline

rriddle created this revision.Jan 6 2020, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2020, 10:37 AM

Unit tests: pass. 61127 tests passed, 0 failed and 728 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

antiagainst accepted this revision.Jan 7 2020, 5:54 PM

Nice! I assume this is mostly refactoring so NFC.

mlir/lib/IR/AsmPrinter.cpp
171

Using Twine is kinda dangerous. Do we really need it here?

317

Nit: it would be slightly better to use a local variable for kindAlias.second.

427

Nit: Why inling this one but not the above one?

This revision is now accepted and ready to land.Jan 7 2020, 5:54 PM
rriddle updated this revision to Diff 236749.Jan 7 2020, 8:05 PM
rriddle marked an inline comment as done.

Resolve comments.

rriddle marked 2 inline comments as done.Jan 7 2020, 8:14 PM
rriddle added inline comments.
mlir/lib/IR/AsmPrinter.cpp
171

This is refactoring existing code, but I'll look into removing the twine in a followup. It is useful here to avoid allocating memory for the string in the failure(the common) case.

Thanks for the review Lei!

Unit tests: pass. 61132 tests passed, 0 failed and 728 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

This revision was automatically updated to reflect the committed changes.