Skip to content

Commit

Permalink
#2716 improve _rm_imported_symbol and only attempt to add interface s…
Browse files Browse the repository at this point in the history
…ym if not present [skip ci]
  • Loading branch information
arporter committed Oct 8, 2024
1 parent 6925697 commit 0b6ce32
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ def _rm_imported_symbol(name, table):
:type table: :py:class:`psyclone.psyir.symbols.SymbolTable`
'''
symbol = table.lookup(name)
if not symbol.is_import:
symbol = table.lookup(name, otherwise=None)
if not symbol or not symbol.is_import:
return

# The RoutineSymbol is in the table (or an outer scope) and is
Expand Down Expand Up @@ -482,12 +482,10 @@ def apply(self, node, options=None):
f" is not implemented yet.")

if interface_sym:
local_sym = local_table.lookup(interface_sym.name, otherwise=None)
if local_sym:
self._rm_imported_symbol(interface_sym.name,
local_table)
container.symbol_table.add(interface_sym)
interface_sym.replace_symbols_using(container.symbol_table)
self._rm_imported_symbol(interface_sym.name, local_table)
if interface_sym.name not in container.symbol_table:
container.symbol_table.add(interface_sym)
interface_sym.replace_symbols_using(container.symbol_table)

# Set the module-inline flag to avoid generating the kernel imports
# TODO #1823. If the kernel imports were generated at PSy-layer
Expand Down

0 comments on commit 0b6ce32

Please sign in to comment.