egraphs-good / eggcc

MIT License
42 stars 8 forks source link

[Tree unique] Loop strength reduction #263

Closed kirstenmg closed 7 months ago

kirstenmg commented 8 months ago

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.

kirstenmg commented 8 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.

yihozhang commented 8 months ago

Turning this into draft for now. Let me know when it is ready for review!

oflatt commented 7 months ago

Really great work, but we are focusing on the new schema. Close this for now?