Change signature of CompilerPass.invalidate

* Return true/false depending on whether invalidation is possible
  or not.
Fixes to resetState in IRScope + invalidation in compiler passes.

* Use the new shiny invalidation method to reset state properly.