Fix exotic loop interchange bug.
Fix exotic loop interchange bug.

This is really a followup to #767, which was fixed incorrectly, but we
didn't notice until recently because we did not type-check IR loops
properly.

HIPERFIT/futhark,diku-dk/futhark,HIPERFIT/futhark,HIPERFIT/futhark,diku-dk/futhark,diku-dk/futhark,diku-dk/futhark,diku-dk/futhark