Lunderberg commented on PR #15852:
URL: https://github.com/apache/tvm/pull/15852#issuecomment-1743161447

   Thank you, and I've identified why this happens.  The `CodeGenVM` has a 
special case to handle trivial re-bindings of a variable, such that they share 
the same register.  While `KillAfterLastUse` checks for this case in 
`VarBinding` nodes, it does not also check for it in `MatchCast` nodes.
   
   Working on two fixes now, one for the short-term and one for the long-term.  
The short-term fix will add similar handling to `KillAfterLastUse` to check for 
trivial rebinding through a `MatchCast` node.  The long-term fix will remove 
the special-case for trivial rebindings in the `CodeGenVM`, and instead instead 
apply `CanonicalizeBindings` as part of the lowering flow to remove all such 
cases.  This way, we get the same codegened module, but the upstream passes do 
not need to know exactly what `CodeGenVM` does internally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to