- This commit adds a canonicalization pattern on scf.while to remove the loop invariant arguments.
- An argument is considered loop invariant if the iteration argument value is the same as the corresponding one being yielded (at the same position) in both the before/after block of scf.while.
- For the arguments removed, their use within scf.while and their corresponding scf.while's result are replaced with their corresponding initial value.
Signed-off-by: Abhishek Varma <abhishek.varma@polymagelabs.com>
Isn't arg1 intended to be in first position here?
Or maybe the example is missing an %arg2 = %a in the iter_args?
I think it'd help if you were naming the variable differently and matching the names of the "after" block arguments with the condition operands name.