Fix #573: Add an IR checker.

The last fix to IR types, discovered by 1 lonely partest. And then the IR checker. Some more info in the commit message.