BinaryAnalysisPlatform/bap

prune unreachable code in the optimization pass

Closed this issue · 0 comments

ivg commented

The optimization pass may make some code unreachable, propagating a constant value to a branch guard. However, the pass is not removing infeasible edges yielding a program representation that violates a number of invariants.

To prevent this we shall ensure that the unreachable code is effectively removed from the program representation.

As a side note, this dead code may, of course, come from the real dead code in the binary, but more often it comes from a lifter (good example - division by zero handlers, that are left even when the values are constants, like the common idiom int n = sizeof xs / sizeof xs[0], which yields a few basic blocks that are unreachable).