This is an archive of the discontinued LLVM Phabricator instance.

[MLIR Core] Cache the empty StringAttr like we do for empty dictionaries. NFC.
ClosedPublic

Authored by lattner on May 25 2021, 2:38 PM.

Details

Summary

MLIRContext holds a few special case values that occur frequently like empty
dictionary and NoneType, which allow us to avoid taking locks to get an instance
of them. Give the empty StringAttr this treatment as well. This cuts several
percent off compile time for CIRCT.

Diff Detail

Event Timeline

lattner created this revision.May 25 2021, 2:38 PM
lattner requested review of this revision.May 25 2021, 2:38 PM
rriddle accepted this revision.May 25 2021, 2:42 PM
rriddle added inline comments.
mlir/lib/IR/MLIRContext.cpp
322

Can you move this to around 336 with the other attributes?

This revision is now accepted and ready to land.May 25 2021, 2:42 PM

Good call, thanks for the review!

lattner updated this revision to Diff 347793.May 25 2021, 2:57 PM

Move emptyString and rename it to be more similar to other cached attrs.

This revision was landed with ongoing or failed builds.May 25 2021, 2:58 PM
This revision was automatically updated to reflect the committed changes.