egraphs-good / eggcc

MIT License
52 stars 11 forks source link

Better cfg optimizer for empty blocks #638

Closed oflatt closed 2 weeks ago

oflatt commented 2 weeks ago

This change simplifies the empty block optimizer, and also adds a new pass that detects blocks that only contain identity operators. This cuts down on intermediate blocks.

oflatt commented 2 weeks ago

Looks like this slightly improves nighly across many benchmarks!

chandrakananandi commented 2 weeks ago

Looks like this slightly improves nighly across many benchmarks!

Will this PR handle this case and remove part1_i_body: ?

br i1 %var40, label %part1_i_body, label %part1_i_done

part1_i_body: ; preds = %part1_i
br label %part1_j

part1_j: ...
oflatt commented 2 weeks ago

What did you want the output optimized code to be? The empty block would be removed by collapse_empty_blocks

chandrakananandi commented 2 weeks ago

What did you want the output optimized code to be? The empty block would be removed by collapse_empty_blocks

I want the result to be

br i1 %var40, label %%part1_j, label %part1_i_done

part1_j: ...

which i think this PR will do?

oflatt commented 2 weeks ago

yep, it'll do that!