falconre / falcon

Binary Analysis Framework in Rust
Apache License 2.0
549 stars 47 forks source link

Graph: Use Semi-NCA algorithm in compute_immediate_dominators #77

Closed emmanuel099 closed 4 years ago

emmanuel099 commented 4 years ago

The Semi-NCA algorithm is described in: Linear-Time Algorithms for Dominators and Related Problems https://www.cs.princeton.edu/research/techreps/TR-737-05

This algorithm drastically improves the performance of compute_immediate_dominators as shown in the following benchmark.

The graph shows the execution time of the SSA transformation (which requires the immediate dominators) for a small single-loop program. The control flow graph is obtained by unrolling the loop k times (roughly speaking: duplicating the loop body k times and adding additional CFG edges to obtain a loop-free program). The resulting CFG has 8+k*2 basic blocks, meaning that we measure the execution time of the SSA transformation of 8+k*2 basic blocks.

image

For k=150:

endeav0r commented 4 years ago

I see the amazing number of PRs. I will set time aside this weekend to get to them.