While hw.module and hw.instance provide implicit scopes, you can use the dbg.scope operation to explicitly model the hierarchy of an inlined module. This allows you to group all debug variables belonging to the inlined module under a single scope, preserving the original structural view even after the instance operation is removed.
// Before inlining, we represent the inlined module 'Bar' as a scope
%0 = dbg.scope "bar", "Bar"
// Use the 'scope' operand to associate variables with that scope
dbg.variable "x", %a scope %0 : i42
dbg.variable "squared", %1 scope %0 : i42