egraphs-good / eggcc

MIT License
42 stars 8 forks source link

Simplify control flow for CFGs generated by eggcc. #610

Closed ezrosent closed 3 months ago

ezrosent commented 4 months ago

There's a fairly detailed doc comment in simplify_branches.rs. The goal here is to clean up the CFG output and remove redundant branches from the generated code. Here's an example: at head, the sqrt benchmark generates the following cfg:

sqrt-old

And with this PR, we get:

sqrt-new

ezrosent commented 4 months ago

Question for reviewers: this will remove more branches if we iterate to a fixed point. It's easy to add; let me know if you want to try it.

ezrosent commented 4 months ago

Went ahead and added that in the next commit. Figure it's worth looking at nightly with everything. It's a small change and easy to revert. Here's the result for the same sqrt program. sqrt-fp