-
Notifications
You must be signed in to change notification settings - Fork 11
Labels
Description
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:
- 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;
- 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.
Reactions are currently unavailable