Skip to content

NormalizeToSubset is creating duplicated symbols #215

@tiagolascasas

Description

@tiagolascasas

NormalizeToSubset, whenever it needs to create a new variable, assigns names based on the pattern "decomp_N", where N is the Nth variable created for that function.

The problem, however, is that if the function already contains variables that follow this pattern, e.g., decomp_0, the transformation will create another variable called decomp_0, as it doesn't check for clashing names. I think the fix here is two-fold:

  1. Create a symbol table of variable decls and params of the function before normalizing, and skip generating a decomp_N symbol if they already exist in the table;
  2. As this problem arises predominantly (but not always) from applying normalization multiple times over the same AST region, I suggest adding an option to use a global N, instead of having it be local to the function. That way, the transform will never generate two clashing decomp_N symbols, no matter how many times it's called over any part of the AST. Using IdGenerator.next("decomp_") would take care of this.

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions