All optimizations that add to the e-graph should first match on these relations, to make sure we optimize code we care about, and not intermediary terms that still need to be substed or copied. This has the following benefits:
Performance - when we only optimize IsValid expressions, we avoid wasting time on intermediary to-be-copied-or-substed expressions, which could be a source of blowup.
This PR also ports existing optimizations to use these relations.
Adds the following relations, which indicate that we expect some IR to be well-formed (typecheck, proper use of referencing and capturing ids).
All optimizations that add to the e-graph should first match on these relations, to make sure we optimize code we care about, and not intermediary terms that still need to be substed or copied. This has the following benefits:
IsValid
expressions, we avoid wasting time on intermediary to-be-copied-or-substed expressions, which could be a source of blowup.This PR also ports existing optimizations to use these relations.