MemoryCounter: Minor refactors
MemoryCounter: Update counters on exceptions

A basic block in LLVM may include an instruction that calls
__cxa_throw(). This function is used to implement exceptions, and will
never return. Therefore, if an exception is thrown, the number of STORE
and LOAD instructions for that basic block will be lost.

To fix this, we can insert counter increment instructions before the
instruction which precedes unreachable instructions.