LLVM Discussion Forums

Symbol look up in nested Symbol tables

Hi there,

I’m having trouble with finding the usage of a symbol where the user is in a two-level nested symbol table in parallel with where the symbol is defined. Something like:

func @symbol()

symbolTabel1 {
   symbolTable2{
      "foo.user"() {uses = [@symbol]} : () -> ()
   }
}

and I got user empty with

SymbolTable::getSymbolUses(func, symbolTable2)

I’m wondering if my use case is possible in current version of MLIR (use to be working with version about 6 months ago). What might have I done wrong with my current usage?

Thanks!

– Weiwei

You can’t reference a symbol in the parent scope using this mechanism.

@joker-eph Thanks for the reply!

So I’m wondering are you saying “reference a symbol in the parent scope” is just fundamentally not possible for now? Or it’s just because the mechanism I’m using is not correct? If latter, would you mind enlighten me what is the right mechanism to achieve this?

It is just fundamentally not possible. You would need to reference it as an “external” symbol from the MLIR point of view (just like you call an external function)

1 Like