SymbolRefAttr is fundamentally a base string plus a sequence
of nested references. Instead of storing the string data as
a copies StringRef, store it as an already-uniqued StringAttr.
This makes a lot of things simpler and more efficient because:
- references to the symbol are already stored as StringAttr's: there is no need to copy the string data into MLIRContext multiple times.
- This allows pointer comparisons instead of string comparisons (or redundant uniquing) within SymbolTable.cpp.
- This allows SymbolTable to hold a DenseMap instead of a StringMap (which again copies the string data and slows lookup).
This is a moderately invasive patch, so I kept a lot of
compatibility APIs around. It would be nice to explore changing
getName() to return a StringAttr for example (right now you have
to use getNameAttr()), and eliminate things like the StringRef
version of getSymbol.