tlc-pack / relax

Apache License 2.0
193 stars 58 forks source link

Replace CopyWithNewParams with CopyWithNewVars #406

Closed yelite closed 1 year ago

yelite commented 1 year ago

This PR adds a CopyWithNewVars function to replace CopyWithNewParams. CopyWithNewVars will copy all variables defined in a function, rather than just copy function parameters like what CopyWithNewParams does.

When the copy of a function needs to be added to the same IRModule of original function, it's important that the copy doesn't use the same variable as the original function does. Otherwise it's not possible to assert structural equal between the result and an IRModule created through TVMScript, which is a common pattern used in tests.