Small refactoring of OptimizerContext.

Introduces a noop OptimizerContext for the cases where it is known that
the context wont be queried.

As a side effect this patch also fixes a performance regression in
DataflowAnalyzer.

Change-Id: I559938e13698468524804c707c3219d1d6def466