Closed kirstenmg closed 7 months ago
This is dependent on referencing id analysis, but since the id analysis branch is on my own fork I don't think I can configure GitHub to show just the diff between this branch and the id analysis branch in this PR.
Turning this into draft for now. Let me know when it is ready for review!
Really great work, but we are focusing on the new schema. Close this for now?
Implement the optimization loop strength reduction. Note that this does not work for a case covered in previous iterations of the optimization: where the constant being multiplied is a Num, rather than an invariant input. This is because the constant needs to be added to an input of the loop, and so needs to use the ID of the loop's outer context. For invariant inputs, we just use the value of the invariant from the loop input. However, for a Num, we need to change its Id to use it in the input, since we only matched on a num from within the Loop body. To get the id of the Loop's outer context, we need RefIdOf.