egraphs-good / eggcc

MIT License
42 stars 8 forks source link

[Tree Unique] Add ids to switch statements #278

Closed oflatt closed 7 months ago

oflatt commented 8 months ago

Each branch of a Switch should get it's own id. Many useful optimizations learn context-specific information in different branches. Right now, we can't do these unions soundly because branches do not have their own ids.

Example:

if x < 0:
  abs(x)
else:
  abs(x)+1

=>

if x < 0:
  -x
else:
  x+1
oflatt commented 7 months ago

Added in the tree optimizer schema