File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,13 @@ class SymbolTableCollection {
316316 // / Lookup, or create, a symbol table for an operation.
317317 SymbolTable &getSymbolTable (Operation *op);
318318
319+ // / Invalidate the cached symbol table for an operation.
320+ // / This is important when doing IR modifications that erase and also create
321+ // / operations having the 'OpTrait::SymbolTable' trait. If a symbol table of
322+ // / an erased operation is not invalidated, a new operation sharing the same
323+ // / address would be associated with outdated, and wrong, information.
324+ void invalidateSymbolTable (Operation *op);
325+
319326private:
320327 friend class LockedSymbolTableCollection ;
321328
Original file line number Diff line number Diff line change @@ -998,6 +998,10 @@ SymbolTable &SymbolTableCollection::getSymbolTable(Operation *op) {
998998 return *it.first ->second ;
999999}
10001000
1001+ void SymbolTableCollection::invalidateSymbolTable (Operation *op) {
1002+ symbolTables.erase (op);
1003+ }
1004+
10011005// ===----------------------------------------------------------------------===//
10021006// LockedSymbolTableCollection
10031007// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments